Skip to content

Commit 50ae514

Browse files
committed
ci: clean up github actions & add build checks for phoenix
Abstract testing & linting code out to a separate file to reduce code duplication with the phoenix build workflow. Additionally add cargo deny checks.
1 parent 7b34ab5 commit 50ae514

3 files changed

Lines changed: 110 additions & 50 deletions

File tree

.github/workflows/argus-build.yml

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,19 @@ on:
44
branches: [main]
55
pull_request:
66
paths:
7-
- ".github/workflows/argus/**"
87
- "boards/argus/**"
98
- "common/**" # because argus has some dependencies on common
109
workflow_dispatch:
1110
name: Build Verification
1211

1312
jobs:
14-
lint:
15-
name: Check for Formatting/Linting/Semantic Issues
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v2
20-
21-
- name: Setup Rust Environment (Cached)
22-
uses: ./.github/actions/common/setup-rust-environment/
23-
24-
- name: Install Formatting Dependencies
25-
run: |
26-
cargo install cargo-sort
27-
rustup component add rustfmt clippy
28-
working-directory: boards/argus
29-
30-
- name: Check Formatting
31-
run: cargo fmt -- --check
32-
working-directory: boards/argus
33-
34-
- name: Check Cargo.toml Sorting
35-
run: cargo sort --check
36-
working-directory: boards/argus
37-
38-
- name: Check for Clippy Warnings
39-
run: cargo clippy -p argus --features temperature --no-deps
40-
working-directory: boards/argus
13+
checks:
14+
uses: ./.github/workflows/build.yml
15+
with:
16+
crate-name: argus
17+
crate-path: boards/argus
18+
# TODO: Checks for the other types of board (might benefit from use of matrices)
19+
default-features: temperature
4120

4221
build_pressure:
4322
name: Build with Pressure Feature
@@ -48,9 +27,9 @@ jobs:
4827

4928
- name: Setup Rust Environment (Cached)
5029
uses: ./.github/actions/common/setup-rust-environment/
51-
# TODO: --target thumbv7em-none-eabihf should not be needed as it should be using workspace target. Look into
30+
5231
- name: "Build with Pressure Feature"
53-
run: cargo build --release --features pressure --target thumbv7em-none-eabihf
32+
run: cargo build --release --features pressure
5433
working-directory: boards/argus
5534

5635
build_temperature:
@@ -64,7 +43,7 @@ jobs:
6443
uses: ./.github/actions/common/setup-rust-environment/
6544

6645
- name: "Build with Temperature Feature"
67-
run: cargo build --release --features temperature --target thumbv7em-none-eabihf
46+
run: cargo build --release --features temperature
6847
working-directory: boards/argus
6948

7049
build_strain:
@@ -78,23 +57,5 @@ jobs:
7857
uses: ./.github/actions/common/setup-rust-environment/
7958

8059
- name: "Build with Strain Feature"
81-
run: cargo build --release --features strain --target thumbv7em-none-eabihf
60+
run: cargo build --release --features strain
8261
working-directory: boards/argus
83-
84-
test:
85-
name: Run Host Tests
86-
runs-on: ubuntu-latest
87-
env:
88-
RUST_MIN_STACK: 8388608
89-
steps:
90-
- name: Checkout
91-
uses: actions/checkout@v2
92-
93-
- name: Setup Rust Environment (Cached)
94-
uses: ./.github/actions/common/setup-rust-environment/
95-
96-
- uses: actions-rs/cargo@v1
97-
name: "Run Host Tests"
98-
with:
99-
command: make
100-
args: test-host

.github/workflows/build.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
crate-name:
5+
required: true
6+
type: string
7+
crate-path:
8+
required: true
9+
type: string
10+
default-features:
11+
required: false
12+
type: string
13+
14+
jobs:
15+
lint:
16+
name: Check for Formatting/Linting/Semantic Issues
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Setup Rust Environment (Cached)
23+
uses: ./.github/actions/common/setup-rust-environment/
24+
25+
- name: Install Formatting Dependencies
26+
run: |
27+
cargo install cargo-sort cargo-deny
28+
rustup component add rustfmt clippy
29+
working-directory: $crate-path
30+
31+
- name: Check Formatting
32+
run: cargo fmt -- --check
33+
working-directory: $crate-path
34+
35+
- name: Check Cargo.toml Sorting
36+
run: cargo sort --check
37+
working-directory: $crate-path
38+
39+
- name: Check for Clippy Warnings
40+
run: cargo clippy -p $crate-name --features $default-features --no-deps
41+
working-directory: $crate-path
42+
43+
- name: Check for Crate Duplication
44+
run: cargo deny check bans
45+
working-directory: $crate-path
46+
47+
- name: Check for Advisories
48+
run: cargo deny check advisories
49+
working-directory: $crate-path
50+
51+
test:
52+
name: Run Host Tests
53+
runs-on: ubuntu-latest
54+
env:
55+
# NOTE: Unsure why this is here
56+
RUST_MIN_STACK: 8388608
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v2
60+
61+
- name: Setup Rust Environment (Cached)
62+
uses: ./.github/actions/common/setup-rust-environment/
63+
64+
name: "Run Host Tests"
65+
- uses: actions-rs/cargo@v1
66+
with:
67+
command: make
68+
args: test-host
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
push:
3+
branches: [main]
4+
pull_request:
5+
paths:
6+
- "boards/phoenix/**"
7+
- "common/**" # because phoenix has some dependencies on common
8+
workflow_dispatch:
9+
name: Build Verification
10+
11+
jobs:
12+
checks:
13+
uses: ./.github/workflow/build.yml
14+
with:
15+
crate-name: phoenix
16+
crate-path: boards/phoenix
17+
default-features: music
18+
19+
build:
20+
name: Build Phoenix (All Features)
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Setup Rust Environment (Cached)
27+
uses: ./.github/actions/common/setup-rust-environment/
28+
29+
- name: Build
30+
run: cargo build --release --features pressure
31+
working-directory: boards/phoenix

0 commit comments

Comments
 (0)