Skip to content

Commit 2cd7837

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 c342a47 commit 2cd7837

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

.github/workflows/rust.yml

Lines changed: 6 additions & 9 deletions
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,20 +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 alloc
27-
- uses: actions-rs/cargo@v1
28-
with:
29-
command: test
30-
args: --verbose --no-default-features --features strict std
25+
- name: Run Test Script
26+
env: ${{ matrix.rust }}
27+
run: ./contrib/test.sh
3128

3229
fmt:
3330
name: Rustfmt

contrib/test.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
# Check without features ("strict" is a CI feature only, see above).
14+
cargo build --no-default-features --features="strict"
15+
cargo test --no-default-features --features="strict"
16+
17+
# Check "std" feature (implies "alloc").
18+
cargo build --no-default-features --features="strict std"
19+
cargo test --no-default-features --features="strict std"
20+
21+
# Check "alloc" feature alone.
22+
cargo build --no-default-features --features="strict alloc"
23+
cargo test --no-default-features --features="strict alloc"
24+
25+
exit 0

0 commit comments

Comments
 (0)