diff --git a/.github/workflows/kernel-unit-tests.yml b/.github/workflows/kernel-unit-tests.yml index 2e49ad02..524dfce1 100644 --- a/.github/workflows/kernel-unit-tests.yml +++ b/.github/workflows/kernel-unit-tests.yml @@ -9,8 +9,9 @@ # # dynpriv-lint (fast gate) # │ -# ▼ -# build (4 jobs: arch × mode) +# ├──────────────────────────────┐ +# ▼ ▼ +# build (4 jobs: arch × mode) macos-tests (2 jobs: arch) # │ # ▼ # unit-tests (2 jobs: arch) @@ -139,6 +140,95 @@ jobs: fi echo "Kernel ELF: $(ls -lh "$elf")" + # ============================================================================ + # macOS Host Build + Unit Tests (arm64 runner, arch matrix) + # ============================================================================ + + macos-tests: + name: macos-tests (${{ matrix.arch }}) + runs-on: macos-15 + needs: dynpriv-lint + timeout-minutes: 45 + + strategy: + fail-fast: false + matrix: + arch: [x86_64, aarch64] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Runner diagnostics + run: | + sw_vers + sysctl -n machdep.cpu.brand_string hw.ncpu hw.memsize + df -h / | tail -1 + + - name: Install build dependencies + run: | + make deps + brew install python@3.12 + + - name: Fetch Limine EFI binaries + run: make limine + + - name: Cache musl sysroot + uses: actions/cache@v4 + id: musl-cache + with: + path: userland/sysroot + key: macos-musl-sysroot-1.2.5-v2 + + - name: Build musl libc + if: steps.musl-cache.outputs.cache-hit != 'true' + run: make musl + + - name: Cache libc++ sysroot + uses: actions/cache@v4 + id: libcxx-cache + with: + path: | + userland/sysroot/x86_64/lib/libc++.a + userland/sysroot/x86_64/lib/libc++abi.a + userland/sysroot/x86_64/lib/libunwind.a + userland/sysroot/x86_64/include/c++ + userland/sysroot/aarch64/lib/libc++.a + userland/sysroot/aarch64/lib/libc++abi.a + userland/sysroot/aarch64/lib/libunwind.a + userland/sysroot/aarch64/include/c++ + key: macos-libcxx-sysroot-18.1.8-v2 + + - name: Build libc++ + if: steps.libcxx-cache.outputs.cache-hit != 'true' + run: make libcxx + + - name: Cache compiler-rt builtins + uses: actions/cache@v4 + id: compiler-rt-cache + with: + path: | + userland/sysroot/x86_64/lib/libclang_rt.builtins-x86_64.a + userland/sysroot/aarch64/lib/libclang_rt.builtins-aarch64.a + key: macos-compiler-rt-builtins-18.1.8-v2 + + - name: Build compiler-rt builtins + if: steps.compiler-rt-cache.outputs.cache-hit != 'true' + run: make compiler-rt + + - name: Run unit tests + env: + STLX_TEST_TIMEOUT: "300" + run: make test ARCH=${{ matrix.arch }} 2>&1 | tee test-log-macos-${{ matrix.arch }}.txt + + - name: Upload test log + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-log-macos-${{ matrix.arch }} + path: test-log-macos-${{ matrix.arch }}.txt + if-no-files-found: ignore + # ============================================================================ # Unit Tests (arch matrix) # ============================================================================ diff --git a/userland/apps/python/patches/0002-skip-checksharedmods-on-cross-host.patch b/userland/apps/python/patches/0002-skip-checksharedmods-on-cross-host.patch new file mode 100644 index 00000000..a2c223a6 --- /dev/null +++ b/userland/apps/python/patches/0002-skip-checksharedmods-on-cross-host.patch @@ -0,0 +1,20 @@ +Skip the host-side shared-module check when cross-compiling from a +non-Linux host. The check runs the build interpreter with PYTHONPATH +pointing into the cross-build tree, so importing its own dependencies +(e.g. math) can dlopen cross-built Linux ELF modules and crash on +macOS. On Linux hosts the check runs unchanged. + +--- a/Tools/build/check_extension_modules.py ++++ b/Tools/build/check_extension_modules.py +@@ -18,6 +18,11 @@ Module information is parsed from several sources: + + See --help for more information + """ ++import sys ++ ++if not sys.platform.startswith("linux"): ++ raise SystemExit(0) ++ + import argparse + import collections + import enum