forked from SlimeVR/SlimeVR-Rust
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (105 loc) · 3.43 KB
/
firmware-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
name: Firmware CI
on:
push:
branches:
- main
paths:
- .github/workflows/firmware-ci.yml
- firmware/**
- networking/firmware_protocol/**
pull_request:
paths:
- .github/workflows/firmware-ci.yml
- firmware/**
- networking/firmware_protocol/**
workflow_dispatch:
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./firmware
steps:
- uses: actions/checkout@v3
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "./firmware -> target/"
- name: Check formatting
run: cargo fmt --check --all
build:
name: Build
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.net == 'net-wifi' }} # Continue if wifi fails because it's not fully working currently
strategy:
matrix:
mcu: [mcu-esp32c3, mcu-esp32, mcu-nrf52840, mcu-nrf52832]
net: [net-stubbed, net-wifi, net-ble]
log: [log-rtt, log-usb-serial, log-uart]
include:
- mcu: mcu-esp32c3
target: riscv32imc-unknown-none-elf
- mcu: mcu-esp32
target: xtensa-esp32-none-elf
espname: esp32 # needed for passing to xtensa action
- mcu: mcu-nrf52840
target: thumbv7em-none-eabihf
boot: nrf-boot-s140
- mcu: mcu-nrf52832
target: thumbv7em-none-eabihf
boot: nrf-boot-s132
exclude:
- mcu: mcu-esp32
log: log-usb-serial
- mcu: mcu-esp32
log: log-rtt
- mcu: mcu-nrf52832
log: log-usb-serial
- mcu: mcu-nrf52840
net: net-wifi
- mcu: mcu-nrf52832
net: net-wifi
- mcu: mcu-nrf52840
net: net-ble
- mcu: mcu-nrf52832
net: net-ble
env:
FEATURES: ${{ format('{0},{1},{2},{3},imu-stubbed,fusion-stubbed', matrix.mcu, matrix.net, matrix.log, matrix.boot) }}
defaults:
run:
working-directory: ./firmware
steps:
- uses: actions/checkout@v3
- name: Use .env.template as .env
run: |
cp .env.template .env
- name: Install Xtensa toolchain
if: startsWith(matrix.target, 'xtensa')
uses: esp-rs/[email protected]
with:
ldproxy: false
buildtargets: ${{ matrix.espname }}
- if: startsWith(matrix.target, 'xtensa')
run: rustup override set esp
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "./firmware -> target/"
env-vars: "FEATURES"
cache-on-failure: ${{ matrix.net == 'net-wifi' }} # Again, wifi doesnt fully work currently.
- uses: taiki-e/install-action@v1
with:
tool: clippy-sarif,sarif-fmt
- name: Clippy lints
run: |
cargo clippy --target ${{ matrix.target }} --no-default-features --features $FEATURES --message-format=json |
clippy-sarif | tee results.sarif | sarif-fmt && sed -i 's/"uri": "/"uri": "firmware\//g' results.sarif
- name: Build
run: cargo build --target ${{ matrix.target }} --no-default-features --features $FEATURES
- name: Upload SARIF file
if: ${{ success() }}
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: firmware/results.sarif
category: ${{ env.FEATURES }}