Skip to content

Commit d7b8c8b

Browse files
committed
CI: Use new cargo rmbt tool
Use Nicks mad new tool to run CI. To do this I copied what is in `rust-psbt`, guessed at what `bench` should be, and used the latest commit hash from `rust-bitcoin-maintainer-tools` repo.
1 parent 4ad053b commit d7b8c8b

File tree

3 files changed

+85
-159
lines changed

3 files changed

+85
-159
lines changed

.github/actions/prepare/action.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'Prepare Rust Environment'
2+
description: 'Setup Rust toolchain and install RBMT'
3+
inputs:
4+
toolchain:
5+
description: 'Rust toolchain to use (nightly reads from nightly-version file)'
6+
required: false
7+
default: 'stable'
8+
components:
9+
description: 'Rust components to install (e.g., clippy, rustfmt)'
10+
required: false
11+
default: ''
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: "Determine toolchain"
16+
id: toolchain
17+
shell: bash
18+
run: |
19+
if [ "${{ inputs.toolchain }}" = "nightly" ]; then
20+
TOOLCHAIN="$(cat nightly-version)"
21+
else
22+
TOOLCHAIN="${{ inputs.toolchain }}"
23+
fi
24+
echo "version=$TOOLCHAIN" >> $GITHUB_OUTPUT
25+
26+
- name: "Setup stable toolchain for RBMT"
27+
uses: actions-rust-lang/setup-rust-toolchain@v1
28+
with:
29+
toolchain: stable
30+
31+
- name: "Install RBMT"
32+
shell: bash
33+
run: cargo install --git https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git --rev "$(cat rbmt-version)" cargo-rbmt
34+
35+
- name: "Setup requested toolchain"
36+
uses: actions-rust-lang/setup-rust-toolchain@v1
37+
with:
38+
toolchain: ${{ steps.toolchain.outputs.version }}
39+
components: ${{ inputs.components }}

.github/workflows/rust.yml

Lines changed: 45 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ on: # yamllint disable-line rule:truthy
99
name: Continuous integration
1010

1111
jobs:
12-
Prepare:
13-
runs-on: ubuntu-24.04
14-
outputs:
15-
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
16-
steps:
17-
- name: "Checkout repo"
18-
uses: actions/checkout@v4
19-
- name: "Read nightly version"
20-
id: read_toolchain
21-
run: echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT
22-
2312
Stable: # 2 jobs, one per lock file.
2413
name: Test - stable toolchain
2514
runs-on: ubuntu-latest
@@ -29,45 +18,27 @@ jobs:
2918
dep: [minimal, recent]
3019
steps:
3120
- name: "Checkout repo"
32-
uses: actions/checkout@v4
33-
- name: "Checkout maintainer tools"
34-
uses: actions/checkout@v4
21+
uses: actions/checkout@v6
22+
- uses: ./.github/actions/prepare
3523
with:
36-
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
37-
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
38-
path: maintainer-tools
39-
- name: "Select toolchain"
40-
uses: dtolnay/rust-toolchain@stable
41-
- name: "Set dependencies"
42-
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
43-
- name: "Run test script"
44-
run: ./maintainer-tools/ci/run_task.sh stable
24+
toolchain: stable
25+
- name: "Run tests"
26+
run: cargo rbmt test stable --lock-file ${{ matrix.dep }}
4527

4628
Nightly: # 2 jobs, one per lock file.
4729
name: Test - nightly toolchain
48-
needs: Prepare
4930
runs-on: ubuntu-latest
5031
strategy:
5132
fail-fast: false
5233
matrix:
5334
dep: [minimal, recent]
5435
steps:
55-
- name: "Checkout repo"
56-
uses: actions/checkout@v4
57-
- name: "Checkout maintainer tools"
58-
uses: actions/checkout@v4
36+
- uses: actions/checkout@v6
37+
- uses: ./.github/actions/prepare
5938
with:
60-
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
61-
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
62-
path: maintainer-tools
63-
- name: "Select toolchain"
64-
uses: dtolnay/rust-toolchain@v1
65-
with:
66-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
67-
- name: "Set dependencies"
68-
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
69-
- name: "Run test script"
70-
run: ./maintainer-tools/ci/run_task.sh nightly
39+
toolchain: nightly
40+
- name: "Run tests"
41+
run: cargo rbmt test nightly --lock-file ${{ matrix.dep }}
7142

