Skip to content

DRAFT 667 - test zig cross-compile for MacOS #20

DRAFT 667 - test zig cross-compile for MacOS

DRAFT 667 - test zig cross-compile for MacOS #20

# This workflow uses Zig and its excellent cross-compilation support to test
# compiling for multiple platforms. No tests are actually run since it would
# require emulation.
name: zig cross-compile
on: [ push, pull_request ]
jobs:
build:
name: ${{ matrix.ttriple }} thr:${{ matrix.enable_threads }} dll:${{ matrix.shared_libs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# TODO: move from nightly to zig 0.12 final when released.
zig_version: "0.12.0-dev.2076+8fd15c6ca"

Check failure on line 17 in .github/workflows/zig-cross-compile.yml

View workflow run for this annotation

GitHub Actions / zig cross-compile

Invalid workflow file

The workflow is not valid. .github/workflows/zig-cross-compile.yml (Line: 17, Col: 22): Unexpected value '0.12.0-dev.2076+8fd15c6ca'
# Some of the triples are commented out just to speedup this workflow.
ttriple: [
aarch64-linux-gnu,
aarch64-macos-none,
x86_64-macos-none,
]
enable_threads: [ false, true ]
shared_libs: [ false, true ]
include:
# TODO: remove CFLAGS_EXTRA after exception.h, getsect.h added to zig.
- ttriple: aarch64-macos-none
cflags_extra: "-D NO_MPROTECT_VDB -D MISSING_MACH_O_GETSECT_H"
- ttriple: x86_64-macos-none
cflags_extra: "-D NO_MPROTECT_VDB -D MISSING_MACH_O_GETSECT_H"
exclude:
- enable_threads: true
ttriple: wasm32-wasi-musl
# The following ones have some zig link issue.
- shared_libs: true
ttriple: aarch64_be-linux-gnu
- shared_libs: true
ttriple: aarch64_be-linux-musl
- shared_libs: true
ttriple: armeb-linux-gnueabi
- shared_libs: true
ttriple: armeb-linux-gnueabihf
- shared_libs: true
ttriple: armeb-linux-musleabi
- shared_libs: true
ttriple: armeb-linux-musleabihf
- shared_libs: true
ttriple: mips64-linux-gnuabin32
- shared_libs: true
ttriple: mips64el-linux-gnuabin32
- shared_libs: true
ttriple: powerpc-linux-gnueabi
- shared_libs: true
ttriple: powerpc-linux-gnueabihf
- shared_libs: true
ttriple: sparc64-linux-gnu # FIXME: recompile with -fPIC
- shared_libs: true
ttriple: thumb-linux-gnueabi
- shared_libs: true
ttriple: thumb-linux-gnueabihf
- shared_libs: true
ttriple: x86_64-linux-gnux32 # FIXME: recompile with -fPIC
# TODO: move from nightly to zig 0.12 final when released.
steps:
- uses: actions/checkout@v4
- name: "Install zig"
run: |
mkdir zig && curl https://ziglang.org/builds/zig-linux-x86_64-${{matrix.zig_version}}.tar.xz | tar Jx --directory=zig --strip-components=1
- name: Build
run: >
zig/zig build -Dtarget=${{ matrix.ttriple }}
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-DCFLAGS_EXTRA=${{ matrix.cflags_extra }}
-Denable_threads=${{ matrix.enable_threads }}