-
Notifications
You must be signed in to change notification settings - Fork 152
216 lines (183 loc) · 6.67 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
on:
push:
branches: master
pull_request:
merge_group:
name: Continuous integration
jobs:
ci:
name: CI
runs-on: ubuntu-latest
needs: [check, ci-linux, ci-clippy, ci-serde]
if: always()
steps:
- name: Done
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
check:
name: Cargo check / clippy
runs-on: ubuntu-latest
strategy:
matrix:
TARGET:
[
x86_64-unknown-linux-gnu,
x86_64-apple-darwin,
x86_64-pc-windows-msvc,
]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.TARGET }}
components: clippy
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.TARGET }}
- run: cargo check --target ${{ matrix.TARGET }}
env:
RUSTFLAGS: -D warnings
- run: cargo clippy --target ${{ matrix.TARGET }}
ci-linux:
runs-on: ubuntu-latest
needs: [check]
strategy:
matrix:
# Options are all, none, strict and const
include:
- { rust: stable, vendor: Atmel, options: all }
- { rust: stable, vendor: Atmel, options: "" }
- { rust: stable, vendor: Freescale, options: all }
- { rust: stable, vendor: Freescale, options: "" }
- { rust: stable, vendor: Fujitsu, options: "" }
- { rust: stable, vendor: Fujitsu, options: "--atomics" }
- { rust: stable, vendor: GD32, options: all }
- { rust: stable, vendor: GD32, options: "" }
- { rust: stable, vendor: Holtek, options: all }
- { rust: stable, vendor: Holtek, options: "" }
- { rust: stable, vendor: Microchip, options: "" }
- { rust: stable, vendor: Microchip, options: "--atomics" }
- { rust: stable, vendor: Nordic, options: all }
- { rust: stable, vendor: Nordic, options: "" }
- { rust: stable, vendor: Nuvoton, options: "" }
- { rust: stable, vendor: Nuvoton, options: "--atomics" }
- { rust: stable, vendor: NXP, options: all }
- { rust: stable, vendor: NXP, options: "" }
- { rust: stable, vendor: RISC-V, options: "" }
- { rust: stable, vendor: RISC-V, options: "--atomics" }
- { rust: stable, vendor: SiliconLabs, options: all }
- { rust: stable, vendor: SiliconLabs, options: "" }
- { rust: stable, vendor: Spansion, options: "" }
- { rust: stable, vendor: Spansion, options: "--atomics" }
- { rust: stable, vendor: STMicro, options: "" }
- { rust: stable, vendor: STMicro, options: "--atomics" }
- { rust: stable, vendor: STM32-patched, options: "--strict -f enum_value::p: --max-cluster-size --atomics --atomics-feature atomics --impl-debug --impl-defmt defmt" }
- { rust: stable, vendor: Toshiba, options: all }
- { rust: stable, vendor: Toshiba, options: "" }
# Test MSRV
- { rust: 1.76.0, vendor: Nordic, options: "" }
# Use nightly for architectures which don't support stable
- { rust: nightly, vendor: MSP430, options: "--atomics" }
- { rust: nightly, vendor: MSP430, options: "" }
# Workaround for _1token0
- { rust: nightly-2024-09-25, vendor: Espressif, options: "--atomics --ident-formats-theme legacy" }
- { rust: nightly-2024-09-25, vendor: Espressif, options: "--ident-format register:::Reg" }
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Self install
run: |
cargo install svd2rust --path .
- name: Run CI script for `${{ matrix.vendor }}` under rust `${{ matrix.rust }}` with options=`${{ matrix.options }}`
env:
VENDOR: ${{ matrix.vendor }}
OPTIONS: ${{ matrix.options }}
COMMAND: check
RUST_TOOLCHAIN: ${{ matrix.rust }}
run: bash ci/script.sh
ci-clippy:
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Self install
run: |
cargo install svd2rust --path .
- name: Run CI script
env:
VENDOR: RISC-V
OPTIONS: ""
COMMAND: clippy
run: bash ci/script.sh
ci-serde:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: svdtools-0.2.3
- name: Install svdtools
run: |
cargo install svdtools --version 0.2.3 --target-dir target
- name: Run CI script
run: |
wget https://stm32-rs.github.io/stm32-rs/stm32f411.svd.patched
svdtools convert --input-format xml stm32f411.svd.patched stm32f411.yaml
cargo run --release -- -i stm32f411.yaml
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
artifact:
name: Build svd2rust artifact
if: github.event_name == 'pull_request'
needs: [check]
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
- target: aarch64-apple-darwin
runs-on: macos-latest
- target: x86_64-pc-windows-msvc
runs-on: windows-latest
suffix: .exe
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Build svd2rust artifact
run: cargo build --release --target ${{ matrix.target }}
- run: mv target/${{ matrix.target }}/release/svd2rust${{ matrix.suffix || '' }} svd2rust-${{ matrix.target }}-$(git rev-parse --short HEAD)${{ matrix.suffix || '' }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifact-svd2rust-${{ matrix.target }}
path: svd2rust-${{ matrix.target }}*