diff --git a/.github/actions/cargo-install/action.yml b/.github/actions/cargo-install/action.yml index 9a5a8f571..d2d538996 100644 --- a/.github/actions/cargo-install/action.yml +++ b/.github/actions/cargo-install/action.yml @@ -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 }} diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 1fdb732ed..5174422f8 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -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: diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index fbd75933e..32eae1686 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -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