Skip to content

Commit a71fc39

Browse files
authored
Merge pull request #3532 from rina23q/ci/move-cargo-test-to-build-workflow
ci: move cargo-test job to build-workflow
2 parents 42bf3a1 + bea3cba commit a71fc39

File tree

2 files changed

+63
-72
lines changed

2 files changed

+63
-72
lines changed

.github/workflows/build-workflow.yml

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,63 @@ env:
3131
CARGO_TERM_COLOR: always
3232

3333
jobs:
34+
cargo-test:
35+
name: Run cargo test
36+
runs-on: ubuntu-22.04
37+
steps:
38+
- name: Check disk space before setting up
39+
run: df -BM
40+
41+
- name: Reclaim some disk space
42+
run: |
43+
sudo rm -rf /usr/share/dotnet
44+
sudo rm -rf /opt/ghc
45+
sudo rm -rf "/usr/local/share/boost"
46+
sudo rm -rf /opt/hostedtoolcache
47+
48+
- name: Check disk space after freeing
49+
run: df -BM
50+
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Retrieve MSRV from workspace Cargo.toml
55+
id: rust_version
56+
uses: SebRollen/toml-action@v1.2.0
57+
with:
58+
file: Cargo.toml
59+
field: "workspace.package.rust-version"
60+
61+
- name: Enable toolchain via github action
62+
uses: dtolnay/rust-toolchain@stable
63+
with:
64+
components: llvm-tools-preview
65+
66+
- name: Enable cache
67+
uses: Swatinem/rust-cache@v2
68+
69+
- name: Install latest nextest release
70+
uses: taiki-e/install-action@nextest
71+
72+
- name: cargo install cargo-llvm-cov
73+
uses: taiki-e/install-action@cargo-llvm-cov
74+
75+
- name: cargo llvm-cov
76+
run: cargo llvm-cov nextest --no-fail-fast --locked --all-features --all-targets --codecov --output-path codecov.json
77+
78+
# https://github.com/rust-lang/cargo/issues/6669
79+
- name: cargo test --doc
80+
run: cargo test --locked --all-features --doc
81+
82+
- name: Upload to codecov.io
83+
uses: codecov/codecov-action@v5
84+
with:
85+
token: ${{ secrets.CODECOV_TOKEN }}
86+
fail_ci_if_error: false
87+
88+
- name: Check disk space after completing workflow
89+
run: df -BM
90+
3491
build:
3592
name: Build ${{ matrix.target }}
3693
runs-on: ${{ matrix.host_os }}
@@ -259,7 +316,7 @@ jobs:
259316
(needs.check-build.result == 'success') &&
260317
(needs.test.result == 'success' || needs.test.result == 'skipped')
261318
runs-on: ubuntu-22.04
262-
needs: [check-build, test]
319+
needs: [check-build, test, cargo-test]
263320
strategy:
264321
fail-fast: false
265322
matrix:
@@ -314,7 +371,7 @@ jobs:
314371
(needs.check-build.result == 'success') &&
315372
(needs.test.result == 'success' || needs.test.result == 'skipped')
316373
runs-on: ubuntu-22.04
317-
needs: [check-build, test]
374+
needs: [check-build, test, cargo-test]
318375
env:
319376
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
320377
permissions:

.github/workflows/pull-request-checks.yml

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
changes:
2525
name: Filter changes
2626
runs-on: ubuntu-22.04
27+
if: ${{ github.event_name != 'merge_group' }}
2728
# Set job outputs to values from filter step
2829
outputs:
2930
rust: ${{ steps.filter.outputs.rust || 'true' }}
@@ -42,6 +43,7 @@ jobs:
4243
- 'crates/**'
4344
- 'plugins/**'
4445
- 'Cargo.*'
46+
- '**/Cargo.toml'
4547
workflows:
4648
- '.github/workflows/**'
4749
docs:
@@ -53,9 +55,8 @@ jobs:
5355
check-lockfile-uptodate:
5456
name: Check whether Cargo.lock is up to date
5557
runs-on: ubuntu-22.04
56-
if: ${{ github.event_name == 'pull_request' }}
57-
outputs:
58-
locks: ${{ steps.filter.outputs.locks }}
58+
needs: changes
59+
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
5960
steps:
6061
- uses: actions/checkout@v4
6162

@@ -74,15 +75,7 @@ jobs:
7475

7576
- uses: Swatinem/rust-cache@v2
7677

77-
- uses: dorny/paths-filter@v3
78-
id: filter
79-
with:
80-
filters: |
81-
locks:
82-
- '**/Cargo.toml'
83-
8478
- name: Check whether lockfile is up to date
85-
if: steps.filter.outputs.locks == 'true'
8679
run: cargo check --locked
8780

8881
udeps:
@@ -253,65 +246,6 @@ jobs:
253246
- name: Run `cargo check`
254247
run: cargo check --all-targets --all-features
255248

256-
cargo-test:
257-
name: Run cargo test
258-
runs-on: ubuntu-22.04
259-
needs: changes
260-
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
261-
steps:
262-
- name: Check disk space before setting up
263-
run: df -BM
264-
265-
- name: Reclaim some disk space
266-
run: |
267-
sudo rm -rf /usr/share/dotnet
268-
sudo rm -rf /opt/ghc
269-
sudo rm -rf "/usr/local/share/boost"
270-
sudo rm -rf /opt/hostedtoolcache
271-
272-
- name: Check disk space after freeing
273-
run: df -BM
274-
275-
- name: Checkout
276-
uses: actions/checkout@v4
277-
278-
- name: Retrieve MSRV from workspace Cargo.toml
279-
id: rust_version
280-
uses: SebRollen/toml-action@v1.2.0
281-
with:
282-
file: Cargo.toml
283-
field: "workspace.package.rust-version"
284-
285-
- name: Enable toolchain via github action
286-
uses: dtolnay/rust-toolchain@stable
287-
with:
288-
components: llvm-tools-preview
289-
290-
- name: Enable cache
291-
uses: Swatinem/rust-cache@v2
292-
293-
- name: Install latest nextest release
294-
uses: taiki-e/install-action@nextest
295-
296-
- name: cargo install cargo-llvm-cov
297-
uses: taiki-e/install-action@cargo-llvm-cov
298-
299-
- name: cargo llvm-cov
300-
run: cargo llvm-cov nextest --no-fail-fast --locked --all-features --all-targets --codecov --output-path codecov.json
301-
302-
# https://github.com/rust-lang/cargo/issues/6669
303-
- name: cargo test --doc
304-
run: cargo test --locked --all-features --doc
305-
306-
- name: Upload to codecov.io
307-
uses: codecov/codecov-action@v5
308-
with:
309-
token: ${{ secrets.CODECOV_TOKEN }}
310-
fail_ci_if_error: false
311-
312-
- name: Check disk space after completing workflow
313-
run: df -BM
314-
315249
shellcheck:
316250
name: Shellcheck
317251
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)