Skip to content

feat: Zig 0.16.0 compatibility #90

feat: Zig 0.16.0 compatibility

feat: Zig 0.16.0 compatibility #90

name: "Burrito Cross Build Build Tests"
on:
pull_request:
push:
branches: [main]
jobs:
build_examples:
name: build_examples_${{ matrix.host }}_${{ matrix.zig }}
runs-on: ${{ matrix.host }}
strategy:
fail-fast: false
matrix:
host: [ubuntu-latest, macos-latest, macos-14] # macos-14 is arm64
zig: ["0.15.2", "0.16.0"]
exclude:
# macos-14 (arm64) is only needed to verify cross-compile from
# Apple Silicon. Skip the old Zig version there to save CI time.
- host: macos-14
zig: "0.15.2"
steps:
# Deps
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
if: matrix.host == 'ubuntu-latest'
with:
otp-version: "27.3"
elixir-version: "1.18.3"
- uses: erlef/setup-beam@v1
if: matrix.host == 'macos-latest' || matrix.host == 'macos-14'
with:
otp-version: "27.3"
elixir-version: "1.18.3"
- uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ matrix.zig }}
- name: Set up Homebrew
if: matrix.host == 'macos-latest' || matrix.host == 'macos-14'
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- run: sudo apt-get -y install xz-utils
if: matrix.host == 'ubuntu-latest'
- run: brew install elixir xz
if: matrix.host == 'macos-latest' || matrix.host == 'macos-14'
# Restore Cache
- uses: actions/cache/restore@v3
if: matrix.host == 'ubuntu-latest'
id: cache-restore-linux
with:
path: /home/runner/.cache/burrito_file_cache/
key: burrito-download-cache_${{ matrix.host }}_${{ matrix.zig }}
- uses: actions/cache/restore@v3
if: matrix.host == 'macos-latest'
id: cache-restore-macos-intel
with:
path: /Users/runner/Library/Caches/burrito_file_cache/
key: burrito-download-cache_${{ matrix.host }}_${{ matrix.zig }}
- uses: actions/cache/restore@v3
if: matrix.host == 'macos-14'
id: cache-restore-macos-arm
with:
path: /Users/runner/Library/Caches/burrito_file_cache/
key: burrito-download-cache_${{ matrix.host }}_${{ matrix.zig }}
# Build Example CLI App
- name: cli_example
working-directory: "./examples/cli_example"
run: "mix deps.get && mix release"
# Save Cache (Linux)
- uses: actions/cache/save@v3
if: matrix.host == 'ubuntu-latest'
id: cache-save-linux
with:
path: /home/runner/.cache/burrito_file_cache/
key: burrito-download-cache_${{ matrix.host }}_${{ matrix.zig }}
# Save Cache (macOS)
- uses: actions/cache/save@v3
if: matrix.host == 'macos-latest'
id: cache-save-macos-intel
with:
path: /Users/runner/Library/Caches/burrito_file_cache/
key: burrito-download-cache_${{ matrix.host }}_${{ matrix.zig }}
- uses: actions/cache/save@v3
if: matrix.host == 'macos-14'
id: cache-save-macos-arm
with:
path: /Users/runner/Library/Caches/burrito_file_cache/
key: burrito-download-cache_${{ matrix.host }}_${{ matrix.zig }}
# Upload Wrapped Binaries
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: burrito_${{ matrix.host }}_${{ matrix.zig }}_host_bins
path: ./examples/**/burrito_out/*
retention-days: 1
#### Run example binaries ####
# Windows binaries: built on Linux/macOS hosts, run on windows-latest
run_examples_windows:
needs: build_examples
strategy:
fail-fast: false
matrix:
host: [ubuntu-latest, macos-latest]
zig: ["0.15.2", "0.16.0"]
runs-on: windows-latest
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: burrito_${{ matrix.host }}_${{ matrix.zig }}_host_bins
- run: cli_example/burrito_out/example_cli_app_windows.exe
run_examples_linux:
needs: build_examples
strategy:
fail-fast: false
matrix:
host: [ubuntu-latest, macos-latest, macos-14]
zig: ["0.15.2", "0.16.0"]
runs-on: ubuntu-latest
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: burrito_${{ matrix.host }}_${{ matrix.zig }}_host_bins
- run: chmod +x cli_example/burrito_out/example_cli_app_linux
- run: cli_example/burrito_out/example_cli_app_linux
run_examples_macos:
needs: build_examples
strategy:
fail-fast: false
matrix:
host: [ubuntu-latest, macos-latest, macos-14]
zig: ["0.15.2", "0.16.0"]
runs-on: ${{ matrix.host == 'macos-14' && 'macos-14' || 'macos-latest' }}
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: burrito_${{ matrix.host }}_${{ matrix.zig }}_host_bins
- run: chmod +x cli_example/burrito_out/example_cli_app_macos
- run: cli_example/burrito_out/example_cli_app_macos