Skip to content

Commit e3147ff

Browse files
committed
ci: run Rust workflow through cargo-rbmt
1 parent 53a4f3f commit e3147ff

3 files changed

Lines changed: 32 additions & 151 deletions

File tree

.github/actions/checkout-maintainer-tools/action.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/rust.yml

Lines changed: 32 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,20 @@ on: # yamllint disable-line rule:truthy
88
name: Continuous integration
99

1010
jobs:
11-
Prepare:
12-
runs-on: ubuntu-latest
13-
outputs:
14-
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
15-
msrv_version: ${{ steps.read_msrv.outputs.msrv_version }}
16-
steps:
17-
- name: "Checkout repo"
18-
uses: actions/checkout@v4
19-
- name: "Read nightly version"
20-
id: read_toolchain
21-
run: |
22-
set -euo pipefail
23-
version=$(cat nightly-version)
24-
echo "nightly_version=$version" >> $GITHUB_OUTPUT
25-
- name: Read MSRV from clippy.toml
26-
id: read_msrv
27-
run: |
28-
set -euo pipefail
29-
msrv=$(grep '^msrv *= *"' clippy.toml | sed -E 's/.*"([^"]+)".*/\1/')
30-
echo "msrv_version=$msrv" >> "$GITHUB_OUTPUT"
31-
32-
Stable:
33-
name: Test - stable toolchain
11+
Test:
12+
name: Test - ${{ matrix.toolchain }} toolchain
3413
runs-on: ubuntu-latest
3514
strategy:
3615
fail-fast: false
16+
matrix:
17+
toolchain: [stable, nightly, msrv]
3718
steps:
3819
- name: "Checkout repo"
3920
uses: actions/checkout@v4
40-
- name: "Checkout maintainer tools"
41-
uses: ./.github/actions/checkout-maintainer-tools
42-
- name: "Select toolchain"
43-
uses: dtolnay/rust-toolchain@stable
44-
- name: "Run test script"
45-
run: ./maintainer-tools/ci/run_task.sh stable
21+
- name: "Setup cargo-rbmt"
22+
uses: ./.github/actions/setup-rbmt
23+
- name: "Run tests"
24+
run: cargo rbmt --lock-file existing test --toolchain ${{ matrix.toolchain }}
4625

4726
Windows:
4827
name: Test - Windows stable toolchain
@@ -57,118 +36,33 @@ jobs:
5736
- name: "Run tests"
5837
run: cargo test
5938

60-
Nightly:
61-
name: Test - nightly toolchain
62-
needs: Prepare
63-
runs-on: ubuntu-latest
64-
strategy:
65-
fail-fast: false
66-
steps:
67-
- name: "Checkout repo"
68-
uses: actions/checkout@v4
69-
- name: "Checkout maintainer tools"
70-
uses: ./.github/actions/checkout-maintainer-tools
71-
- name: "Select toolchain"
72-
uses: dtolnay/rust-toolchain@v1
73-
with:
74-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
75-
- name: "Run test script"
76-
run: ./maintainer-tools/ci/run_task.sh nightly
77-
78-
MSRV:
79-
name: Test - MSRV
80-
needs: Prepare
81-
runs-on: ubuntu-latest
82-
strategy:
83-
fail-fast: false
84-
steps:
85-
- name: "Checkout repo"
86-
uses: actions/checkout@v4
87-
- name: "Checkout maintainer tools"
88-
uses: ./.github/actions/checkout-maintainer-tools
89-
- name: "Select toolchain"
90-
uses: dtolnay/rust-toolchain@stable
91-
with:
92-
toolchain: ${{ needs.Prepare.outputs.msrv_version }}
93-
- name: "Run test script"
94-
run: ./maintainer-tools/ci/run_task.sh msrv
95-
96-
Lint:
97-
name: Lint - nightly toolchain
98-
needs: Prepare
99-
runs-on: ubuntu-latest
100-
strategy:
101-
fail-fast: false
102-
matrix:
103-
dep: [recent]
104-
steps:
105-
- name: "Checkout repo"
106-
uses: actions/checkout@v4
107-
- name: "Checkout maintainer tools"
108-
uses: ./.github/actions/checkout-maintainer-tools
109-
- name: "Select toolchain"
110-
uses: dtolnay/rust-toolchain@v1
111-
with:
112-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
113-
- name: Install clippy
114-
run: rustup component add clippy
115-
- name: "Run test script"
116-
run: ./maintainer-tools/ci/run_task.sh lint
117-
118-
Docs:
119-
name: Docs - stable toolchain
120-
runs-on: ubuntu-latest
121-
strategy:
122-
fail-fast: false
123-
matrix:
124-
dep: [recent]
125-
steps:
126-
- name: "Checkout repo"
127-
uses: actions/checkout@v4
128-
- name: "Checkout maintainer tools"
129-
uses: ./.github/actions/checkout-maintainer-tools
130-
- name: "Select toolchain"
131-
uses: dtolnay/rust-toolchain@stable
132-
- name: "Run test script"
133-
run: ./maintainer-tools/ci/run_task.sh docs
134-
135-
Docsrs:
136-
name: Docs - nightly toolchain
137-
needs: Prepare
39+
Check:
40+
name: Check - ${{ matrix.task }}
13841
runs-on: ubuntu-latest
13942
strategy:
14043
fail-fast: false
14144
matrix:
142-
dep: [recent]
45+
task: [lint, docs, docsrs]
14346
steps:
14447
- name: "Checkout repo"
14548
uses: actions/checkout@v4
146-
- name: "Checkout maintainer tools"
147-
uses: ./.github/actions/checkout-maintainer-tools
148-
- name: "Select toolchain"
149-
uses: dtolnay/rust-toolchain@v1
150-
with:
151-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
152-
- name: "Run test script"
153-
run: ./maintainer-tools/ci/run_task.sh docsrs
49+
- name: "Setup cargo-rbmt"
50+
uses: ./.github/actions/setup-rbmt
51+
- name: "Run ${{ matrix.task }}"
52+
run: cargo rbmt --lock-file existing ${{ matrix.task }}
15453

