Skip to content

Commit 1a83c40

Browse files
committed
CI: Test MSRV
There are multiple MSRVs in this crate because of the `bitcoin_hashes` dependency and also the `zeroize` feature. Add MSRV test jobs for the three MSRVs effected by `bitcoin_hashes` and also one for the `zeroize` feature.
1 parent e30b544 commit 1a83c40

File tree

4 files changed

+68
-11
lines changed

4 files changed

+68
-11
lines changed

.github/workflows/.#rust.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tobin@pantera.283300:1761534469

.github/workflows/rust.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
DO_NO_STD: true
5151
run: ./contrib/test.sh
5252

53-
MSRV:
53+
MSRV-1-41:
5454
name: Test - 1.41.1 toolchain
5555
runs-on: ubuntu-latest
5656
strategy:
@@ -66,6 +66,54 @@ jobs:
6666
DO_FEATURE_MATRIX: true
6767
run: ./contrib/test.sh
6868

69+
MSRV-1-48:
70+
name: Test - 1.48.0 toolchain
71+
runs-on: ubuntu-latest
72+
strategy:
73+
fail-fast: false
74+
steps:
75+
- name: Checkout Crate
76+
uses: actions/checkout@v3
77+
- name: Checkout Toolchain
78+
uses: dtolnay/[email protected]
79+
- name: Running test script
80+
env:
81+
DO_NO_STD: true
82+
DO_FEATURE_MATRIX: true
83+
run: ./contrib/test.sh
84+
85+
MSRV-1-51:
86+
name: Test - 1.51.0 toolchain
87+
runs-on: ubuntu-latest
88+
strategy:
89+
fail-fast: false
90+
steps:
91+
- name: Checkout Crate
92+
uses: actions/checkout@v3
93+
- name: Checkout Toolchain
94+
uses: dtolnay/[email protected]
95+
- name: Running test script
96+
env:
97+
DO_NO_STD: true
98+
DO_FEATURE_MATRIX: true
99+
run: ./contrib/test.sh
100+
101+
MSRV-1-56:
102+
name: Test - 1.56.0 toolchain
103+
runs-on: ubuntu-latest
104+
strategy:
105+
fail-fast: false
106+
steps:
107+
- name: Checkout Crate
108+
uses: actions/checkout@v3
109+
- name: Checkout Toolchain
110+
uses: dtolnay/[email protected]
111+
- name: Running test script
112+
env:
113+
DO_NO_STD: true
114+
DO_FEATURE_MATRIX: true
115+
run: ./contrib/test.sh
116+
69117
Arch32bit:
70118
name: Test 32-bit version
71119
runs-on: ubuntu-latest

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ This crate supports Rust v1.41.1 and up and works with `no_std`.
3333

3434
The `bitcoin_hashes` range dependency effects the MSRV as follows
3535

36-
- `bitcoin_hashes v0.12`: MSRV v1.41.1
37-
- `bitcoin_hashes v0.13`: MSRV v1.48.0
38-
- `bitcoin_hashes v0.14`: MSRV v1.56.1
36+
- `bitcoin_hashes v0.12`: MSRV `v1.41.1`
37+
- `bitcoin_hashes v0.13`: MSRV `v1.48.0`
38+
- `bitcoin_hashes v0.14`: MSRV `v1.56.1`
3939

4040
When using older version of Rust, you might have to pin the versions of several crates, for an up-to-date list refer to [`contrib/test.sh`](contrib/test.sh):
4141

@@ -47,4 +47,4 @@ cargo update --package "tinyvec" --precise "1.6.0"
4747
cargo update --package "unicode-normalization" --precise "0.1.22"
4848
```
4949

50-
If you enable the `zeroize` feature the MSRV becomes 1.51.
50+
If you enable the `zeroize` feature the MSRV becomes `v1.51.0`.

contrib/test.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,31 @@
33
set -ex
44

55
FEATURES="serde rand all-languages chinese-simplified chinese-traditional czech french italian japanese korean portuguese spanish"
6+
RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
67

78
cargo --version
89
rustc --version
910

10-
# Pin dependencies as required if we are using MSRV toolchain.
11-
if cargo --version | grep "1\.41"; then
12-
cp Cargo-minimal.lock Cargo.lock
13-
cargo check --locked
14-
rm Cargo.lock
11+
[ "$RUSTC_MINOR_VERSION" -lt 82 ] && cargo update -p backtrace --precise "0.3.74" --verbose
1512

13+
# Check the minimal lock file for all toolchains we test.
14+
cp Cargo-minimal.lock Cargo.lock
15+
cargo check --locked
16+
rm Cargo.lock
17+
18+
# The crate's lowest MSRV (not lifted by `bitcoin_hashes` dep or `zeroize` feature).
19+
if [ "$RUSTC_MINOR_VERSION" -eq 41 ]; then
1620
cargo update --package "bitcoin_hashes" --precise "0.12.0"
1721
cargo update --package "rand" --precise "0.6.0"
1822
cargo update --package "libc" --precise "0.2.151"
1923
cargo update --package "tinyvec" --precise "1.6.0"
2024
cargo update --package "unicode-normalization" --precise "0.1.22"
2125
fi
2226

27+
# `bitcoin_hashes` version raises the crate MSRV, we test with these toolchains explicitly in CI.
28+
[ "$RUSTC_MINOR_VERSION" -eq 48 ] && cargo update --package "bitcoin_hashes" --precise "0.13.0"
29+
[ "$RUSTC_MINOR_VERSION" -eq 56 ] && cargo update --package "bitcoin_hashes" --precise "0.14.0"
30+
2331
echo "********* Testing std *************"
2432
# Test without any features other than std first
2533
cargo test --verbose --no-default-features --features="std"
@@ -34,7 +42,7 @@ do
3442
cargo build --verbose --features="$feature" --no-default-features
3543
done
3644

37-
if cargo --version | grep -v "1\.41"; then
45+
if [ "$RUSTC_MINOR_VERSION" -ge 51 ]; then
3846
cargo build --verbose --features="zeroize" --no-default-features
3947
fi
4048

0 commit comments

Comments
 (0)