7243
MSRV: # 2 jobs, one per lock file.
7344
name: Test - 1.63.0 toolchain
@@ -77,183 +48,98 @@ jobs:
7748
matrix:
7849
dep: [minimal, recent]
7950
steps:
80-
- name: "Checkout repo"
81-
uses: actions/checkout@v4
82-
- name: "Checkout maintainer tools"
83-
uses: actions/checkout@v4
84-
with:
85-
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
86-
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
87-
path: maintainer-tools
51+
- uses: actions/checkout@v6
8852
- name: "Free disk space"
8953
uses: endersonmenezes/free-disk-space@v3
9054
with:
9155
remove_android: true
9256
remove_dotnet: true
9357
remove_haskell: true
94-
- name: "Select toolchain"
95-
uses: dtolnay/rust-toolchain@stable
58+
- uses: ./.github/actions/prepare
9659
with:
97-
toolchain: "1.63.0"
98-
- name: "Set dependencies"
99-
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
100-
- name: "Run test script"
101-
run: ./maintainer-tools/ci/run_task.sh msrv
60+
toolchain: "1.74.0"
61+
- name: "Run tests"
62+
run: cargo rbmt test msrv --lock-file ${{ matrix.dep }}
10263

10364
Lint:
10465
name: Lint - nightly toolchain
105-
needs: Prepare
10666
runs-on: ubuntu-latest
10767
strategy:
10868
fail-fast: false
10969
matrix:
11070
dep: [recent]
11171
steps:
112-
- name: "Checkout repo"
113-
uses: actions/checkout@v4
114-
- name: "Checkout maintainer tools"
115-
uses: actions/checkout@v4
116-
with:
117-
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
118-
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
119-
path: maintainer-tools
120-
- name: "Select toolchain"
121-
uses: dtolnay/rust-toolchain@v1
72+
- uses: actions/checkout@v6
73+
- uses: ./.github/actions/prepare
12274
with:
123-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
124-
- name: "Install clippy"
125-
run: rustup component add clippy
126-
- name: "Set dependencies"
127-
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
128-
- name: "Run test script"
129-
run: ./maintainer-tools/ci/run_task.sh lint
75+
toolchain: nightly
76+
components: clippy
77+
- name: "Run lint"
78+
run: cargo rbmt lint
13079

13180
Docs:
13281
name: Docs - stable toolchain
13382
runs-on: ubuntu-latest
13483
strategy:
13584
fail-fast: false
136-
matrix:
137-
dep: [recent]
13885
steps:
139-
- name: "Checkout repo"
140-
uses: actions/checkout@v4
141-
- name: "Checkout maintainer tools"
142-
uses: actions/checkout@v4
86+
- uses: actions/checkout@v6
87+
- uses: ./.github/actions/prepare
14388
with:
144-
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
145-
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
146-
path: maintainer-tools
147-
- name: "Select toolchain"
148-
uses: dtolnay/rust-toolchain@stable
149-
- name: "Set dependencies"
150-
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
151-
- name: "Run test script"
152-
run: ./maintainer-tools/ci/run_task.sh docs
89+
toolchain: stable
90+
- name: "Build docs"
91+
run: cargo rbmt docs
15392

