Skip to content

Commit 85caa28

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 1ceb828 commit 85caa28

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

.github/workflows/rust.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [pull_request]
33
name: Continuous Integration
44

55
jobs:
6-
test:
6+
Test:
77
name: Test Suite
88
runs-on: ubuntu-latest
99
strategy:
@@ -13,20 +13,17 @@ jobs:
1313
- stable
1414
- nightly
1515
steps:
16+
- name: Checkout Crate
1617
- uses: actions/checkout@v2
18+
- name: Checkout Toolchain
1719
- uses: actions-rs/toolchain@v1
1820
with:
1921
profile: minimal
2022
toolchain: ${{ matrix.rust }}
2123
override: true
22-
- uses: actions-rs/cargo@v1
23-
with:
24-
command: test
25-
args: --verbose --no-default-features --features strict alloc
26-
- uses: actions-rs/cargo@v1
27-
with:
28-
command: test
29-
args: --verbose --no-default-features --features strict std
24+
- name: Run Test Script
25+
env: ${{ matrix.rust }}
26+
run: ./contrib/test.sh
3027

3128
fmt:
3229
name: Rustfmt

contrib/test.sh

+25
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

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ extern crate core;
6767
use alloc::borrow::Cow;
6868
#[cfg(all(feature = "alloc", not(feature = "std")))]
6969
use alloc::{string::String, vec::Vec};
70-
use core::convert::TryFrom;
7170
#[cfg(feature = "alloc")]
7271
use core::convert::Infallible;
72+
use core::convert::TryFrom;
7373
use core::{fmt, mem};
7474
#[cfg(feature = "std")]
7575
use std::borrow::Cow;

0 commit comments

Comments
 (0)