forked from ariel-os/ariel-os
-
Notifications
You must be signed in to change notification settings - Fork 0
348 lines (308 loc) · 10.4 KB
/
main.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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
concurrency:
group: ${{ github.head_ref || github.run_id }}-main
cancel-in-progress: true
jobs:
cargo-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- id: get_toolchain
run: echo "toolchain=$(scripts/rust-toolchain.sh)" >> $GITHUB_OUTPUT
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_toolchain.outputs.toolchain }}
# TODO: we'll eventually want to test the whole workspace with --workspace
# TODO: we'll eventually want to enable relevant features
- name: Run crate tests
run: |
RUSTFLAGS='-D warnings' cargo test \
--no-default-features \
--features "
external-interrupts,
i2c,
no-boards,
spi,
" \
-p ariel-os \
-p ariel-os-embassy \
-p ariel-os-embassy-common \
-p ariel-os-identity \
-p ariel-os-macros \
-p ariel-os-runqueue \
-p ariel-os-threads \
cargo test \
-p coapcore \
-p rbi \
-p ringbuffer \
# We need to set `RUSTDOCFLAGS` as well in the following jobs, because it
# is used for doc tests.
- name: cargo test for RP
run: |
RUSTDOCFLAGS='--cfg context="rp2040"' RUSTFLAGS='-D warnings --cfg context="rp2040"' cargo test \
--features "
embassy-rp/rp2040,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-rp
- name: cargo test for nRF
run: |
RUSTDOCFLAGS='--cfg context="nrf52840"' RUSTFLAGS='-D warnings --cfg context="nrf52840"' cargo test \
--features "
embassy-nrf/nrf52840,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-nrf
- name: cargo test for STM32
run: |
RUSTDOCFLAGS='--cfg context="stm32wb55rgvx"' RUSTFLAGS='-D warnings --cfg context="stm32wb55rgvx"' cargo test \
--features "
embassy-stm32/stm32wb55rg,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-stm32
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
# "Obfuscate" the search query with concatenation so it does not self-trigger.
- name: Check for leftover occurrences of the old project name
run: set +e; grep -ri "riot"".rs" --line-number --exclude-dir=.git; test $? -eq 1
- id: get_toolchain
run: echo "toolchain=$(scripts/rust-toolchain.sh)" >> $GITHUB_OUTPUT
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_toolchain.outputs.toolchain }}
# Required for checking ariel-os-esp
targets: riscv32imac-unknown-none-elf
components: clippy, rustfmt
- name: rust cache
uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-binstall
# Should run as soon as possible to avoid using unwanted crates
# `--force`ing is required as the installed binary could have been
# restored from cache.
- name: cargo-deny
run: |
cargo binstall --no-confirm --no-discover-github-token --force cargo-deny
cargo deny check bans licenses sources
# Must run after the cargo-deny job as it requires the downloaded
# cargo-deny binary.
- name: cargo-deny advisories
run: cargo deny check advisories
# Prevent sudden announcement of a new advisory from failing CI
continue-on-error: true
# TODO: we'll eventually want to check the whole workspace with --workspace
# TODO: we'll eventually want to check relevant feature combinations
# TODO: we may want to use --no-deps as well
- name: clippy
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--features "
csprng,
external-interrupts,
hwrng,
i2c,
net,
no-boards,
spi,
storage,
usb,
usb-ethernet,
"
-p ariel-os
-p ariel-os-boards
-p ariel-os-chips
-p ariel-os-coap
-p ariel-os-debug
-p ariel-os-embassy
-p ariel-os-embassy-common
-p ariel-os-hal
-p ariel-os-identity
-p ariel-os-macros
-p ariel-os-random
-p ariel-os-rt
-p ariel-os-storage
-p ariel-os-threads
-p ariel-os-utils
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="esp32c6"' >> $GITHUB_ENV
- name: clippy for ESP32
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--target=riscv32imac-unknown-none-elf
--features "
esp-hal-embassy/esp32c6,
esp-hal/esp32c6,
external-interrupts,
i2c,
spi,
"
-p ariel-os-esp
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="rp2040"' >> $GITHUB_ENV
- name: clippy for RP
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--features "
embassy-rp/rp2040,
external-interrupts,
i2c,
spi,
"
-p ariel-os-rp
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="nrf52840"' >> $GITHUB_ENV
- name: clippy for nRF
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--features "
embassy-nrf/nrf52840,
external-interrupts,
i2c,
spi,
"
-p ariel-os-nrf
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="stm32wb55rgvx"' >> $GITHUB_ENV
- name: clippy for STM32
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--features "
embassy-stm32/stm32wb55rg,
external-interrupts,
i2c,
spi,
"
-p ariel-os-stm32
--
--deny warnings
# Reset `RUSTFLAGS`
- run: echo 'RUSTFLAGS=' >> $GITHUB_ENV
- name: rustdoc
run: |
RUSTDOCFLAGS='-D warnings' cargo doc \
-p ariel-os \
--features "
bench,
coap,
csprng,
executor-thread,
external-interrupts,
hwrng,
i2c,
net,
no-boards,
random,
ariel-os-coap/doc,
spi,
storage,
threading,
usb,
usb-hid,
"
- name: rustdoc for ESP32
run: |
RUSTDOCFLAGS='-D warnings --cfg context="esp32c6"' cargo doc \
--target=riscv32imac-unknown-none-elf \
--features "
esp-hal-embassy/esp32c6,
esp-hal/esp32c6,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-esp
- name: rustdoc for RP
run: |
RUSTDOCFLAGS='-D warnings --cfg context="rp2040"' cargo doc \
--features "
embassy-rp/rp2040,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-rp
- name: rustdoc for nRF
run: |
RUSTDOCFLAGS='-D warnings --cfg context="nrf52840"' cargo doc \
--features "
embassy-nrf/nrf52840,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-nrf
- name: rustdoc for STM32
run: |
RUSTDOCFLAGS='-D warnings --cfg context="stm32wb55rgvx"' cargo doc \
--features "
embassy-stm32/stm32wb55rg,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-stm32
- name: rustfmt
run: cargo fmt --check --all
- name: yamllint
uses: karancode/yamllint-github-action@master
with:
yamllint_comment: true # Insert inline PR comments
yamllint_strict: true # Set error code on warnings
- name: Install taplo
run: cargo binstall --no-confirm --no-symlinks --no-discover-github-token --force taplo-cli
- name: Check toml formatting
run: taplo fmt --check
# TODO: cargo-sort is disabled for now, as it won't stop formatting / failing perfectly sorted Cargo.toml files.
# - name: Install cargo-sort
# run: cargo install --git=https://github.com/DevinR528/cargo-sort --rev 55ec89082466f6bb246d870a8d56d166a8e1f08b cargo-sort
# - name: Check item order of Cargo.toml files
# run: cargo sort --check --grouped --workspace --no-format
- name: Ruff
uses: chartboost/ruff-action@v1
with:
args: format --check # Only check formatting for now
- name: typos
uses: crate-ci/[email protected]
- name: Check that the HTML support matrix is up to date
run: ./doc/gen_support_matrix_html.rs check doc/support_matrix.yml book/src/support_matrix.html