Skip to content

Commit c73ea4d

Browse files
authored
Additional improvements to CI workflow (#750)
1 parent 258e46b commit c73ea4d

File tree

2 files changed

+24
-49
lines changed

2 files changed

+24
-49
lines changed

.github/actions/setup-target/action.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ description: Setup an ARM or x86_64 build environment
33

44
inputs:
55
arch:
6-
required: true
6+
default: x86_64
7+
required: false
78
target:
8-
required: true
9+
default: x86_64-unknown-linux-gnu
10+
required: false
911
toolchain:
1012
default: stable
1113
required: false
@@ -15,10 +17,10 @@ inputs:
1517
runs:
1618
using: composite
1719
steps:
18-
- name: Replace target string
19-
if: inputs.arch != 'x86_64'
20-
uses: mad9000/actions-find-and-replace-string@5
20+
- if: inputs.arch != 'x86_64'
21+
name: Replace target string
2122
id: findandreplace
23+
uses: mad9000/actions-find-and-replace-string@5
2224
with:
2325
source: ${{ inputs.target }}
2426
find: "unknown-"
@@ -33,14 +35,14 @@ runs:
3335

3436
- uses: Swatinem/rust-cache@v2
3537

36-
- name: Install Cross-Compile Support
37-
if: inputs.arch != 'x86_64'
38+
- if: inputs.arch != 'x86_64'
39+
name: Install Cross-Compile Support
3840
uses: junelife/gha-ubuntu-cross@v6
3941
with:
4042
arch: ${{ inputs.arch }}
4143

42-
- name: Install dependencies (Raspberry Pi)
43-
if: inputs.arch != 'x86_64'
44+
- if: inputs.arch != 'x86_64'
45+
name: Install dependencies (Raspberry Pi)
4446
shell: bash
4547
run: |
4648
sudo apt-get update && sudo apt-get install -y \
@@ -53,14 +55,14 @@ runs:
5355
musl-tools \
5456
pkg-config
5557
56-
- name: Install dependencies (x86_64 linux)
57-
if: inputs.target == 'x86_64-unknown-linux-gnu' || inputs.target == 'x86_64-unknown-linux-musl'
58+
- if: inputs.target == 'x86_64-unknown-linux-gnu' || inputs.target == 'x86_64-unknown-linux-musl'
59+
name: Install dependencies (x86_64 linux)
5860
shell: bash
5961
run: |
6062
sudo apt-get update && sudo apt-get -y install musl-tools pkg-config
6163
62-
- name: Set environment variables
63-
if: inputs.arch != 'x86_64'
64+
- if: inputs.arch != 'x86_64'
65+
name: Set environment variables
6466
shell: bash
6567
run: |
6668
echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV

.github/workflows/ci.yml

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111

1212
env:
1313
CARGO_TERM_COLOR: always
14+
MSRV: "1.82"
1415

1516
# Cancel any currently running workflows from the same PR, branch, or
1617
# tag when a new workflow is triggered.
@@ -59,10 +60,8 @@ jobs:
5960
arch: ${{ matrix.platform.arch }}
6061
target: ${{ matrix.platform.target }}
6162

62-
- run: cargo check
63-
64-
- run: cargo run --package=cargo-espflash -- espflash completions bash
65-
- run: cargo run --package=espflash -- completions bash
63+
- run: cargo run -p cargo-espflash -- espflash completions bash
64+
- run: cargo run -p espflash -- completions bash
6665

6766
check-lib:
6867
name: Check lib (${{ matrix.platform.target }})
@@ -112,64 +111,38 @@ jobs:
112111
with:
113112
arch: ${{ matrix.platform.arch }}
114113
target: ${{ matrix.platform.target }}
115-
toolchain: "1.82"
114+
toolchain: ${{ env.MSRV }}
116115

117116
- run: cargo check -p espflash --lib
118117

119118
# --------------------------------------------------------------------------
120119
# Test
121120

122121
test:
123-
name: Unit Tests (${{ matrix.platform.target }})
124-
strategy:
125-
fail-fast: false
126-
matrix:
127-
platform:
128-
- target: "x86_64-unknown-linux-gnu"
129-
arch: "x86_64"
130-
- target: "aarch64-unknown-linux-gnu"
131-
arch: "arm64"
132-
- target: "armv7-unknown-linux-gnueabihf"
133-
arch: "armhf"
122+
name: Unit Tests
134123
runs-on: ubuntu-22.04
135124

136125
steps:
137126
- uses: actions/checkout@v4
138-
139127
- uses: ./.github/actions/setup-target
140-
with:
141-
arch: ${{ matrix.platform.arch }}
142-
target: ${{ matrix.platform.target }}
143128

144129
- run: cargo test --lib
145130

146131
# --------------------------------------------------------------------------
147132
# Lint
148133

149134
clippy:
150-
name: Clippy (${{ matrix.platform.target }})
151-
strategy:
152-
fail-fast: false
153-
matrix:
154-
platform:
155-
- target: "x86_64-unknown-linux-gnu"
156-
arch: "x86_64"
157-
- target: "aarch64-unknown-linux-gnu"
158-
arch: "arm64"
159-
- target: "armv7-unknown-linux-gnueabihf"
160-
arch: "armhf"
135+
name: Clippy
161136
runs-on: ubuntu-22.04
162137

163138
steps:
164139
- uses: actions/checkout@v4
165-
166-
- uses: ./.github/actions/setup-target
140+
- uses: dtolnay/rust-toolchain@stable
167141
with:
168-
arch: ${{ matrix.platform.arch }}
169-
target: ${{ matrix.platform.target }}
170142
components: clippy
143+
- uses: Swatinem/rust-cache@v2
171144

172-
- run: cargo clippy -- -D warnings -A clippy::too_many_arguments
145+
- run: cargo clippy -- -D warnings
173146

174147
rustfmt:
175148
name: Rustfmt

0 commit comments

Comments
 (0)