Skip to content

Commit

Permalink
Install binstall quicker
Browse files Browse the repository at this point in the history
  • Loading branch information
maxammann committed Oct 30, 2022
1 parent acecffc commit 4230fa3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
58 changes: 52 additions & 6 deletions .github/actions/cargo-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,60 @@ inputs:
runs:
using: "composite"
steps:
- name: Setup default toolchain
- name: Install binstall
run: |
if command -v cargo-binstall &> /dev/null; then
echo "binstall already found"
exit 0
fi
FILE=""
if [ "$RUNNER_OS" == "Linux" ]; then
FILE="cargo-binstall-x86_64-unknown-linux-gnu.tgz"
elif [ "$RUNNER_OS" == "Windows" ]; then
FILE="cargo-binstall-x86_64-pc-windows-msvc.zip"
elif [ "$RUNNER_OS" == "macOS" ]; then
if [ "$RUNNER_ARCH" == "ARM64" ]; then
FILE="cargo-binstall-aarch64-apple-darwin.zip"
elif [ "$RUNNER_ARCH" == "X64" ]; then
FILE="cargo-binstall-x86_64-apple-darwin.zip"
else
echo "Unable to install on arch: $RUNNER_ARCH"
exit 1
fi
else
# Install with debug profile -> faster compilation
cargo install --debug cargo-binstall
fi
if [ "$FILE" != "" ]; then
URL="https://github.com/cargo-bins/cargo-binstall/releases/download/v0.16.0/$FILE"
echo "Downloading binstall: $URL"
curl -L -o /tmp/binstall.bin "$URL"
echo "Installing binstall"
INSTALL_PATH="~/.binstall/"
mkdir -p "$INSTALL_PATH"
if [[ $FILE == *"zip"* ]]; then
unzip /tmp/binstall.bin -d "$INSTALL_PATH"
elif [[ $FILE == *"tgz"* ]]; then
tar xf /tmp/binstall.bin -C "$INSTALL_PATH"
else
echo "Unknown format: $FILE"
exit 1
fi
echo "$INSTALL_PATH" >> $GITHUB_PATH
else
echo "Skipping binary install"
fi
shell: bash
run: rustup show # Installs toolchain specified in rust-toolchain.toml
- name: Install binstall
- name: Upgrade binstall
shell: bash
run: |
# Install with debug profile -> faster compilation
cargo install --debug cargo-binstall
run: cargo binstall --no-confirm --force cargo-binstall
- name: Install ${{ inputs.name }}
shell: bash
run: cargo binstall --no-confirm --force ${{ inputs.name }}
3 changes: 3 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ runs:
steps:
# The Rust version from rust-toolchain.toml is used for the first steps. Later the Rust version is changed
# by setting another version in "Set XYZ toolchain".
- name: Setup default toolchain
shell: bash
run: rustup show # Installs toolchain specified in rust-toolchain.toml
- name: Install just
uses: ./.github/actions/cargo-install
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/demo-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ jobs:
name: Build
runs-on: windows-2022
steps:
- name: Switch shell to msys2
- name: Switch to msys2
run: echo "C:\msys64\usr\bin" >> $GITHUB_PATH
shell: bash
- name: Install mysys2 dependencies
run: pacman -S --noconfirm unzip
shell: bash
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
Expand Down

0 comments on commit 4230fa3

Please sign in to comment.