Repository navigation
474 lines (447 loc) · 19.9 KB
/
Copy pathbuild.yaml
File metadata and controls
474 lines (447 loc) · 19.9 KB
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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
---
# GitHub action to compile and test kyua on supported platforms.
#
# Steps executed:
# * Handle prerequisites
# * Install binary packages
# * Build packages from source (if needed).
# * Build
# * Install
# * Run tests
#
# On MacOS we build with:
# * latest clang from brew (system provided clang lacks sanitizers).
# * ld from system
#
env:
ATF_REPO: freebsd/atf
ATF_REF: atf-0.25
LUTOK_REPO: freebsd/lutok
LUTOK_REF: lutok-0.6.3
name: build
"on":
pull_request:
branches:
- master
push:
workflow_dispatch:
permissions:
contents: read
jobs:
build-and-test:
# yamllint disable-line rule:line-length
name: ${{ matrix.build-os }} ${{ matrix.compiler }} ${{ join(matrix.sanitize, '+') }}
env:
AR: ${{ matrix.llvm-bindir }}/llvm-ar
CC: ${{ matrix.llvm-bindir }}/clang
CPP: ${{ matrix.llvm-bindir }}/clang-cpp
CXX: ${{ matrix.llvm-bindir }}/clang++
NM: ${{ matrix.llvm-bindir }}/llvm-nm
OBJDUMP: ${{ matrix.llvm-bindir }}/llvm-objdump
RANLIB: ${{ matrix.llvm-bindir }}/llvm-ranlib
STRIP: ${{ matrix.llvm-bindir }}/llvm-strip
ATF_SRCDIR: ${{ github.workspace }}/atf-src
ATF_OBJDIR: ${{ github.workspace }}/atf-obj
KYUA_PREFIX: ${{ github.workspace }}/root
KYUA_SRCDIR: ${{ github.workspace }}/kyua-src
KYUA_OBJDIR: ${{ github.workspace }}/kyua-obj
LUTOK_SRCDIR: ${{ github.workspace }}/lutok-src
LUTOK_OBJDIR: ${{ github.workspace }}/lutok-obj
# yamllint disable-line rule:line-length
JOB_NAME: ${{ matrix.build-os }} ${{ matrix.compiler }} ${{ join(matrix.sanitize, '+') }}
runs-on: "${{ matrix.build-os }}"
strategy:
fail-fast: false
matrix:
build-os:
- macos-latest
- ubuntu-latest
include:
# The macOS runner uses a homebrew provided compiler as the
# system compiler lacks ASAN/LSAN/UBSAN support.
- build-os: macos-latest
compiler: clang-20
env:
# The coredump tests cause the macOS runner to
# frequently timeout/fail due to ENOSPC issues. Skip
# the tests until all of the issues can be worked
# out.
#
# See this issue for more details:
# https://github.com/actions/runner-images/issues/14678
- RUN_COREDUMP_TESTS: false
pkgs:
- atf
- autoconf
- automake
- libtool
- llvm@20
# This is required when
# `build-dependencies-from-source == yes`:
# - lua
- lutok
- pkgconf
- sqlite
llvm-bindir: /opt/homebrew/opt/llvm@20/bin
build-dependencies-from-source: false
- build-os: ubuntu-latest
compiler: clang-18
env:
- RUN_COREDUMP_TESTS: true
pkgs:
- autoconf
- automake
- clang-18
- libtool
- lua5.4
- liblua5.4-dev
- pkgconf
- libsqlite3-dev
llvm-bindir: /usr/lib/llvm-18/bin
build-dependencies-from-source: true
sanitize:
- ""
# TODO(ngie,77): tests currently fail when these options
# are enabled.
# - ["asan", "lsan"]
- ubsan
steps:
- name: Install base dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update --quiet || true
brew install -q ${{ join(matrix.pkgs, ' ') }}
brew cleanup --scrub
brew list -1
rm -Rf "$(brew --cache)"
- name: Install base dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt update --quiet
sudo apt --quiet -y --no-install-suggests \
--no-install-recommends install \
${{ join(matrix.pkgs, ' ') }} \
- name: Checking out source (ATF)
if: ${{ matrix.build-dependencies-from-source }}
uses: actions/checkout@v4
with:
repository: "${{ env.ATF_REPO }}"
ref: "${{ env.ATF_REF }}"
# Same as `ATF_SRCDIR`.
path: "${{ github.workspace }}/atf-src"
- name: Checking out source (Lutok)
if: ${{ matrix.build-dependencies-from-source }}
uses: actions/checkout@v4
with:
repository: "${{ env.LUTOK_REPO }}"
ref: "${{ env.LUTOK_REF }}"
# Same as `LUTOK_SRCDIR`.
path: "${{ github.workspace }}/lutok-src"
- name: Checking out source (Kyua)
uses: actions/checkout@v4
with:
# Same as `KYUA_SRCDIR`.
path: "${{ github.workspace }}/kyua-src"
- name: Build Environment Dump
run: |
echo "uname -a: $(uname -a)"
echo "uname -m: $(uname -m)"
echo "uname -p: $(uname -p)"
- name: Distcheck Environment Setup (common)
run: |
sudo mkdir -p /cores
sudo chmod 1777 /cores
- name: Distcheck Environment Setup (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo sh -c \
'echo "/cores/core.%p" > /proc/sys/kernel/core_pattern'
sudo ldconfig
- name: Distcheck Environment Setup (macOS)
if: runner.os == 'macOS'
run: |
if [ "$(sysctl -n kern.coredump)" != 0 ]; then
echo "Coredumps enabled on runner"
df -h "$(dirname "$(sysctl -n kern.corefile)")"
# sudo sysctl -w kern.corefile="/cores/core.%P"
fi
- name: Build and install ATF and Lutok
if: ${{ matrix.build-dependencies-from-source }}
run: |
export PREFIX="${KYUA_PREFIX}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
cd "${ATF_SRCDIR}"
"${KYUA_SRCDIR}/admin/ci-build/00_build_and_install_atf.sh"
rm -Rf "${ATF_SRCDIR}"
cd "${LUTOK_SRCDIR}"
"${KYUA_SRCDIR}/admin/ci-build/00_build_and_install_lutok.sh"
rm -Rf "${LUTOK_SRCDIR}"
- name: Configure
run: |
export PREFIX="${KYUA_PREFIX}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFG_ARGS="--enable-atf --enable-developer"
for i in ${{ join(matrix.sanitize, ' ') }}; do
CFG_ARGS="${CFG_ARGS} --enable-${i}"
done
cd "${KYUA_SRCDIR}"
admin/ci-build/01_configure.sh ${CFG_ARGS}
- name: Distcheck (builds and tests)
timeout-minutes: 30
run: |
export PREFIX="${KYUA_PREFIX}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFG_ARGS="--enable-atf --enable-developer"
for i in ${{ join(matrix.sanitize, ' ') }}; do
CFG_ARGS="${CFG_ARGS} --enable-${i}"
done
# export AS_ROOT=yes
# export UNPRIVILEGED_USER=yes
export RUN_COREDUMP_TESTS="${{ env.RUN_COREDUMP_TESTS }}"
cd "${KYUA_SRCDIR}"
env "EXTRA_DISTCHECK_CONFIGURE_ARGS=${CFG_ARGS}" \
./admin/ci-build/02_distcheck.sh
- name: Gather/Archive Logs and Reports
run: |
REPORTS_DIR="${KYUA_OBJDIR}/reports"
mkdir -p "${REPORTS_DIR}"
(
cd "${REPORTS_DIR}"
mkdir -p build_logs
# Gather the distcheck failure log if the target failed.
# It's easier to ignore the failure than create yet another
# conditional variable step.
cp -a "${KYUA_SRCDIR}"/kyua-*/_build/sub/*.log build_logs/ \
2>/dev/null || true
# Include the raw kyua logs.
cp -a ~/.kyua/logs kyua_logs
# Include the raw kyua results DBs.
cp -a ~/.kyua/store kyua_store
)
# Create an archive of the reports.
job_name_encoded=$(echo "${JOB_NAME}" | tr ' ' '_')
tar -cvf "kyua-test-reports-${job_name_encoded}.tar" \
-C "${REPORTS_DIR}" .
if: ${{ ! cancelled() }}
- name: Archive Build Artifacts
uses: actions/upload-artifact@v4
with:
name: Test Report for ${{ env.JOB_NAME }}
path: kyua-test-reports-*.tar
compression-level: 0
retention-days: 10
overwrite: true
if: ${{ ! cancelled() }}
build-and-test-freebsd:
# yamllint disable-line rule:line-length
name: FreeBSD ${{ matrix.release }} ${{ matrix.compiler }} ${{ join(matrix.sanitize, '+') }}
env:
AR: ${{ matrix.llvm-bindir }}/llvm-ar
CC: ${{ matrix.llvm-bindir }}/clang
CPP: ${{ matrix.llvm-bindir }}/clang-cpp
CXX: ${{ matrix.llvm-bindir }}/clang++
NM: ${{ matrix.llvm-bindir }}/llvm-nm
OBJDUMP: ${{ matrix.llvm-bindir }}/llvm-objdump
RANLIB: ${{ matrix.llvm-bindir }}/llvm-ranlib
STRIP: ${{ matrix.llvm-bindir }}/llvm-strip
ATF_SRCDIR: ${{ github.workspace }}/atf-src
ATF_OBJDIR: ${{ github.workspace }}/atf-obj
KYUA_PREFIX: ${{ github.workspace }}/root
KYUA_SRCDIR: ${{ github.workspace }}/kyua-src
KYUA_OBJDIR: ${{ github.workspace }}/kyua-obj
LUTOK_SRCDIR: ${{ github.workspace }}/lutok-src
LUTOK_OBJDIR: ${{ github.workspace }}/lutok-obj
# yamllint disable-line rule:line-length
JOB_NAME: FreeBSD ${{ matrix.release }} ${{ matrix.compiler }} ${{ join(matrix.sanitize, '+') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# NOTE(ngie):
#
# (This comment is regarding
# `build-dependencies-from-source == "true"`)
#
# Due to conflicts with artifacts shipped with the
# base system vs artifacts available with the images
# provided by vmactions, all dependencies must be built
# from source. This is due to the rate of change, legacy
# code deprecation, and how tightly coupled the
# atf/kyua/lutok projects are, as well as the rate at which
# new metadata and features are being submitted upstream
# without bumping the ATF TP versions and Kyuafile syntax
# versions.
#
# A large part of the pain incurred is due to past
# "laziness"/pragmatism on my part not keeping the software
# in the base system up-to-date with the versions released
# on GitHub. In my defense I was being conservative due to
# https://github.com/freebsd/atf/issues/77 , had less free
# time when cutting past releases, and am technically the
# sole active maintainer of these projects (for better or
# worse *sigh*).
- release: 14.4
build-dependencies-from-source: true
compiler: clang-22
llvm-bindir: /usr/local/llvm22/bin
llvm-version: 22
pkgs:
- autoconf
- automake
- doxygen
- git
- libtool
- llvm22
- lua55
- m4
- pkgconf
- sqlite3
- sudo
- release: 15.1
build-dependencies-from-source: true
compiler: clang-22
llvm-bindir: /usr/local/llvm22/bin
llvm-version: 22
pkgs:
- autoconf
- automake
- doxygen
- git
- libtool
- llvm22
- lua55
- m4
- pkgconf
- sqlite3
- sudo
release:
- 14.4
- 15.1
sanitize:
- ""
- ubsan
steps:
- name: Checking out source (ATF)
if: ${{ matrix.build-dependencies-from-source }}
uses: actions/checkout@v4
with:
repository: "${{ env.ATF_REPO }}"
ref: "${{ env.ATF_REF }}"
path: "${{ env.ATF_SRCDIR }}"
- name: Checking out source (Lutok)
if: ${{ matrix.build-dependencies-from-source }}
uses: actions/checkout@v4
with:
repository: "${{ env.LUTOK_REPO }}"
ref: "${{ env.LUTOK_REF }}"
path: "${{ env.LUTOK_SRCDIR }}"
- name: Checking out source (Kyua)
uses: actions/checkout@v4
with:
path: "${{ env.KYUA_SRCDIR }}"
- name: Build Environment Dump
run: |
echo "uname -a: $(uname -a)"
echo "uname -m: $(uname -m)"
echo "uname -p: $(uname -p)"
- name: Start FreeBSD ${{ matrix.release }} VM
uses: vmactions/freebsd-vm@e9ea2cef1135a17c880e9ed9956c983d58421ece # v1.5.3
with:
envs: 'ATF_SRCDIR KYUA_SRCDIR LUTOK_SRCDIR AR CC CPP CXX NM OBJDUMP RANLIB STRIP JOB_NAME'
prepare: |
cd "${KYUA_SRCDIR}"
# NOTE(ngie): the other repos run
# the `00_prepare_freebsd_image.sh` script in their
# respective repos to pkgbasify FreeBSD 14.x images.
#
# This technically isn't required for this workflow
# since we build and install ATF and lutok from source
# instead of binary packages, like on macOS.
#
# See the `build-dependencies-from-source == "true"`
# comment above for more details.
pkg update
pkg install -y ${{ join(matrix.pkgs, ' ') }}
# Set up sudo no password for :wheel.
echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' > \
/usr/local/etc/sudoers.d/wheel-no-password
release: "${{ matrix.release }}"
# NB: I tried nfs (failed when running chflags) and sshfs
# (could not find files/directories when running configure)
# to no avail here. This may change in the future, but for
# now use rsync.
# - ngie (2026-08-16)
sync: rsync
sync-time: true
- name: Build and install ATF and Lutok
shell: freebsd {0}
if: ${{ matrix.build-dependencies-from-source }}
run: |
export PREFIX="${KYUA_PREFIX}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
cd "${ATF_SRCDIR}"
"${KYUA_SRCDIR}/admin/ci-build/00_build_and_install_atf.sh"
rm -Rf "${ATF_SRCDIR}"
cd "${LUTOK_SRCDIR}"
"${KYUA_SRCDIR}/admin/ci-build/00_build_and_install_lutok.sh"
rm -Rf "${LUTOK_SRCDIR}"
- name: Configure
shell: freebsd {0}
run: |
export PREFIX="${KYUA_PREFIX}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFG_ARGS="--enable-atf --enable-developer"
for i in ${{ join(matrix.sanitize, ' ') }}; do
CFG_ARGS="${CFG_ARGS} --enable-${i}"
done
cd "${KYUA_SRCDIR}"
admin/ci-build/01_configure.sh ${CFG_ARGS}
- name: Distcheck (builds and tests)
timeout-minutes: 30
shell: freebsd {0}
run: |
export PREFIX="${KYUA_PREFIX}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFG_ARGS="--enable-atf --enable-developer"
for i in ${{ join(matrix.sanitize, ' ') }}; do
CFG_ARGS="${CFG_ARGS} --enable-${i}"
done
# export AS_ROOT=yes
# export UNPRIVILEGED_USER=yes
export RUN_COREDUMP_TESTS="${{ env.RUN_COREDUMP_TESTS }}"
cd "${KYUA_SRCDIR}"
env "EXTRA_DISTCHECK_CONFIGURE_ARGS=${CFG_ARGS}" \
./admin/ci-build/02_distcheck.sh
- name: Gather/Archive Logs and Reports
shell: freebsd {0}
run: |
REPORTS_DIR="${KYUA_OBJDIR}/reports"
mkdir -p "${REPORTS_DIR}"
(
cd "${REPORTS_DIR}"
mkdir -p build_logs
# Gather the distcheck failure log if the target failed.
# It's easier to ignore the failure than create yet another
# conditional variable step.
cp -a "${KYUA_SRCDIR}"/kyua-*/_build/sub/*.log build_logs/ \
2>/dev/null || true
# Include the raw kyua logs.
cp -a ~/.kyua/logs kyua_logs
# Include the raw kyua results DBs.
cp -a ~/.kyua/store kyua_store
)
# Create an archive of the reports.
job_name_encoded=$(echo "${JOB_NAME}" | tr ' ' '_')
tar -cvf "kyua-test-reports-${job_name_encoded}.tar" \
-C "${REPORTS_DIR}" .
if: ${{ ! cancelled() }}
- name: Archive Build Artifacts
uses: actions/upload-artifact@v4
with:
name: Test Report for ${{ env.JOB_NAME }}
path: kyua-test-reports-*.tar
compression-level: 0
retention-days: 10
overwrite: true
if: ${{ ! cancelled() }}