Split test into two jobs

so that they will have they own cache (since different feature flags are used).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2024-06-12 01:00:07 +10:00
parent 7f7eaa8beb
commit c22d5a208e
No known key found for this signature in database
GPG key ID: 76D1E687CA3C4928
2 changed files with 35 additions and 4 deletions

View file

@ -69,7 +69,7 @@ jobs:
echo "crates_changed=$crates_changed" | tee -a "$GITHUB_OUTPUT" echo "crates_changed=$crates_changed" | tee -a "$GITHUB_OUTPUT"
echo "has_detect_target_changed=$has_detect_target_changed" | tee -a "$GITHUB_OUTPUT" echo "has_detect_target_changed=$has_detect_target_changed" | tee -a "$GITHUB_OUTPUT"
test: unit-tests:
needs: changed-files needs: changed-files
strategy: strategy:
fail-fast: false fail-fast: false
@ -107,11 +107,41 @@ jobs:
done done
echo "CARGO_NEXTEST_ADDITIONAL_ARGS=$ARGS" | tee -a "$GITHUB_ENV" echo "CARGO_NEXTEST_ADDITIONAL_ARGS=$ARGS" | tee -a "$GITHUB_ENV"
- run: just test - run: just unit-tests
env: env:
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN }}
CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN }} CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN }}
e2e-tests:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-14
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/just-setup
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN }}
- run: |
just build
just e2e-tests
env:
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN }}
cross-check: cross-check:
strategy: strategy:
fail-fast: false fail-fast: false
@ -357,7 +387,8 @@ jobs:
tests-pass: tests-pass:
name: Tests pass name: Tests pass
needs: needs:
- test - unit-tests
- e2e-tests
- cross-check - cross-check
- lint - lint
- release-dry-run - release-dry-run

View file

@ -262,7 +262,7 @@ e2e-tests: e2e-test-live e2e-test-manifest-path e2e-test-git e2e-test-other-repo
unit-tests: print-env unit-tests: print-env
cargo nextest run --target {{target}} {{cargo-nextest-additional-args}} cargo nextest run --target {{target}} {{cargo-nextest-additional-args}}
cargo test --doc {{cargo-build-args}} cargo test --doc --target {{target}}
test: unit-tests build e2e-tests test: unit-tests build e2e-tests