Skip to content

Commit ef06f70

Browse files
committed
Add FreeBSD vmactions integration
This change adds vmactions support for running 14.4-RELEASE and 15.1-RELEASE images with the lutok project. Related to: freebsd/atf#180 Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
1 parent fe5115e commit ef06f70

2 files changed

Lines changed: 187 additions & 4 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 161 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
# * Install
1010
# * Run tests
1111
#
12+
# On FreeBSD we build with:
13+
# * latest clang from ports
14+
# * The sanitizer libs for the base system compiler are installed in the
15+
# wrong directory:
16+
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297510 .
17+
# * ld from system
18+
#
1219
# On MacOS we build with:
1320
# * latest clang from brew (system provided clang lacks sanitizers).
1421
# * ld from system
@@ -108,7 +115,7 @@ jobs:
108115
which -a kyua
109116
- name: Configure
110117
run: |
111-
CFG_ARGS="--enable-atf"
118+
CFG_ARGS="--enable-developer"
112119
for i in ${{ join(matrix.sanitize, ' ') }}; do
113120
CFG_ARGS="${CFG_ARGS} --enable-${i}"
114121
done
@@ -122,14 +129,164 @@ jobs:
122129
./admin/ci-build/01_configure.sh ${CFG_ARGS}
123130
- name: Distcheck (builds and tests)
124131
run: |
125-
CFG_ARGS="--disable-dependency-tracking --enable-atf"
132+
CFG_ARGS="--disable-dependency-tracking --enable-developer"
133+
for i in ${{ join(matrix.sanitize, ' ') }}; do
134+
CFG_ARGS="${CFG_ARGS} --enable-${i}"
135+
done
136+
cd "${LUTOK_SRCDIR}"
137+
env "EXTRA_DISTCHECK_CONFIGURE_ARGS=${CFG_ARGS}" \
138+
./admin/ci-build/02_distcheck.sh
139+
- name: Gather/Archive Logs and Reports
140+
run: |
141+
REPORTS_DIR="${LUTOK_OBJDIR}/reports"
142+
mkdir -p "${REPORTS_DIR}"
143+
(
144+
cd "${REPORTS_DIR}"
145+
mkdir -p build_logs
146+
# Gather the distcheck failure log if the target failed.
147+
# It's easier to ignore the failure than create yet another
148+
# conditional variable step.
149+
cp -a "${LUTOK_SRCDIR}"/lutok-*/_build/sub/*.log build_logs/ \
150+
2>/dev/null || true
151+
# Include the raw kyua logs.
152+
cp -a ~/.kyua/logs kyua_logs
153+
# Include the raw kyua results DBs.
154+
cp -a ~/.kyua/store kyua_store
155+
)
156+
# Create an archive of the reports.
157+
job_name_encoded=$(echo "${JOB_NAME}" | tr ' ' '_')
158+
tar -cvf "lutok-test-reports-${job_name_encoded}.tar" \
159+
-C "${REPORTS_DIR}" .
160+
if: ${{ ! cancelled() }}
161+
- name: Archive Build Artifacts
162+
uses: actions/upload-artifact@v4
163+
with:
164+
name: Test Report for ${{ env.JOB_NAME }}
165+
path: lutok-test-reports-*.tar
166+
compression-level: 0
167+
retention-days: 10
168+
overwrite: true
169+
if: ${{ ! cancelled() }}
170+
171+
build-and-test-freebsd:
172+
# yamllint disable-line rule:line-length
173+
name: FreeBSD ${{ matrix.release }} ${{ matrix.compiler }} ${{ join(matrix.sanitize, '+') }}
174+
env:
175+
AR: ${{ matrix.llvm-bindir }}/llvm-ar${{ matrix.llvm-version }}
176+
CC: ${{ matrix.llvm-bindir }}/clang${{ matrix.llvm-version }}
177+
CPP: ${{ matrix.llvm-bindir }}/clang-cpp${{ matrix.llvm-version }}
178+
CXX: ${{ matrix.llvm-bindir }}/clang++${{ matrix.llvm-version }}
179+
NM: ${{ matrix.llvm-bindir }}/llvm-nm${{ matrix.llvm-version }}
180+
# yamllint disable-line rule:line-length
181+
OBJDUMP: ${{ matrix.llvm-bindir }}/llvm-objdump${{ matrix.llvm-version }}
182+
# yamllint disable-line rule:line-length
183+
RANLIB: ${{ matrix.llvm-bindir }}/llvm-ranlib${{ matrix.llvm-version }}
184+
# yamllint disable-line rule:line-length
185+
STRIP: ${{ matrix.llvm-bindir }}/llvm-strip${{ matrix.llvm-version }}
186+
LUTOK_SRCDIR: ${{ github.workspace }}/src
187+
LUTOK_OBJDIR: ${{ github.workspace }}/obj
188+
# yamllint disable-line rule:line-length
189+
JOB_NAME: FreeBSD ${{ matrix.release }} ${{ matrix.compiler }} ${{ join(matrix.sanitize, '+') }}
190+
runs-on: ubuntu-latest
191+
strategy:
192+
fail-fast: false
193+
matrix:
194+
include:
195+
- release: 14.4
196+
compiler: clang-22
197+
llvm-bindir: /usr/local/bin
198+
llvm-version: 22
199+
pkgs:
200+
- autoconf
201+
- automake
202+
- doxygen
203+
- git
204+
- libtool
205+
- llvm22
206+
- lua55
207+
- m4
208+
- pkgconf
209+
- sudo
210+
# kyua is distributed in the FreeBSD-tests package
211+
# on 14.4.
212+
- FreeBSD-atf
213+
- FreeBSD-tests
214+
- release: 15.1
215+
compiler: clang-22
216+
llvm-bindir: /usr/local/bin
217+
llvm-version: 22
218+
pkgs:
219+
- autoconf
220+
- automake
221+
- doxygen
222+
- git
223+
- libtool
224+
- llvm22
225+
- lua55
226+
- m4
227+
- pkgconf
228+
- sudo
229+
- FreeBSD-atf
230+
- FreeBSD-kyua
231+
release:
232+
- 14.4
233+
- 15.1
234+
sanitize:
235+
- ""
236+
- ubsan
237+
238+
steps:
239+
- name: Checking out source
240+
uses: actions/checkout@v4
241+
with:
242+
path: src
243+
- name: Start FreeBSD ${{ matrix.release }} VM
244+
uses: vmactions/freebsd-vm@e9ea2cef1135a17c880e9ed9956c983d58421ece # v1.5.3
245+
with:
246+
envs: 'LUTOK_SRCDIR CC CPP CXX NM OBJDUMP RANLIB STRIP JOB_NAME'
247+
prepare: |
248+
cd "${LUTOK_SRCDIR}"
249+
./admin/ci-build/00_prepare_freebsd_image.sh
250+
pkg update
251+
pkg install -y ${{ join(matrix.pkgs, ' ') }}
252+
# Set up sudo no password for :wheel.
253+
echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' > \
254+
/usr/local/etc/sudoers.d/wheel-no-password
255+
release: "${{ matrix.release }}"
256+
# NB: I tried nfs (failed when running chflags) and sshfs
257+
# (could not find files/directories when running configure)
258+
# to no avail here. This may change in the future, but for
259+
# now use rsync.
260+
# - ngie (2026-08-16)
261+
sync: rsync
262+
sync-time: true
263+
- name: Configure
264+
shell: freebsd {0}
265+
run: |
266+
CFG_ARGS="--enable-developer"
267+
for i in ${{ join(matrix.sanitize, ' ') }}; do
268+
CFG_ARGS="${CFG_ARGS} --enable-${i}"
269+
done
270+
echo "uname -a: $(uname -a)"
271+
echo "uname -m: $(uname -m)"
272+
echo "uname -p: $(uname -p)"
273+
echo "Build environment:"
274+
kyua about | head -1
275+
env
276+
cd "${LUTOK_SRCDIR}"
277+
./admin/ci-build/01_configure.sh ${CFG_ARGS}
278+
- name: Distcheck (builds and tests)
279+
shell: freebsd {0}
280+
run: |
281+
CFG_ARGS="--disable-dependency-tracking --enable-developer"
126282
for i in ${{ join(matrix.sanitize, ' ') }}; do
127283
CFG_ARGS="${CFG_ARGS} --enable-${i}"
128284
done
129285
cd "${LUTOK_SRCDIR}"
130286
env "EXTRA_DISTCHECK_CONFIGURE_ARGS=${CFG_ARGS}" \
131287
./admin/ci-build/02_distcheck.sh
132288
- name: Gather/Archive Logs and Reports
289+
shell: freebsd {0}
133290
run: |
134291
REPORTS_DIR="${LUTOK_OBJDIR}/reports"
135292
mkdir -p "${REPORTS_DIR}"
@@ -139,8 +296,8 @@ jobs:
139296
# Gather the distcheck failure log if the target failed.
140297
# It's easier to ignore the failure than create yet another
141298
# conditional variable step.
142-
cp -a "${LUTOK_SRCDIR}"/lutok-*/_build/sub/*.log \
143-
build_logs/ 2>/dev/null || true
299+
cp -a "${LUTOK_SRCDIR}"/lutok-*/_build/sub/*.log build_logs/ \
300+
2>/dev/null || true
144301
# Include the raw kyua logs.
145302
cp -a ~/.kyua/logs kyua_logs
146303
# Include the raw kyua results DBs.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
#
3+
# Step 0: Prepare the FreeBSD VM image for use.
4+
#
5+
# SPDX-License-Identifier: BSD-2-Clause
6+
7+
set -eux
8+
9+
VERSION_MAJOR="$(uname -r | sed -Ee 's/\..+//')"
10+
if [ "${VERSION_MAJOR}" != 14 ]; then
11+
exit 0
12+
fi
13+
14+
# NO_CHECK_STYLE_BEGIN
15+
pkgbasify_sha256="7f3a4d514c46d03ad52d6689b621f4971ce85db42b1a41cabb18913e593357ad"
16+
pkgbasify_url="https://github.com/FreeBSDFoundation/pkgbasify/raw/refs/tags/v1.1.0/pkgbasify.lua"
17+
# NO_CHECK_STYLE_END
18+
pkgbasify_script="pkgbasify.lua"
19+
fetch -o "${pkgbasify_script}" "${pkgbasify_url}"
20+
chmod +x "${pkgbasify_script}"
21+
sha256 -c "${pkgbasify_sha256}" "${pkgbasify_script}"
22+
pkg update
23+
pkg upgrade -y pkg
24+
yes y | "./${pkgbasify_script}" --force
25+
26+
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4

0 commit comments

Comments
 (0)