-
Notifications
You must be signed in to change notification settings - Fork 18
257 lines (239 loc) · 7.19 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
on:
push:
tags:
- 'v*'
pull_request:
# allows manual triggering
workflow_dispatch:
merge_group:
name: CI
jobs:
build:
name: Build
runs-on: ubuntu-latest
env: {"RUSTFLAGS": "-D warnings"}
strategy:
matrix:
target:
- "thumbv6m-none-eabi"
- "thumbv7em-none-eabi"
mcu:
- "stm32wl5x_cm0p"
- "stm32wl5x_cm4"
- "stm32wle5"
toolchain:
- "1.62" # MSRV
- "beta"
exclude:
- mcu: "stm32wl5x_cm0p"
target: "thumbv7em-none-eabi"
- mcu: "stm32wl5x_cm4"
target: "thumbv6m-none-eabi"
- mcu: "stm32wle5"
target: "thumbv6m-none-eabi"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
- name: Build HAL
run: |
cargo build \
--target ${{ matrix.target }} \
--features ${{ matrix.mcu }}
- name: Build NUCLEO BSP
if: ${{ startsWith(matrix.mcu, 'stm32wl5x') }}
run: |
cargo build \
--package nucleo-wl55jc-bsp \
--target ${{ matrix.target }} \
--features ${{ matrix.mcu }},defmt
- name: Build LoRa E5 BSP
if: ${{ matrix.mcu == 'stm32wle5' }}
run: |
cargo build \
--package lora-e5-bsp \
--target ${{ matrix.target }} \
--features defmt
- name: Build Examples
if: ${{ matrix.mcu == 'stm32wl5x_cm4' }}
run: cargo build --examples -p examples --target ${{ matrix.target }}
build_testsuite:
name: Build Testsuite
runs-on: ubuntu-latest
env:
# setting this overrides environment variables used for linking
# RUSTFLAGS: "-D warnings"
DEFMT_LOG: "debug"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv7em-none-eabi
- run: |
cargo test -p testsuite --target thumbv7em-none-eabi --bins --locked --no-run
- name: Upload test binaries
uses: actions/upload-artifact@v4
with:
name: test-bins
if-no-files-found: error
retention-days: 1
path: |
target/thumbv7em-none-eabi/debug/deps/*
!target/thumbv7em-none-eabi/debug/deps/*.cargo-lock
!target/thumbv7em-none-eabi/debug/deps/*.d
!target/thumbv7em-none-eabi/debug/deps/*.meta
!target/thumbv7em-none-eabi/debug/deps/*.rlib
!target/thumbv7em-none-eabi/debug/deps/*.rmeta
!target/thumbv7em-none-eabi/debug/deps/.fingerprint/**/*
!target/thumbv7em-none-eabi/debug/deps/build/**/*
!target/thumbv7em-none-eabi/debug/deps/deps/**/*
!target/thumbv7em-none-eabi/debug/deps/examples/**/*
!target/thumbv7em-none-eabi/debug/deps/incremental/**/*
run_testsuite:
name: Run Testsuite
runs-on: self-hosted
needs:
- build_testsuite
steps:
- uses: actions/checkout@v4
- name: Display probe-run version
run: probe-rs --version
- name: List probes
run: probe-rs list
- uses: actions/download-artifact@v4
with:
name: test-bins
path: bins
- name: Run on-target tests
timeout-minutes: 5
run: |
python3 testsuite/runall.py --elf-dir bins \
0483:374e:002900205553500A20393256 \
0483:374e:0034001A5553500B20393256
test:
name: Unit Tests
runs-on: ubuntu-latest
env: {"RUSTFLAGS": "-D warnings"}
strategy:
matrix:
mcu:
- "stm32wl5x_cm0p"
- "stm32wl5x_cm4"
- "stm32wle5"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Test HAL
run: cargo test --features ${{ matrix.mcu }},embedded-time,chrono
- name: Test nucleo BSP
if: ${{ startsWith(matrix.mcu, 'stm32wl5x') }}
run: |
cargo test -p nucleo-wl55jc-bsp --features ${{ matrix.mcu }},embedded-time,chrono
- name: Test LoRa E5 BSP
if: ${{ matrix.mcu == 'stm32wle5' }}
run: cargo test -p lora-e5-bsp --features embedded-time,chrono
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
# not using clippy-check due to this issue:
# https://github.com/actions-rs/clippy-check/issues/2
- run: cargo clippy --features stm32wl5x_cm4 -- --deny warnings
format:
name: Format
runs-on: ubuntu-latest
env: {"RUSTFLAGS": "-D warnings"}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo +nightly fmt -- --check
doc:
name: doc
runs-on: ubuntu-latest
env: {"RUSTDOCFLAGS": "-D warnings"}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
# not run in parallel to avoid hitting concurrency limit
# stm32wl5x_cm4 covered by rustdoc
- run: cargo doc --features stm32wl5x_cm0p
- run: cargo doc --features stm32wle5
rustdoc:
name: rustdoc
runs-on: ubuntu-latest
env: {"RUSTDOCFLAGS": "-D warnings --cfg docsrs"}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: rustdoc
run: |
cd hal
cargo +nightly rustdoc \
--features chrono,embedded-time,rt,stm32wl5x_cm4 \
-- -Z unstable-options --enable-index-page
chmod -R 777 ../target
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: target/doc
deploy_rustdoc:
name: Deploy Nightly Docs
runs-on: ubuntu-latest
needs: rustdoc
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v3
id: deployment
release:
name: crates.io release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build
- build_testsuite
- clippy
- doc
- format
- rustdoc
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Release stm32wlxx-hal
run: |
cd hal
cargo publish --no-verify --token ${CRATES_IO_TOKEN}
cd ..
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- name: Release nucleo-wl55jc-bsp
run: |
cd nucleo-wl55jc-bsp
cargo publish --no-verify --token ${CRATES_IO_TOKEN}
cd ..
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- name: Release lora-e5-bsp
run: |
cd lora-e5-bsp
cargo publish --no-verify --token ${CRATES_IO_TOKEN}
cd ..
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}