Skip to content

Commit f33d2b0

Browse files
committed
Merge #87: Fix recent "alloc" feature fail
7873c85 Rework GitHub actions (Tobin C. Harding) 433699f Enable alloc feature in with-allocator (Tobin C. Harding) Pull request description: Recently in #71 I introduced a bucket load of bugs, in CI and in the `with-allocator` crate (which was not being run correctly in CI). - Patch 1 enables the "alloc" feature in the `with-allocator` crate. - Patch 2 totally overhauls the github actions ACKs for top commit: apoelstra: ACK 7873c85 Tree-SHA512: ab8fbfd2dab315338c510b8622317d343186e62b78f5237ce8b4aceefc10963372c6238a114e244d03e0fe8fad2d4362c310be137c2af4ea057fb7020b46edf3
2 parents e26863a + 7873c85 commit f33d2b0

File tree

3 files changed

+83
-65
lines changed

3 files changed

+83
-65
lines changed

.github/workflows/rust.yml

+57-63
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,79 @@
1-
on: [pull_request]
1+
on: [push, pull_request]
22

33
name: Continuous Integration
44

55
jobs:
6-
Test:
7-
name: Test Suite
6+
Stable:
7+
name: Test - stable toolchain
88
runs-on: ubuntu-latest
99
strategy:
10-
matrix:
11-
rust:
12-
- 1.41.1
13-
- stable
14-
- nightly
10+
fail-fast: false
1511
steps:
1612
- name: Checkout Crate
17-
- uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1814
- name: Checkout Toolchain
19-
- uses: actions-rs/toolchain@v1
20-
with:
21-
profile: minimal
22-
toolchain: ${{ matrix.rust }}
23-
override: true
24-
- name: Run Test Script
25-
env: ${{ matrix.rust }}
15+
# https://github.com/dtolnay/rust-toolchain
16+
uses: dtolnay/rust-toolchain@stable
17+
- name: Running test script
18+
env:
19+
DO_LINT: true
2620
run: ./contrib/test.sh
2721

28-
fmt:
29-
name: Rustfmt
22+
Beta:
23+
name: Test - beta toolchain
3024
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
3127
steps:
32-
- uses: actions/checkout@v2
33-
- uses: actions-rs/toolchain@v1
34-
with:
35-
profile: minimal
36-
toolchain: nightly
37-
override: true
38-
- run: rustup component add rustfmt
39-
- uses: actions-rs/cargo@v1
40-
with:
41-
command: fmt
42-
args: --all -- --check
28+
- name: Checkout Crate
29+
uses: actions/checkout@v3
30+
- name: Checkout Toolchain
31+
uses: dtolnay/rust-toolchain@beta
32+
- name: Running test script
33+
run: ./contrib/test.sh
4334

44-
clippy:
45-
name: Clippy
35+
Nightly:
36+
name: Test - nightly toolchain
4637
runs-on: ubuntu-latest
4738
strategy:
48-
matrix:
49-
rust:
50-
- stable
39+
fail-fast: false
5140
steps:
52-
- uses: actions/checkout@v2
53-
- uses: actions-rs/toolchain@v1
54-
with:
55-
profile: minimal
56-
toolchain: ${{ matrix.rust }}
57-
override: true
58-
- run: rustup component add clippy
59-
- uses: actions-rs/cargo@v1
60-
with:
61-
command: clippy
62-
args: -- -D warnings
41+
- name: Checkout Crate
42+
uses: actions/checkout@v3
43+
- name: Checkout Toolchain
44+
uses: dtolnay/rust-toolchain@nightly
45+
- name: Running test script
46+
env:
47+
DO_FMT: true
48+
run: ./contrib/test.sh
49+
50+
MSRV:
51+
name: Test - 1.41.1 toolchain
52+
runs-on: ubuntu-latest
53+
strategy:
54+
fail-fast: false
55+
steps:
56+
- name: Checkout Crate
57+
uses: actions/checkout@v3
58+
- name: Checkout Toolchain
59+
uses: dtolnay/[email protected]
60+
- name: Running test script
61+
run: ./contrib/test.sh
6362

6463
EmbeddedWithAlloc:
6564
name: no_std with alloc
6665
runs-on: ubuntu-latest
66+
strategy:
67+
fail-fast: false
6768
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v2
69+
- name: Checkout Crate
70+
uses: actions/checkout@v3
7071
- name: Set up QEMU
7172
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
7273
- name: Checkout Toolchain
73-
uses: actions-rs/toolchain@v1
74+
uses: dtolnay/rust-toolchain@nightly
7475
with:
75-
profile: minimal
76-
toolchain: nightly
77-
override: true
78-
components: rust-src
79-
target: thumbv7m-none-eabi
76+
targets: thumbv7m-none-eabi
8077
- name: Run
8178
env:
8279
RUSTFLAGS: "-C link-arg=-Tlink.x"
@@ -87,14 +84,11 @@ jobs:
8784
name: no_std no alloc
8885
runs-on: ubuntu-latest
8986
strategy:
87+
fail-fast: false
9088
steps:
91-
- uses: actions/checkout@v2
92-
- uses: actions-rs/toolchain@v1
93-
with:
94-
profile: minimal
95-
toolchain: stable
96-
override: true
97-
- uses: actions-rs/cargo@v1
98-
with:
99-
command: rustc
100-
args: -- -C link-arg=-nostartfiles
89+
- name: Checkout Crate
90+
uses: actions/checkout@v3
91+
- name: Checkout Toolchain
92+
uses: dtolnay/rust-toolchain@stable
93+
- name: Run
94+
run: cd embedded/no-allocator && cargo rustc -- -C link-arg=-nostartfiles

contrib/test.sh

+25-1
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,39 @@
66

77
set -ex
88

9+
FEATURES="std alloc"
10+
11+
# Some tests require certain toolchain types.
12+
NIGHTLY=false
13+
if cargo --version | grep nightly; then
14+
NIGHTLY=true
15+
fi
16+
917
# Sanity, check tools exist.
1018
cargo --version
1119
rustc --version
1220

21+
# Run the linter if told to.
22+
if [ "$DO_LINT" = true ]
23+
then
24+
cargo clippy --all-features --all-targets -- -D warnings
25+
fi
26+
27+
# Run formatter if told to.
28+
if [ "$DO_FMT" = true ]; then
29+
if [ "$NIGHTLY" = false ]; then
30+
echo "DO_FMT requires a nightly toolchain (consider using RUSTUP_TOOLCHAIN)"
31+
exit 1
32+
fi
33+
rustup component add rustfmt
34+
cargo fmt --check
35+
fi
36+
1337
# Check without features ("strict" is a CI feature only, see above).
1438
cargo build --no-default-features --features="strict"
1539
cargo test --no-default-features --features="strict"
1640

17-
# Check "std" feature (implies "alloc").
41+
# Check "std" feature (implies "alloc", so this is equivalent to --all-features).
1842
cargo build --no-default-features --features="strict std"
1943
cargo test --no-default-features --features="strict std"
2044

embedded/with-allocator/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cortex-m-rt = "0.6.10"
1111
cortex-m-semihosting = "0.3.3"
1212
panic-halt = "0.2.0"
1313
alloc-cortex-m = "0.4.1"
14-
bech32 = { path="../../", default-features = false }
14+
bech32 = { path="../../", default-features = false, features = ["alloc"] }
1515

1616
[[bin]]
1717
name = "with-allocator"

0 commit comments

Comments
 (0)