Skip to content

Commit

Permalink
Add CI test.sh script
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tcharding committed Aug 25, 2022
1 parent d938b91 commit e15eb28
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]
name: Continuous Integration

jobs:
test:
Test:
name: Test Suite
runs-on: ubuntu-latest
strategy:
Expand All @@ -14,20 +14,17 @@ jobs:
- stable
- nightly
steps:
- name: Checkout Crate
- uses: actions/checkout@v2
- name: Checkout Toolchain
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-default-features --features strict alloc
- uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-default-features --features strict std
- name: Run Test Script
env: ${{ matrix.rust }}
run: ./contrib/test.sh

fmt:
name: Rustfmt
Expand Down
32 changes: 32 additions & 0 deletions contrib/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh
#
# CI test script for rust-bech32.
#
# The "strict" feature is used to configure cargo to deny all warnings, always use it in test runs.

set -ex

# Sanity, check tools exist.
cargo --version
rustc --version

# Sanity, first check with default features.

cargo build
cargo test

# Sanity, build with no features.

cargo build --no-default-features --features="strict"

# Check "alloc" feature alone.

cargo build --no-default-features --features="strict std"
cargo test --no-default-features --features="strict std"

# Check "std" feature (implies "alloc").

cargo build --no-default-features --features="strict alloc"
cargo test --no-default-features --features="strict alloc"

exit 0

0 comments on commit e15eb28

Please sign in to comment.