-
-
Notifications
You must be signed in to change notification settings - Fork 52
276 lines (272 loc) · 9.9 KB
/
build.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
name: Build
on:
push:
branches: ["main"]
paths: ["examples/**", "rmk/**", "rmk-macro/**"]
pull_request:
branches: ["main"]
paths: ["examples/**", "rmk/**", "rmk-macro/**"]
# Cancel any currently running workflows from the same PR, branch, or
# tag when a new workflow is triggered.
#
# https://stackoverflow.com/a/66336834
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
env:
CARGO_TERM_COLOR: always
jobs:
build_rmk:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Build rmk
working-directory: ./rmk
run: cargo build --release
build_rp2040:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv6m-none-eabi
- name: Build rp2040
working-directory: ./examples/use_rust/rp2040
run: cargo make uf2 --release
build_rp2040_with_config:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv6m-none-eabi
- name: Build rp2040 with config
working-directory: ./examples/use_config/rp2040
run: cargo make uf2 --release
build_stm32h7:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build stm32h7
working-directory: ./examples/use_rust/stm32h7
run: cargo make uf2 --release
build_stm32h7_with_config:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build stm32h7 with config
working-directory: ./examples/use_config/stm32h7
run: cargo make uf2 --release
build_stm32f1:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabi
- name: Build stm32f1
working-directory: ./examples/use_rust/stm32f1
run: cargo make uf2 --release
build_stm32f1_with_config:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabi
- name: Build stm32f1 with config
working-directory: ./examples/use_config/stm32f1
run: cargo make uf2 --release
build_stm32f4:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build stm32f4
working-directory: ./examples/use_rust/stm32f4
run: cargo make uf2 --release
build_stm32f4_with_config:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build stm32f4 with config
working-directory: ./examples/use_config/stm32f4
run: cargo make uf2 --release
build_nrf52840_ble:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build nrf52840_ble
working-directory: ./examples/use_rust/nrf52840_ble
run: cargo make uf2 --release
build_nrf52832_ble:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build nrf52832_ble
working-directory: ./examples/use_rust/nrf52832_ble
run: cargo make uf2 --release
build_nrf52832_ble_with_config:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build nrf52832_ble with config
working-directory: ./examples/use_config/nrf52832_ble
run: cargo make uf2 --release
build_rp2040_split:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv6m-none-eabi
- name: Build rp2040 split
working-directory: ./examples/use_rust/rp2040_split
run: cargo make uf2 --release
build_rp2040_split_with_config:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv6m-none-eabi
- name: Build rp2040 split with config
working-directory: ./examples/use_config/rp2040_split
run: cargo make uf2 --release
build_nrf52840:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build nrf52840 split
working-directory: ./examples/use_rust/nrf52840_ble_split
run: cargo make uf2 --release
build_nrf52840_split_with_config:
runs-on: ubuntu-latest
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-make
run: cargo binstall cargo-make -y
- uses: actions/checkout@v3
- name: Install target
run: rustup target add thumbv7em-none-eabihf
- name: Build nrf52840 split with config
working-directory: ./examples/use_config/nrf52840_ble_split
run: cargo make uf2 --release
binary-size:
# Copied from sequential-storage: https://github.com/tweedegolf/sequential-storage/blob/master/.github/workflows/ci.yaml
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: write
steps:
- uses: cargo-bins/cargo-binstall@main
- uses: actions/cache@v3
id: cache-cargo
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./example/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install flip-link
run: cargo binstall flip-link -y
- run: rustup target add thumbv7em-none-eabihf
- run: rustup component add rust-src llvm-tools
- if: steps.cache-cargo.outputs.cache-hit != 'true'
run: cargo install cargo-binutils
- name: Check out the repo with the full git history
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Build new binary
working-directory: ./examples/use_config/nrf52840_ble
run: |
echo 'RESULT<<EOF' >> $GITHUB_OUTPUT
cargo size --release >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
id: new-size
- name: Save binary
run: |
mv ./examples/use_config/nrf52840_ble/target/thumbv7em-none-eabihf/release/rmk-nrf52840 ./examples/use_config/nrf52840_ble/target/thumbv7em-none-eabihf/release/original.elf
- name: If it's a PR checkout the base commit
if: ${{ github.event.pull_request }}
run: git checkout ${{ github.event.pull_request.base.sha }}
- name: Rebuild with the base commit
if: ${{ github.event.pull_request }}
working-directory: ./examples/use_config/nrf52840_ble
run: cargo build --release
- name: Run Bloaty to compare both output files
if: ${{ github.event.pull_request }}
id: bloaty-comparison
uses: carlosperate/bloaty-action@v1
with:
bloaty-args: ./examples/use_config/nrf52840_ble/target/thumbv7em-none-eabihf/release/original.elf -- ./examples/use_config/nrf52840_ble/target/thumbv7em-none-eabihf/release/rmk-nrf52840
output-to-summary: true
- name: Add a PR comment with the bloaty diff
if: ${{ github.event.pull_request }}
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## PR build size\n \`\`\`\n${{ join(steps.new-size.outputs.*, '\n') }}\n\`\`\`\n ### Diff\n\`\`\`\n${{ steps.bloaty-comparison.outputs.bloaty-output-encoded }}\`\`\`\n`
})