Skip to content

Commit 9b3123f

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 9b3123f

2 files changed

Lines changed: 186 additions & 4 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 160 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-atf --enable-developer"
112119
for i in ${{ join(matrix.sanitize, ' ') }}; do
113120
CFG_ARGS="${CFG_ARGS} --enable-${i}"
114121
done
@@ -122,14 +129,163 @@ 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+
# ATF and kyua are distributed in the FreeBSD-tests
211+
# package on 14.4.
212+
- FreeBSD-tests
213+
- release: 15.1
214+
compiler: clang-22
215+
llvm-bindir: /usr/local/bin
216+
llvm-version: 22
217+
pkgs:
218+
- autoconf
219+
- automake
220+
- doxygen
221+
- git
222+
- libtool
223+
- llvm22
224+
- lua55
225+
- m4
226+
- pkgconf
227+
- sudo
228+
- FreeBSD-atf
229+
- FreeBSD-kyua
230+
release:
231+
- 14.4
232+
- 15.1
233+
sanitize:
234+
- ""
235+
- ubsan
236+
237+
steps:
238+
- name: Checking out source
239+
uses: actions/checkout@v4
240+
with:
241+
path: src
242+
- name: Start FreeBSD ${{ matrix.release }} VM
243+
uses: vmactions/freebsd-vm@e9ea2cef1135a17c880e9ed9956c983d58421ece # v1.5.3
244+
with:
245+
envs: 'LUTOK_SRCDIR CC CPP CXX NM OBJDUMP RANLIB STRIP JOB_NAME'
246+
prepare: |
247+
cd "${LUTOK_SRCDIR}"
248+
./admin/ci-build/00_prepare_freebsd_image.sh
249+
pkg update
250+
pkg install -y ${{ join(matrix.pkgs, ' ') }}
251+
# Set up sudo no password for :wheel.
252+
echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' > \
253+
/usr/local/etc/sudoers.d/wheel-no-password
254+
release: "${{ matrix.release }}"
255+
# NB: I tried nfs (failed when running chflags) and sshfs
256+
# (could not find files/directories when running configure)
257+
# to no avail here. This may change in the future, but for
258+
# now use rsync.
259+
# - ngie (2026-08-16)
260+
sync: rsync
261+
sync-time: true
262+
- name: Configure
263+
shell: freebsd {0}
264+
run: |
265+
CFG_ARGS="--enable-atf --enable-developer"
266+
for i in ${{ join(matrix.sanitize, ' ') }}; do
267+
CFG_ARGS="${CFG_ARGS} --enable-${i}"
268+
done
269+
echo "uname -a: $(uname -a)"
270+
echo "uname -m: $(uname -m)"
271+
echo "uname -p: $(uname -p)"
272+
echo "Build environment:"
273+
kyua about | head -1
274+
env
275+
cd "${LUTOK_SRCDIR}"
276+
./admin/ci-build/01_configure.sh ${CFG_ARGS}
277+
- name: Distcheck (builds and tests)
278+
shell: freebsd {0}
279+
run: |
280+
CFG_ARGS="--disable-dependency-tracking --enable-developer"
126281
for i in ${{ join(matrix.sanitize, ' ') }}; do
127282
CFG_ARGS="${CFG_ARGS} --enable-${i}"
128283
done
129284
cd "${LUTOK_SRCDIR}"
130285
env "EXTRA_DISTCHECK_CONFIGURE_ARGS=${CFG_ARGS}" \
131286
./admin/ci-build/02_distcheck.sh
132287
- name: Gather/Archive Logs and Reports
288+
shell: freebsd {0}
133289
run: |
134290
REPORTS_DIR="${LUTOK_OBJDIR}/reports"
135291
mkdir -p "${REPORTS_DIR}"
@@ -139,8 +295,8 @@ jobs:
139295
# Gather the distcheck failure log if the target failed.
140296
# It's easier to ignore the failure than create yet another
141297
# conditional variable step.
142-
cp -a "${LUTOK_SRCDIR}"/lutok-*/_build/sub/*.log \
143-
build_logs/ 2>/dev/null || true
298+
cp -a "${LUTOK_SRCDIR}"/lutok-*/_build/sub/*.log build_logs/ \
299+
2>/dev/null || true
144300
# Include the raw kyua logs.
145301
cp -a ~/.kyua/logs kyua_logs
146302
# 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)