Skip to content

Commit 956903f

Browse files
committed
Improve CI pipeline
Improve the CI pipeline by doing: - Use new dtolnay runner - Run tests using beta toolchain also - Run formatter and linter from the CI script - stable: linter - nightly: formatter - Run docs build with stable/nightly as required - Add a feature matrix (not really needed now but we have an open PR that adds an additional feature) - Run 32 bit tests (default features with a 32 bit target) - Run cross tests (default features with a s390x target)
1 parent f529ba8 commit 956903f

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

Diff for: .github/workflows/rust.yml

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on: [push, pull_request]
22

3-
name: Continuous Integration
3+
name: Continuous integration
44

55
jobs:
66
Stable:
@@ -17,6 +17,8 @@ jobs:
1717
- name: Running test script
1818
env:
1919
DO_LINT: true
20+
DO_DOCS: true
21+
DO_FEATURE_MATRIX: true
2022
run: ./contrib/test.sh
2123

2224
Beta:
@@ -44,6 +46,7 @@ jobs:
4446
uses: dtolnay/rust-toolchain@nightly
4547
- name: Running test script
4648
env:
49+
DO_DOCSRS: true
4750
DO_FMT: true
4851
run: ./contrib/test.sh
4952

@@ -58,6 +61,8 @@ jobs:
5861
- name: Checkout Toolchain
5962
uses: dtolnay/[email protected]
6063
- name: Running test script
64+
env:
65+
DO_FEATURE_MATRIX: true
6166
run: ./contrib/test.sh
6267

6368
EmbeddedWithAlloc:
@@ -92,3 +97,36 @@ jobs:
9297
uses: dtolnay/rust-toolchain@stable
9398
- name: Run
9499
run: cd embedded/no-allocator && cargo rustc -- -C link-arg=-nostartfiles
100+
101+
Arch32bit:
102+
name: Test 32-bit version
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Checkout Crate
106+
uses: actions/checkout@v3
107+
- name: Checkout Toolchain
108+
uses: dtolnay/rust-toolchain@stable
109+
- name: Add architecture i386
110+
run: sudo dpkg --add-architecture i386
111+
- name: Install i686 gcc
112+
run: sudo apt-get update -y && sudo apt-get install -y gcc-multilib
113+
- name: Install target
114+
run: rustup target add i686-unknown-linux-gnu
115+
- name: Run tests on i686
116+
run: cargo test --target i686-unknown-linux-gnu
117+
118+
Cross:
119+
name: Cross test
120+
if: ${{ !github.event.act }}
121+
runs-on: ubuntu-latest
122+
steps:
123+
- name: Checkout Crate
124+
uses: actions/checkout@v3
125+
- name: Checkout Toolchain
126+
uses: dtolnay/rust-toolchain@stable
127+
- name: Install target
128+
run: rustup target add s390x-unknown-linux-gnu
129+
- name: install cross
130+
run: cargo install cross --locked
131+
- name: run cross test
132+
run: cross test --target s390x-unknown-linux-gnu

Diff for: contrib/test.sh

+15
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ if [ "$DO_FMT" = true ]; then
3232
cargo fmt --check
3333
fi
3434

35+
if [ "$DO_FEATURE_MATRIX" = true ]; then
36+
cargo build --no-default-features
37+
cargo test --no-default-features
38+
39+
# All features
40+
cargo build --no-default-features --features="$FEATURES"
41+
cargo test --no-default-features --features="$FEATURES"
42+
# Single features
43+
for feature in ${FEATURES}
44+
do
45+
cargo build --no-default-features --features="$feature"
46+
cargo test --no-default-features --features="$feature"
47+
done
48+
fi
49+
3550
# Build the docs if told to (this only works with the nightly toolchain)
3651
if [ "$DO_DOCSRS" = true ]; then
3752
RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +nightly doc --all-features

0 commit comments

Comments
 (0)