diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e1dc93a..390eb935 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,10 +66,10 @@ jobs: tool: ${{ steps.tool-list.outputs.tool }} # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell - name: Test bash - run: just --version; shfmt --version; protoc --version + run: just --version && shfmt --version && protoc --version shell: bash - name: Test sh - run: just --version; shfmt --version; protoc --version + run: just --version && shfmt --version && protoc --version shell: sh if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') - name: Test pwsh @@ -118,29 +118,8 @@ jobs: timeout-minutes: 60 container: ${{ matrix.container }} steps: - - name: Install requirements (ubuntu/debian) - run: | - set -eEuxo pipefail - apt-get -o Acquire::Retries=10 -qq update - apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends cargo - if: startsWith(matrix.container, 'ubuntu') || startsWith(matrix.container, 'debian') - - name: Install requirements (fedora/almalinux/centos) - run: | - set -eEuxo pipefail - curl --proto '=https' --tlsv1.2 -fsSL --retry 10 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable --no-modify-path - echo "$HOME/.cargo/bin" >>"${GITHUB_PATH}" - if: startsWith(matrix.container, 'fedora') || startsWith(matrix.container, 'almalinux') || startsWith(matrix.container, 'centos') - - name: Install requirements (opensuse) - run: | - set -eEuxo pipefail - zypper install -y rustup - rustup toolchain add stable --profile minimal - if: startsWith(matrix.container, 'opensuse') - - name: Install requirements (archlinux) - run: pacman -Sy --noconfirm rust - if: startsWith(matrix.container, 'archlinux') - name: Install requirements (alpine) - run: apk --no-cache add bash cargo + run: apk --no-cache add bash shell: sh if: startsWith(matrix.container, 'alpine') - uses: taiki-e/checkout-action@v1 @@ -153,19 +132,6 @@ jobs: with: tool: ${{ steps.tool-list.outputs.tool }} - test-no-cargo: - runs-on: ubuntu-latest - timeout-minutes: 60 - container: ubuntu - steps: - - uses: taiki-e/checkout-action@v1 - - name: Generate tool list - id: tool-list - run: tools/ci/tool-list.sh >>"${GITHUB_OUTPUT}" - - uses: ./ - with: - tool: ${{ steps.tool-list.outputs.tool }} - manifest: runs-on: ubuntu-latest timeout-minutes: 60 diff --git a/CHANGELOG.md b/CHANGELOG.md index 28096a6b..c0827d49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Support cargo-binstall fallback without cargo. + ## [2.33.36] - 2024-06-01 - Update `cargo-llvm-cov@latest` to 0.6.10. diff --git a/README.md b/README.md index f7d7ae6c..99c5b7a6 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,6 @@ This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) a To use this action in self-hosted runners or in containers, at least the following tools are required: - bash -- cargo (if you use cargo-binstall fallback) ## Related Projects diff --git a/main.sh b/main.sh index fa2faa01..9beb4834 100755 --- a/main.sh +++ b/main.sh @@ -748,5 +748,11 @@ if [[ ${#unsupported_tools[@]} -gt 0 ]]; then # By default, cargo-binstall enforce downloads over secure transports only. # As a result, http will be disabled, and it will also set # min tls version to be 1.2 - cargo binstall --force --no-confirm --locked "${unsupported_tools[@]}" + cargo-binstall binstall --force --no-confirm --locked "${unsupported_tools[@]}" + if ! type -P cargo >/dev/null; then + _bin_dir=$(canonicalize_windows_path "${HOME}/.cargo/bin") + # TODO: avoid this when already added + info "adding '${_bin_dir}' to PATH" + echo "${_bin_dir}" >>"${GITHUB_PATH}" + fi fi diff --git a/tools/ci/tool-list.sh b/tools/ci/tool-list.sh index c14b719c..70f55c71 100755 --- a/tools/ci/tool-list.sh +++ b/tools/ci/tool-list.sh @@ -128,17 +128,14 @@ case "${host_os}" in fi ;; esac -# cargo-binstall requires cargo -if type -P cargo &>/dev/null; then - # cargo-watch/watchexec-cli is supported by cargo-binstall (through quickinstall) - case "${version}" in - latest) tools+=(cargo-watch watchexec-cli nextest) ;; - major.minor.patch) tools+=(cargo-watch@8.1.1 watchexec-cli@1.20.5 nextest@0.9.57) ;; - major.minor) tools+=(cargo-watch@8.1 watchexec-cli@1.20 nextest@0.9) ;; - major) tools+=(cargo-watch@8 watchexec-cli@1) ;; - *) exit 1 ;; - esac -fi +# cargo-watch/watchexec-cli is supported by cargo-binstall (through quickinstall) +case "${version}" in + latest) tools+=(cargo-watch watchexec-cli nextest) ;; + major.minor.patch) tools+=(cargo-watch@8.1.1 watchexec-cli@1.20.5 nextest@0.9.57) ;; + major.minor) tools+=(cargo-watch@8.1 watchexec-cli@1.20 nextest@0.9) ;; + major) tools+=(cargo-watch@8 watchexec-cli@1) ;; + *) exit 1 ;; +esac # sort and dedup IFS=$'\n'