Skip to content

Commit 89ce404

Browse files
committed
Add CI test.sh script
We now have two features that require testing in various combinations, add a `contrib/test.sh` script to do the testing and use it in the `Test` CI job. Add names to other steps in the job to improve clarity.
1 parent 0abde2f commit 89ce404

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

.github/workflows/rust.yml

+6-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [pull_request]
44
name: Continuous Integration
55

66
jobs:
7-
test:
7+
Test:
88
name: Test Suite
99
runs-on: ubuntu-latest
1010
strategy:
@@ -14,24 +14,17 @@ jobs:
1414
- stable
1515
- nightly
1616
steps:
17+
- name: Checkout Crate
1718
- uses: actions/checkout@v2
19+
- name: Checkout Toolchain
1820
- uses: actions-rs/toolchain@v1
1921
with:
2022
profile: minimal
2123
toolchain: ${{ matrix.rust }}
2224
override: true
23-
- uses: actions-rs/cargo@v1
24-
with:
25-
command: test
26-
args: --verbose --no-default-features --features strict
27-
- uses: actions-rs/cargo@v1
28-
with:
29-
command: test
30-
args: --verbose --no-default-features --features strict std
31-
- uses: actions-rs/cargo@v1
32-
with:
33-
command: test
34-
args: --verbose --no-default-features --features strict alloc
25+
- name: Run Test Script
26+
env: ${{ matrix.rust }}
27+
run: ./contrib/test.sh
3528

3629
fmt:
3730
name: Rustfmt

contrib/test.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
#
3+
# CI test script for rust-bech32.
4+
#
5+
# The "strict" feature is used to configure cargo to deny all warnings, always use it in test runs.
6+
7+
set -ex
8+
9+
# Sanity, check tools exist.
10+
cargo --version
11+
rustc --version
12+
13+
# Sanity, first check with default features.
14+
15+
cargo build
16+
cargo test
17+
18+
# Check with no features.
19+
20+
cargo build --no-default-features --features="strict"
21+
cargo test --no-default-features --features="strict"
22+
23+
# Check each feature individually.
24+
25+
cargo build --no-default-features --features="strict std"
26+
cargo test --no-default-features --features="strict std"
27+
28+
cargo build --no-default-features --features="strict alloc"
29+
cargo test --no-default-features --features="strict alloc"
30+
31+
# Check all the features together.
32+
33+
cargo build --no-default-features --features="strict alloc std"
34+
cargo test --no-default-features --features="strict alloc std"
35+
36+
exit 0
37+

0 commit comments

Comments
 (0)