Skip to content

Commit 0cfd2a5

Browse files
ci: leverage rust-toolchain.toml file in ci workflows
1 parent aa6bea0 commit 0cfd2a5

File tree

2 files changed

+50
-48
lines changed

2 files changed

+50
-48
lines changed

.github/workflows/cont_integration.yml

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,81 @@ env:
88
CARGO_TERM_COLOR: always
99

1010
jobs:
11-
prepare:
12-
runs-on: ubuntu-latest
13-
outputs:
14-
rust_version: ${{ steps.read_toolchain.outputs.rust_version }}
11+
build-test-msrv:
12+
name: Build & Test MSRV
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os:
17+
- ubuntu-latest
18+
- ubuntu-24.04-arm
19+
features:
20+
- --no-default-features --features miniscript/no-std,bdk_chain/hashbrown
21+
- --all-features
1522
steps:
16-
- name: "Checkout repo"
23+
- name: Checkout
1724
uses: actions/checkout@v4
1825
with:
1926
persist-credentials: false
20-
- name: "Read rust version"
21-
id: read_toolchain
22-
run: echo "rust_version=$(cat rust-version)" >> $GITHUB_OUTPUT
27+
# The 'toolchain' argument on this action overrides the Rust compiler version set in rust-toolchain.toml
28+
# in order to test our MSRV.
29+
- name: Install Rust toolchain
30+
uses: actions-rust-lang/setup-rust-toolchain@v1
31+
with:
32+
toolchain: 1.85 # MSRV
33+
cache: true
34+
- name: Pin dependencies for MSRV
35+
run: ./ci/pin-msrv.sh
36+
- name: Build + Test
37+
run: |
38+
cargo build --workspace --all-targets ${{ matrix.features }}
39+
cargo test --workspace ${{ matrix.features }}
2340
24-
build-test:
25-
needs: prepare
26-
name: Build & Test
41+
build-test-stable:
42+
name: Build & Test Rust Stable
2743
runs-on: ${{ matrix.os }}
2844
strategy:
2945
matrix:
3046
os:
3147
- ubuntu-latest
3248
- ubuntu-24.04-arm
33-
rust:
34-
- version: ${{ needs.prepare.outputs.rust_version }}
35-
- version: 1.85.0 # MSRV
3649
features:
3750
- --no-default-features --features miniscript/no-std,bdk_chain/hashbrown
3851
- --all-features
3952
steps:
40-
- name: checkout
53+
- name: Checkout
4154
uses: actions/checkout@v4
4255
with:
4356
persist-credentials: false
57+
# This action will honor the Rust compiler version set in rust-toolchain.toml. We aim to keep it in sync with
58+
# Rust stable.
4459
- name: Install Rust toolchain
45-
uses: dtolnay/rust-toolchain@v1
60+
uses: actions-rust-lang/setup-rust-toolchain@v1
4661
with:
47-
toolchain: ${{ matrix.rust.version }}
48-
- name: Rust Cache
49-
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0
50-
- name: Pin dependencies for MSRV
51-
if: matrix.rust.version == '1.85.0'
52-
run: ./ci/pin-msrv.sh
62+
cache: true
5363
- name: Build + Test
54-
env:
55-
MATRIX_RUST_VERSION: ${{ matrix.rust.version }}
5664
run: |
5765
cargo build --workspace --all-targets ${{ matrix.features }}
5866
cargo test --workspace ${{ matrix.features }}
5967
6068
check-no-std:
61-
needs: prepare
6269
name: Check no_std
6370
runs-on: ubuntu-latest
6471
steps:
6572
- name: Checkout
6673
uses: actions/checkout@v4
6774
with:
6875
persist-credentials: false
76+
# This action automatically reads and applies rust-toolchain.toml
6977
- name: Install Rust toolchain
70-
uses: dtolnay/rust-toolchain@v1
78+
uses: actions-rust-lang/setup-rust-toolchain@v1
7179
with:
72-
toolchain: ${{ needs.prepare.outputs.rust_version }}
73-
# target: "thumbv6m-none-eabi"
74-
- name: Rust Cache
75-
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0
80+
cache: true
7681
- name: Check no-std
7782
# TODO "--target thumbv6m-none-eabi" should work but currently does not
7883
run: cargo check --no-default-features --features miniscript/no-std,bdk_chain/hashbrown
7984

8085
check-wasm:
81-
needs: prepare
8286
name: Check WASM
8387
runs-on: ubuntu-latest
8488
env:
@@ -93,15 +97,15 @@ jobs:
9397
- run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1
9498
- run: sudo apt-get update || exit 1
9599
- run: sudo apt-get install -y libclang-common-14-dev clang-14 libc6-dev-i386 || exit 1
100+
# This action automatically reads and applies rust-toolchain.toml
96101
- name: Install Rust toolchain
97-
uses: dtolnay/rust-toolchain@v1
102+
uses: actions-rust-lang/setup-rust-toolchain@v1
98103
with:
99-
toolchain: ${{ needs.prepare.outputs.rust_version }}
100-
targets: "wasm32-unknown-unknown"
101-
- name: Rust Cache
102-
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0
104+
cache: true
103105
- name: Check WASM
104-
run: cargo check --target wasm32-unknown-unknown --no-default-features --features miniscript/no-std,bdk_chain/hashbrown
106+
run: |
107+
rustup target add wasm32-unknown-unknown
108+
cargo check --target wasm32-unknown-unknown --no-default-features --features miniscript/no-std,bdk_chain/hashbrown
105109
106110
fmt:
107111
name: Rust fmt
@@ -111,30 +115,29 @@ jobs:
111115
uses: actions/checkout@v4
112116
with:
113117
persist-credentials: false
118+
# This action automatically reads and applies rust-toolchain.toml
114119
- name: Install Rust toolchain
115-
uses: dtolnay/rust-toolchain@v1
120+
uses: actions-rust-lang/setup-rust-toolchain@v1
116121
with:
117-
toolchain: nightly
118-
components: rustfmt
122+
cache: true
119123
- name: Check fmt
120124
run: cargo fmt --all --check
121125

122126
clippy_check:
123-
needs: prepare
124127
name: Rust clippy
125128
runs-on: ubuntu-latest
126129
permissions:
127130
checks: write
128131
steps:
129-
- uses: actions/checkout@v4
132+
- name: Checkout
133+
uses: actions/checkout@v4
130134
with:
131135
persist-credentials: false
132-
- uses: dtolnay/rust-toolchain@v1
136+
# This action automatically reads and applies rust-toolchain.toml
137+
- name: Install Rust toolchain
138+
uses: actions-rust-lang/setup-rust-toolchain@v1
133139
with:
134-
toolchain: ${{ needs.prepare.outputs.rust_version }}
135-
components: clippy
136-
- name: Rust Cache
137-
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0
140+
cache: true
138141
- name: Clippy
139142
run: cargo clippy --all-features --all-targets -- -D warnings
140143

rust-version

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

0 commit comments

Comments
 (0)