Skip to content

Commit 34129fd

Browse files
committed
ci: move cargo-test job to build-workflow
Signed-off-by: Rina Fujino <rina.fujino.23@gmail.com>
1 parent 321ba2b commit 34129fd

File tree

2 files changed

+60
-62
lines changed

2 files changed

+60
-62
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: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Pull Request Checks
33
on:
44
workflow_dispatch:
55
pull_request:
6-
merge_group:
6+
77
env:
88
CARGO_TERM_COLOR: always
99

@@ -253,65 +253,6 @@ jobs:
253253
- name: Run `cargo check`
254254
run: cargo check --all-targets --all-features
255255

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-
315256
shellcheck:
316257
name: Shellcheck
317258
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)