Skip to content

Commit 66c58fb

Browse files
fix: more gh action cleanup
1 parent 9bd568e commit 66c58fb

2 files changed

Lines changed: 69 additions & 110 deletions

File tree

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,45 @@
1+
# A lot of these actions could have been a bash command but we're using predefined actions
2+
# to take advantage of caching and other features they provide. It runs faster with the vendor actions.
13
name: Setup Rust Environment
24
description: Install deps, ARM toolchain, and Rust toolchain
35
inputs:
4-
embedded:
5-
description: "Set to true to install the embedded development tools"
6-
required: false
7-
default: "true"
86
cargo-dependencies:
97
description: List of cargo dependencies to install (space separated)
108
runs:
119
using: composite
1210
steps:
13-
- name: Install Dependencies
11+
- name: Install APT Dependencies
1412
shell: bash
1513
run: |
1614
sudo apt update
1715
sudo apt install -y cmake protobuf-compiler
16+
1817
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
19-
shell: bash
20-
run: |
21-
sudo apt update
22-
sudo apt install -y gcc-arm-none-eabi binutils-arm-none-eabi
23-
- name: Install Rust toolchain
24-
shell: bash
25-
run: rustup install stable
26-
- name: Install Embedded Development Dependencies
27-
shell: bash
18+
uses: carlosperate/arm-none-eabi-gcc-action@v1
19+
with:
20+
release: "12.2.Rel1"
21+
22+
- name: Install Rust Toolchain for Embedded Development
23+
uses: actions-rs/toolchain@v1
2824
if: ${{ inputs.embedded == 'true' }}
29-
run: rustup target add thumbv7em-none-eabihf
25+
with:
26+
toolchain: stable
27+
target: thumbv7em-none-eabihf
28+
3029
- name: Install Cargo Dependencies
31-
shell: bash
3230
if: ${{ inputs.cargo-dependencies != '' }}
33-
run: cargo install --force ${{ inputs.cargo-dependencies }}
31+
uses: actions-rs/cargo@v1
32+
with:
33+
command: install
34+
args: --force ${{ inputs.cargo-dependencies }}
35+
36+
- name: Cache Build Files
37+
uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cargo/bin/
41+
~/.cargo/registry/index/
42+
~/.cargo/registry/cache/
43+
~/.cargo/git/db/
44+
target/
45+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

.github/workflows/build.yml

Lines changed: 40 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
branches: [ master ]
55
pull_request:
66

7-
name: Build
7+
name: Build Verification
88

