Skip to content

Commit 04b71a7

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 27ff574 commit 04b71a7

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

Diff for: .github/workflows/rust.yml

+6-9
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

Diff for: contrib/test.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
# Sanity, build with no features.
19+
20+
cargo build --no-default-features --features="strict"
21+
22+
# Check "alloc" feature alone.
23+
24+
cargo build --no-default-features --features="strict std"
25+
cargo test --no-default-features --features="strict std"
26+
27+
# Check "std" feature (implies "alloc").
28+
29+
cargo build --no-default-features --features="strict alloc"
30+
cargo test --no-default-features --features="strict alloc"
31+
32+
exit 0

0 commit comments

Comments
 (0)