15493
Docsrs:
15594
name: Docs - nightly toolchain
156-
needs: Prepare
15795
runs-on: ubuntu-latest
15896
strategy:
15997
fail-fast: false
160-
matrix:
161-
dep: [recent]
16298
steps:
163-
- name: "Checkout repo"
164-
uses: actions/checkout@v4
165-
- name: "Checkout maintainer tools"
166-
uses: actions/checkout@v4
167-
with:
168-
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
169-
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
170-
path: maintainer-tools
171-
- name: "Select toolchain"
172-
uses: dtolnay/rust-toolchain@v1
99+
- uses: actions/checkout@v6
100+
- uses: ./.github/actions/prepare
173101
with:
174-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
175-
- name: "Set dependencies"
176-
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
177-
- name: "Run test script"
178-
run: ./maintainer-tools/ci/run_task.sh docsrs
102+
toolchain: nightly
103+
- name: "Build docs.rs docs"
104+
run: cargo rbmt docsrs
179105

180106
Bench:
181107
name: Bench - nightly toolchain
182-
needs: Prepare
183108
runs-on: ubuntu-latest
184109
strategy:
185110
fail-fast: false
186-
matrix:
187-
dep: [recent]
188111
steps:
189-
- name: "Checkout repo"
190-
uses: actions/checkout@v4
191-
- name: "Checkout maintainer tools"
192-
uses: actions/checkout@v4
112+
- uses: actions/checkout@v6
113+
- uses: ./.github/actions/prepare
193114
with:
194-
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
195-
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
196-
path: maintainer-tools
197-
- name: "Select toolchain"
198-
uses: dtolnay/rust-toolchain@v1
199-
with:
200-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
201-
- name: "Set dependencies"
202-
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
203-
- name: "Run test script"
204-
run: ./maintainer-tools/ci/run_task.sh bench
115+
toolchain: nightly
116+
- name: "Run bench"
117+
run: cargo rbmt bench
205118

206119
Format: # 1 job, run cargo fmt directly.
207120
name: Format - nightly toolchain
208-
needs: Prepare
209121
runs-on: ubuntu-latest
210122
strategy:
211123
fail-fast: false
212124
steps:
213-
- name: "Checkout repo"
214-
uses: actions/checkout@v4
215-
- name: "Select toolchain"
216-
uses: dtolnay/rust-toolchain@v1
125+
- uses: actions/checkout@v6
126+
- uses: ./.github/actions/prepare
217127
with:
218-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
219-
- name: "Install rustfmt"
220-
run: rustup component add rustfmt
128+
toolchain: nightly
129+
components: rustfmt
221130
- name: "Check formatting"
222131
run: cargo fmt --all -- --check
223132

224133
Integration: # 1 job for each bitcoind version we support.
225134
name: Integration tests - stable toolchain
226135
runs-on: ubuntu-latest
227-
strategy:
228-
fail-fast: false
229-
matrix:
230-
feature:
231-
[
232-
"26_0",
233-
"25_2",
234-
"25_1",
235-
"25_0",
236-
"24_2",
237-
"24_1",
238-
"24_0_1",
239-
"23_2",
240-
"23_1",
241-
"23_0",
242-
"22_1",
243-
"22_0",
244-
"0_21_2",
245-
"0_20_2",
246-
"0_19_1",
247-
"0_18_1",
248-
"0_17_1",
249-
]
250136
steps:
251-
- name: "Checkout repo"
252-
uses: actions/checkout@v4
253-
- name: "Select toolchain"
254-
uses: dtolnay/rust-toolchain@stable
137+
- uses: actions/checkout@v6
138+
- uses: ./.github/actions/prepare
139+
with:
140+
toolchain: stable
255141
- name: "Run integration tests"
256-
run: cd bitcoind-tests && cargo test --features=${{ matrix.feature }}
142+
run: cargo rbmt integration
257143

258144
Embedded:
259145
runs-on: ubuntu-latest

rbmt-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bcff6290c9e3f5b4d7e832acb5a8c6bf890fd1ce

0 commit comments

Comments
 (0)