99
jobs:
1010
formatting:
11-
name: Check for formatting issues
11+
name: Check for Formatting Issues
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
@@ -19,39 +19,22 @@ jobs:
1919
cargo-dependencies: "cargo-make cargo-fmt"
2020
- name: Check Formatting
2121
run: cargo fmt -- --check
22+
2223
build_pressure:
2324
name: Build with Pressure Feature
2425
runs-on: ubuntu-latest
2526
steps:
26-
- uses: actions/checkout@v2
27-
- name: Install packages
28-
run: sudo apt update && sudo apt install -y cmake protobuf-compiler
29-
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
30-
uses: carlosperate/arm-none-eabi-gcc-action@v1
31-
with:
32-
release: '12.2.Rel1'
33-
- uses: actions-rs/toolchain@v1
34-
with:
35-
toolchain: stable
36-
target: thumbv7em-none-eabihf
37-
- uses: actions/cache@v3
38-
with:
39-
path: |
40-
~/.cargo/bin/
41-
~/.cargo/registry/index/
42-
~/.cargo/registry/cache/
43-
~/.cargo/git/db/
44-
target/
45-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
46-
- name: Install cargo fmt
47-
run: rustup component add rustfmt
48-
- uses: actions-rs/cargo@v1
49-
name: "Install cargo-make"
27+
- name: Checkout
28+
uses: actions/checkout@v2
29+
30+
- name: Setup Rust Environment
31+
uses: ./.github/actions/setup-rust-environment/
5032
with:
51-
command: install
52-
args: --force cargo-make
53-
- uses: actions-rs/cargo@v1
54-
name: "Build with Pressure Feature"
33+
embedded: true
34+
cargo-dependencies: "cargo-make"
35+
36+
- name: "Build with Pressure Feature"
37+
uses: actions-rs/cargo@v1
5538
with:
5639
command: build
5740
args: --release --features pressure
@@ -60,33 +43,17 @@ jobs:
6043
name: Build with Temperature Feature
6144
runs-on: ubuntu-latest
6245
steps:
63-
- uses: actions/checkout@v2
64-
- name: Install packages
65-
run: sudo apt update && sudo apt install -y cmake
66-
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
67-
uses: carlosperate/arm-none-eabi-gcc-action@v1
68-
with:
69-
release: '12.2.Rel1'
70-
- uses: actions-rs/toolchain@v1
71-
with:
72-
toolchain: stable
73-
target: thumbv7em-none-eabihf
74-
- uses: actions/cache@v3
75-
with:
76-
path: |
77-
~/.cargo/bin/
78-
~/.cargo/registry/index/
79-
~/.cargo/registry/cache/
80-
~/.cargo/git/db/
81-
target/
82-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
83-
- uses: actions-rs/cargo@v1
84-
name: "Install cargo-make"
46+
- name: Checkout
47+
uses: actions/checkout@v2
48+
49+
- name: Setup Rust Environment
50+
uses: ./.github/actions/setup-rust-environment/
8551
with:
86-
command: install
87-
args: --force cargo-make
88-
- uses: actions-rs/cargo@v1
89-
name: "Build with Temperature Feature"
52+
embedded: true
53+
cargo-dependencies: "cargo-make"
54+
55+
- name: "Build with Temperature Feature"
56+
uses: actions-rs/cargo@v1
9057
with:
9158
command: build
9259
args: --release --features temperature
@@ -95,52 +62,32 @@ jobs:
9562
name: Build with Strain Feature
9663
runs-on: ubuntu-latest
9764
steps:
98-
- uses: actions/checkout@v2
99-
- name: Install packages
100-
run: sudo apt update && sudo apt install -y cmake protobuf-compiler
101-
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
102-
uses: carlosperate/arm-none-eabi-gcc-action@v1
103-
with:
104-
release: '12.2.Rel1'
105-
- uses: actions-rs/toolchain@v1
106-
with:
107-
toolchain: stable
108-
target: thumbv7em-none-eabihf
109-
- uses: actions/cache@v3
110-
with:
111-
path: |
112-
~/.cargo/bin/
113-
~/.cargo/registry/index/
114-
~/.cargo/registry/cache/
115-
~/.cargo/git/db/
116-
target/
117-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
118-
- uses: actions-rs/cargo@v1
119-
name: "Install cargo-make"
65+
- name: Checkout
66+
uses: actions/checkout@v2
67+
68+
- name: Setup Rust Environment
69+
uses: ./.github/actions/setup-rust-environment/
12070
with:
121-
command: install
122-
args: --force cargo-make
123-
- uses: actions-rs/cargo@v1
124-
name: "Build with Strain Feature"
71+
embedded: true
72+
cargo-dependencies: "cargo-make"
73+
74+
- name: "Build with Strain Feature"
75+
uses: actions-rs/cargo@v1
12576
with:
12677
command: build
12778
args: --release --features strain
79+
12880
test:
12981
runs-on: ubuntu-latest
13082
env:
13183
RUST_MIN_STACK: 8388608
13284
steps:
133-
- uses: actions/checkout@v2
134-
- name: Install packages
135-
run: sudo apt update && sudo apt install -y cmake protobuf-compiler
136-
- uses: actions-rs/toolchain@v1
137-
with:
138-
toolchain: stable
139-
- uses: actions-rs/cargo@v1
140-
name: "Install cargo-make"
141-
with:
142-
command: install
143-
args: --force cargo-make
85+
- name: Checkout
86+
uses: actions/checkout@v2
87+
88+
- name: Setup Rust Environment
89+
uses: ./.github/actions/setup-rust-environment/
90+
14491
- uses: actions-rs/cargo@v1
14592
name: "Run Host Tests"
14693
with:

0 commit comments

Comments
 (0)