Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add diffedit3 as a dotslash tool #4295

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/actions/install-dotslash/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Install DotSlash
description: Install DotSlash on the current system
inputs:
version:
description: "version of dotslash"
required: false
default: "0.4.1"
runs:
using: "composite"
steps:
- name: Install DotSlash
shell: bash
run: |
mkdir -p $RUNNER_TEMP/dotslash
echo "$RUNNER_TEMP/dotslash" >> $GITHUB_PATH

if [[ "$RUNNER_OS" == "Windows" ]]; then
C:\\msys64\\usr\\bin\\wget.exe https://github.com/facebook/dotslash/releases/download/v0.4.1/dotslash-windows.v0.4.1.tar.gz
tar xf dotslash-windows.v0.4.1.tar.gz
mv dotslash.exe $RUNNER_TEMP/dotslash
else
if [[ "$RUNNER_OS" == "macOS" ]]; then
wget https://github.com/facebook/dotslash/releases/download/v0.4.1/dotslash-macos.v0.4.1.tar.gz
tar xf dotslash-macos.v0.4.1.tar.gz
elif [[ "$RUNNER_OS" == "Linux" ]]; then
wget https://github.com/facebook/dotslash/releases/download/v0.4.1/dotslash-ubuntu-22.04.x86_64.v0.4.1.tar.gz
tar xf dotslash-ubuntu-22.04.x86_64.v0.4.1.tar.gz
fi
mv dotslash $RUNNER_TEMP/dotslash
fi
41 changes: 41 additions & 0 deletions .github/workflows/check-dotslash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: check dotslash files

on:
push:
branches:
- main
pull_request:

permissions: read-all

jobs:
nix:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
abi: x86_64-unknown-linux-gnu
- os: windows-latest
abi: x86_64-pc-windows-msvc
- os: macos-latest
abi: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
timeout-minutes: 15 # NOTE (aseipp): keep in-sync with the build.yml timeout limit

name: check dotslash files
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Install DotSlash
uses: ./.github/actions/install-dotslash
- shell: bash
run: |
for x in $(ls tools/bin); do
if [ "$x" = "README.md" ]; then
continue;
fi
if ! dotslash "tools/bin/$x" --help; then
echo "error: $x failed to run on ${{ matrix.abi }}"
exit 1
fi
done
44 changes: 44 additions & 0 deletions tools/bin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# `dotslash` executables

This directory contains various [DotSlash](https://github.com/facebook/dotslash)
executables: portable executables that are downloaded on demand.

DotSlash lets us have our tools available on any platform without the need to
install them, in a version-controllable and repeatable way that doesn't bloat
repositories. This helps make sure developers can have consistent environments,
if they wish to opt in.

- [Install DotSlash](https://dotslash-cli.com/docs/installation/)
- TL;DR cargo users: `cargo install dotslash`
- TL;DR nix users: `nix profile install nixpkgs#dotslash`
- TL;DR everyone else: [Download the latest release](https://github.com/facebook/dotslash/releases)

> [!TIP]
> DotSlash files are most useful for cross-platform tools we want to provide
> _developers_ on _all_ platforms — including Windows! Some other tools
> may also be provided by e.g. Nix or Cargo.

Once `dotslash` is somewhere in your `$PATH`, add these files to your `$PATH`
too:

```bash
export PATH=$(jj root)/tools/bin:$PATH
```

Then tools like `diffedit3` will work with a small one-time startup penalty to
download the executable.

If you're curious, just open any of the DotSlash files in this directory in
your EDITOR; they are merely simple JSON files.

## Windows users

Windows users need to invoke the path to the dotslash file with the `dotslash`
command:

```
dotslash .\tools\bin\diffedit3
```

This is a technical limitation that will be alleivated in the future (once the
`windows_shim` for DotSlash is released.)
43 changes: 43 additions & 0 deletions tools/bin/diffedit3
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env dotslash

{
"name": "diffedit3",
"platforms": {
"macos-aarch64": {
"size": 2285223,
"hash": "blake3",
"digest": "2b4fdb0587aece5658030b68dc7271973b5c731e0c2493efd3aa87ff3f445a61",
"format": "tar.gz",
"path": "diffedit3",
"providers": [
{
"url": "https://github.com/ilyagr/diffedit3/releases/download/v0.4.0/diffedit3-v0.4.0-aarch64-apple-darwin.tar.gz",
}
]
},
"windows-x86_64": {
"size": 1900470,
"hash": "blake3",
"digest": "462c4fc77655e0688e5317fcdc2a4a6af326b7f04912fc8c7489028b56e50a59",
"format": "zip",
"path": "diffedit3.exe",
"providers": [
{
"url": "https://github.com/ilyagr/diffedit3/releases/download/v0.4.0/diffedit3-v0.4.0-x86_64-pc-windows-msvc.zip"
}
]
},
"linux-x86_64": {
"size": 3498501,
"hash": "blake3",
"digest": "84557e1409e0e4c76d80ff0758ab5995ec40dd7a151bfdef7858c54d71d43d9a",
"format": "tar.gz",
"path": "diffedit3",
"providers": [
{
"url": "https://github.com/ilyagr/diffedit3/releases/download/v0.4.0/diffedit3-v0.4.0-x86_64-unknown-linux-musl.tar.gz"
}
]
}
}
}
Loading