Skip to content

Commit

Permalink
GH Actions: Initial setup of cross-build using Zig
Browse files Browse the repository at this point in the history
PR #598 (bdwgc).

zig-xbuild uses zig to cross-compile for different platforms; we do not
actually run the tests as that would require emulation.
  • Loading branch information
plajjan authored and ivmai committed Dec 24, 2023
1 parent 2666e3e commit 8a3ebe7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/zig-xbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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:
ttriple: [ aarch64-linux-musl, riscv64-linux-musl, x86_64-linux-musl, x86_64-linux-gnu.2.27, x86_64-windows-gnu, wasm32-wasi ]
shared_libs: [ false, true ]
enable_threads: [ false, true ]
exclude:
- ttriple: wasm32-wasi
enable_threads: true

# TODO: move from nightly to zig 0.12 when released.
steps:
- uses: actions/checkout@v4
- name: "Install zig"
run: |
mkdir zig && curl https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.1814+5c0d58b71.tar.xz | tar Jx --directory=zig --strip-components=1
- name: Build
run: >
zig/zig build -Dtarget=${{ matrix.ttriple }}
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-Denable_threads=${{ matrix.enable_threads }}

0 comments on commit 8a3ebe7

Please sign in to comment.