-
-
Notifications
You must be signed in to change notification settings - Fork 781
428 lines (369 loc) · 13.8 KB
/
build-pr.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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
name: build PR
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# This controls the concurrency level for the jobs and how it's calculated
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a job for each supported OS in the form `build-<os>`
build-linux:
# Name the job more appropriately so we can tell which windows and which MinGW ABI is in use
name: 'build-linux (${{ matrix.os.name }}, ${{ matrix.probe }})'
# The type of runner that the job will run on
runs-on: ${{ matrix.os.id }}
# We define a matrix of GCCs and OSes to build against so we can cover a variety of
# suitable compilation environments and early discover issues. The `build-and-upload`
# workflow contains an extended set.
strategy:
matrix:
os:
- {id: ubuntu-22.04, name: jammy}
arm-compiler:
- '12.2.Rel1'
probe:
- '96b_carbon'
- 'bluepill'
- 'ctxlink'
- 'f072'
- 'f3'
- 'f4discovery'
- 'hydrabus'
- 'launchpad-icdi'
- 'native'
- 'native-uncommon'
- 'native-st-clones'
- 'native-riscv'
- 'native-remote'
- 'stlink'
- 'stlinkv3'
- 'swlink'
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Build a suitable runtime environment
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "$GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Setup and use a suitable ARM GCC for the firmware
- name: Setup ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: ${{ matrix.arm-compiler }}
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
sudo python3 -m pip install --upgrade pip setuptools wheel
sudo python3 -m pip install meson ninja
working-directory: ${{ runner.temp }}
# Install BMDA's deps (libftdi1, hidapi-hidraw)
- name: Install BMDA dependencies
run: sudo apt-get -y install libftdi1-dev libhidapi-dev
# Record the versions of all the tools used in the build
- name: Version tools
run: |
cc --version
arm-none-eabi-gcc --version
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
# Build the firmware for all platform variants (currently available)
- name: Build
run: |
meson setup build --cross-file cross-file/${{ matrix.probe }}.ini --werror
meson compile -C build
build-windows-msvc:
# Name the job more appropriately so we can tell which VS version is in use
name: 'build-msvc (meson, ${{ matrix.os }})'
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Set the shell so run steps will execute inside the native environment
defaults:
run:
shell: pwsh
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues. The `build-and-upload`
# workflow contains an extended set.
strategy:
matrix:
os:
- windows-2022
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Make the selected OS's MSVC available to the environment
- name: Setup compiler
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_64
# Build a suitable runtime environment
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "GITHUB_WORKSPACE=$(pwd)" >> $GITHUB_ENV
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install meson ninja
# Record the versions of all the tools used in the build
- name: Version tools
run: |
cl /Bv
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
# Build the default BMDA configuration
- name: Build full BMDA
run: |
meson setup build
meson compile -C build
build-windows-mingw:
# Name the job more appropriately so we can tell which windows and which MinGW ABI is in use
name: 'build-mingw (${{ matrix.os }}, ${{ matrix.sys.abi }})'
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Set the shell so run steps will execute from in msys2 correctly by default
defaults:
run:
shell: msys2 {0}
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues. The `build-and-upload`
# workflow contains an extended set.
strategy:
matrix:
os:
- windows-2022
sys:
- {abi: mingw64, env: x86_64, compiler: gcc}
- {abi: ucrt64, env: ucrt-x86_64, compiler: gcc}
- {abi: clang64, env: clang-x86_64, compiler: clang}
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Install a suitable system compiler for the build
- name: Use MinGW from MSYS
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys.abi}}
update: true
path-type: inherit
pacboy: >-
toolchain:p
meson:p
# Build a suitable runtime environment
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "$GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Configure the system toolchain environment
- name: Setup system GCC
if: matrix.sys.compiler == 'gcc'
run: |
CXX=${CC/#gcc/g++}
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
env:
CC: ${{ matrix.sys.compiler }}
- name: Setup system Clang
if: matrix.sys.compiler == 'clang'
run: |
CXX=${CC/#clang/clang++}
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
env:
CC: ${{ matrix.sys.compiler }}
# Record the versions of all the tools used in the build
- name: Version tools
run: |
$CC --version
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
# Install the dependencies needed for BMDA build
- name: Install extra BMDA dependencies
run: |
pacman --noconfirm -S mingw-w64-${{matrix.sys.env}}-libusb mingw-w64-${{matrix.sys.env}}-hidapi
# Build BMDA
- name: Build BMDA with MSYS2-provided dependencies
run: |
meson setup build
meson compile -C build
build-macos:
# Name the job more appropriately so we can tell which Xcode/macOS version is in use
name: 'build-macos (${{ matrix.os }})'
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Set the shell so run steps will execute inside the native environment
defaults:
run:
shell: bash
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues. The `build-and-upload`
# workflow contains an extended set.
strategy:
matrix:
os:
- macos-13
- macos-14
- macos-latest
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Build a suitable runtime environment
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
brew install meson ninja
# Record the versions of all the tools used in the build
- name: Version tools
run: |
cc --version || true
ld --version || true
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
# Build the default BMDA configuration
- name: Build full BMDA
run: |
meson setup build
meson compile -C build
build-macos-homebrew:
# Name the job more appropriately so we can tell which GCC version is in use
name: 'build-macos (${{ matrix.os }}, ${{ matrix.compiler }})'
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Set the shell so run steps will execute inside the native environment
defaults:
run:
shell: bash
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues. The `build-and-upload`
# workflow contains an extended set.
strategy:
matrix:
os:
- macos-13
- macos-14
compiler:
- gcc@11
- gcc@12
- gcc@13
- gcc@14 # Don't use 'gcc', the symlink is versioned -- see below
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Build a suitable runtime environment
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "$GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Install a suitable system compiler for the build
- name: Setup Homebrew GCC
run: |
brew install ${{ matrix.compiler }}
CC=${COMPILER/@/-}
CXX=${CC/#gcc/g++}
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
env:
COMPILER: ${{ matrix.compiler }}
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
brew install meson ninja
# Install BMDA's deps since they cannot be compiled with GCC
- name: Install BMDA dependencies
run: brew install libusb libftdi hidapi
# Record the versions of all the tools used in the build
- name: Version tools
shell: bash
run: |
$CC --version
$CXX --version
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
# Build the default BMDA configuration
- name: Build full BMDA
run: |
meson setup build $BUILD_OPTS
meson compile -C build
size-diff:
runs-on: ubuntu-22.04
steps:
# Build a suitable runtime environment
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "$GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Setup and use a suitable ARM GCC for the firmware
- name: Setup ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '12.2.Rel1'
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
sudo python3 -m pip install --upgrade pip setuptools wheel
sudo python3 -m pip install meson ninja
working-directory: ${{ runner.temp }}
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
path: base
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: head
# Build the base ref firmware for the largest Flash target available
- name: Build base
run: |
meson setup build --cross-file=cross-file/blackpill-f411ce.ini
meson compile -C build > build.log
working-directory: base
# Build the PR `HEAD` ref firmware for the largest Flash target available
- name: Build head
run: |
meson setup build --cross-file=cross-file/blackpill-f411ce.ini
meson compile -C build > build.log
working-directory: head
- name: Diff
run: head/scripts/diff_size.py base/build.log head/build.log