ci: Add macOS build to GitHub Actions

The codebase already has macOS support (dylib flags in the Makefile,
macOS linker handling in meson.build), but CI only tests Linux,
Windows, and FreeBSD.  This means macOS regressions go unnoticed
until a user reports them.

Add a build-macos job that tests both Make and Meson builds on
macos-latest.  The runner ships with clang, flex, bison, python3,
and git; only libyaml, swig, meson, ninja, and pkg-config are
installed via Homebrew.

Apple Clang uses -Wsign-compare by default, which trips on some lex
generated code.  Suppress the warning for the two flex-generated
objects.

We skip tests for now, because trees.S doesn't work with the MacOS
assembler.

Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2026-05-26 15:41:25 +10:00
parent 1aaa44849b
commit 83cdc93ca9
2 changed files with 36 additions and 0 deletions

View file

@ -71,6 +71,37 @@ jobs:
- name: Run check - name: Run check
run: if ! meson test -C build; then cat build/meson-logs/testlog.txt; false; fi run: if ! meson test -C build; then cat build/meson-logs/testlog.txt; false; fi
build-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
build: [ "make", "meson" ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |
brew install libyaml swig meson ninja pkg-config
- name: Build (Make)
if: matrix.build == 'make'
run: |
make
- name: Setup (Meson)
if: matrix.build == 'meson'
run: meson setup -D python=enabled -D yaml=enabled -D tests=false build
- name: Build (Meson)
if: matrix.build == 'meson'
run: meson compile -C build
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest
strategy: strategy:

View file

@ -153,6 +153,11 @@ include Makefile.convert-dtsv0
include Makefile.dtc include Makefile.dtc
include Makefile.utils include Makefile.utils
# Flex-generated source triggers -Wsign-compare in its templates
dtc-lexer.lex.o: CFLAGS += -Wno-sign-compare
convert-dtsv0-lexer.lex.o: CFLAGS += -Wno-sign-compare
BIN += convert-dtsv0 BIN += convert-dtsv0
BIN += dtc BIN += dtc
BIN += fdtdump BIN += fdtdump