Skip to content
Closed
64 changes: 64 additions & 0 deletions .github/workflows/test_other_platforms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test on other platforms

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
freebsd:
name: FreeBSD ${{ matrix.release }}
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
release: ["15.1", "13.5"]

steps:
- name: Checkout MoarVM
uses: actions/checkout@v7
with:
path: MoarVM
submodules: recursive
fetch-depth: 0
fetch-tags: true
persist-credentials: false

- name: Build and probe in FreeBSD
uses: vmactions/freebsd-vm@v1
with:
release: ${{ matrix.release }}
usesh: true
copyback: false
cache-after-prepare: true
prepare: |
pkg install -y perl5 gmake git-lite
run: |
set -e
git config --global --add safe.directory '*'
cd MoarVM

perl -0pi -e 's|#include <util\.h>|#if defined(__FreeBSD__)\n#include <libutil.h>\n#else\n#include <util.h>\n#endif|' \
3rdparty/libuv/src/unix/process.c

echo "===== patch FreeBSD syslibs: add util ====="
perl -0pi -e 's/(%OS_FREEBSD = \(.*?qw\( kvm) \)/$1 util )/s' build/setup.pm
echo "--- FreeBSD block now reads: ---"
perl -0ne 'print $1 if /(my %OS_FREEBSD = \(.*?\n\);)/s' build/setup.pm

echo "===== build ====="
perl Configure.pl --toolchain=gnu --compiler=clang --prefix=../install
gmake install
../install/bin/moar --version

echo "===== does libmoar.so link libutil now? ====="
ldd ../install/lib/libmoar.so | grep libutil && echo "LINKED: libutil" || echo "STILL NOT LINKED"
echo "===== is openpty still unresolved? ====="
nm -D --undefined-only ../install/lib/libmoar.so | grep -w openpty \
&& echo "still listed as undefined (expected: it now resolves via libutil at runtime)" \
|| echo "openpty no longer undefined"