15554
Format:
156-
name: Format - nightly toolchain
157-
needs: Prepare
55+
name: Format
15856
runs-on: ubuntu-latest
15957
strategy:
16058
fail-fast: false
16159
steps:
16260
- name: "Checkout repo"
16361
uses: actions/checkout@v4
164-
- name: "Select toolchain"
165-
uses: dtolnay/rust-toolchain@v1
166-
with:
167-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
168-
- name: "Install rustfmt"
169-
run: rustup component add rustfmt
62+
- name: "Setup cargo-rbmt"
63+
uses: ./.github/actions/setup-rbmt
17064
- name: "Check formatting"
171-
run: cargo fmt --all -- --check
65+
run: cargo rbmt fmt --check
17266

17367
Wasm:
17468
name: Check WASM
@@ -185,31 +79,30 @@ jobs:
18579

18680
Fuzz:
18781
name: Check Fuzz
188-
needs: Prepare
18982
runs-on: ubuntu-latest
19083
strategy:
19184
fail-fast: false
19285
steps:
19386
- name: "Checkout repo"
19487
uses: actions/checkout@v4
19588

196-
- name: "Select nightly toolchain"
197-
uses: dtolnay/rust-toolchain@v1
198-
with:
199-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
89+
- name: "Setup cargo-rbmt"
90+
uses: ./.github/actions/setup-rbmt
91+
92+
- name: "Install cargo-fuzz"
93+
run: cargo rbmt tools cargo-fuzz
20094

20195
- name: "Check fuzz crate"
202-
run: |
203-
cargo check --manifest-path=fuzz/Cargo.toml
96+
run: cargo rbmt --lock-file existing run --toolchain nightly -- check --manifest-path fuzz/Cargo.toml
20497

205-
- name: "Install cargo-fuzz"
206-
run: |
207-
cargo install cargo-fuzz --locked
98+
- name: "Run fuzz target unit tests"
99+
run: cargo rbmt --lock-file existing run --toolchain nightly -- test --manifest-path fuzz/Cargo.toml --bins
208100

209-
- name: "Run cargo-fuzz"
101+
- name: "Run cargo-fuzz smoke tests"
210102
run: |
211103
set -euo pipefail
104+
export RUSTUP_TOOLCHAIN="$(cargo rbmt toolchains --nightly)"
212105
cargo fuzz list --fuzz-dir fuzz | while read -r target; do
213-
echo "fuzzing $target"
214-
cargo fuzz run --fuzz-dir fuzz "$target" -- -runs=1
215-
done
106+
echo "fuzzing $target"
107+
cargo fuzz run --fuzz-dir fuzz "$target" -- -runs=1
108+
done

nightly-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)