Fix CI: Use cargo-hack 0.6.10 (#1468)

* Fix ci: Install deps before caching and include `JUST*` env values in caching key

To make sure caching is done properly and does not accidentally include
(old) pre-built binaries that we don't want.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix missing `shell`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix justfile target `check`: Call `cargo hack check` directly

without using the `CARGO=cargo-zigbuild` env since `leon` does not use
external C/C++ compiler anyway.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Dowgrade cargo-hack to 0.6.10

This is the last version working

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-10-20 20:37:54 +10:00 committed by GitHub
parent 4de2d0f49c
commit 7e132f690d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 12 deletions

View file

@ -53,7 +53,12 @@ runs:
fi fi
shell: bash shell: bash
- run: just ci-install-deps
shell: bash
- if: inputs.indexcache || inputs.buildcache - if: inputs.indexcache || inputs.buildcache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with:
env-vars: "CARGO CC CFLAGS CXX CMAKE RUST JUST"
env: env:
RUSTFLAGS: ${{ steps.retrieve-rustflags.outputs.RUSTFLAGS }} RUSTFLAGS: ${{ steps.retrieve-rustflags.outputs.RUSTFLAGS }}

View file

@ -58,7 +58,6 @@ jobs:
# which works better when we provide it with GITHUB_TOKEN. # which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just ci-install-deps
- run: just test - run: just test
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -87,19 +86,19 @@ jobs:
CARGO_BUILD_TARGET: ${{ matrix.target }} CARGO_BUILD_TARGET: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/just-setup
with:
tools: cargo-hack
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable cargo-zigbuild - name: Enable cargo-zigbuild
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: echo JUST_USE_CARGO_ZIGBUILD=true >> "$GITHUB_ENV" run: echo JUST_USE_CARGO_ZIGBUILD=true >> "$GITHUB_ENV"
- run: just ci-install-deps - uses: ./.github/actions/just-setup
with:
tools: cargo-hack@0.6.10
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just avoid-dev-deps - run: just avoid-dev-deps
- run: just check - run: just check
@ -121,7 +120,6 @@ jobs:
- uses: ./.github/actions/just-setup - uses: ./.github/actions/just-setup
- run: just toolchain rustfmt,clippy - run: just toolchain rustfmt,clippy
- run: just ci-install-deps
- run: just avoid-dev-deps - run: just avoid-dev-deps
- run: just lint - run: just lint

View file

@ -69,7 +69,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just toolchain rust-src - run: just toolchain rust-src
- run: just ci-install-deps
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:

View file

@ -215,7 +215,7 @@ build: print-env
check: print-env check: print-env
{{cargo-bin}} check {{cargo-build-args}} --profile check-only {{cargo-bin}} check {{cargo-build-args}} --profile check-only
cargo-hack hack check --feature-powerset -p leon {{cargo-check-args}} --profile check-only cargo hack check --feature-powerset -p leon {{cargo-check-args}} --profile check-only
{{cargo-bin}} check -p binstalk-downloader --no-default-features --profile check-only {{cargo-bin}} check -p binstalk-downloader --no-default-features --profile check-only
{{cargo-bin}} check -p cargo-binstall --no-default-features --features rustls {{cargo-check-args}} --profile check-only {{cargo-bin}} check -p cargo-binstall --no-default-features --features rustls {{cargo-check-args}} --profile check-only
cargo-hack hack check -p binstalk-downloader \ cargo-hack hack check -p binstalk-downloader \