mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
128 lines
4.2 KiB
YAML
128 lines
4.2 KiB
YAML
on:
|
||
workflow_call:
|
||
|
||
name: CI New Compiler
|
||
|
||
jobs:
|
||
check-zig:
|
||
runs-on: ubuntu-22.04
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
- uses: mlugg/setup-zig@v1
|
||
with:
|
||
version: 0.14.0
|
||
|
||
- name: zig lints
|
||
run: |
|
||
./ci/zig_lints.sh
|
||
|
||
zig build check-fmt
|
||
|
||
- name: zig check
|
||
run: |
|
||
# -Dllvm incurs a costly download step, leave that for later.
|
||
# Just the do super fast check step for now.
|
||
zig build check -Dfuzz
|
||
|
||
zig-tests:
|
||
needs: check-zig
|
||
runs-on: ${{ matrix.os }}
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
os: [macos-13, macos-14, ubuntu-22.04, ubuntu-24.04-arm, windows-2022] # macos-13 uses x64, macos-14 uses arm64
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
- uses: mlugg/setup-zig@v1
|
||
with:
|
||
version: 0.14.0
|
||
|
||
- name: build roc
|
||
run: |
|
||
zig build -Dllvm -Dfuzz
|
||
|
||
- name: roc executable minimal check (Unix)
|
||
if: runner.os != 'Windows'
|
||
run: |
|
||
./zig-out/bin/roc -h | grep -q "Usage:"
|
||
|
||
- name: roc executable minimal check (Windows)
|
||
if: runner.os == 'Windows'
|
||
run: |
|
||
zig-out\bin\roc.exe -h | findstr "Usage:"
|
||
|
||
- name: zig tests
|
||
run: |
|
||
zig build test -Dllvm -Dfuzz
|
||
|
||
- name: zig snapshot tests
|
||
run: zig build snapshot
|
||
|
||
- name: Check for snapshot changes
|
||
run: |
|
||
git diff --exit-code src/snapshots || {
|
||
echo ""
|
||
echo ""
|
||
echo "OOPS! It looks like the snapshots in 'src/snapshots' have changed.";
|
||
echo "Please run 'zig build snapshot' locally, review the updates, and commit the changes.";
|
||
echo "Here’s what changed:";
|
||
echo ""
|
||
git diff src/snapshots;
|
||
exit 1;
|
||
}
|
||
|
||
- name: check if statically linked (ubuntu)
|
||
if: startsWith(matrix.os, 'ubuntu')
|
||
run: |
|
||
file ./zig-out/bin/roc | grep "statically linked"
|
||
|
||
- name: check if statically linked (macOS)
|
||
if: startsWith(matrix.os, 'macos')
|
||
run: |
|
||
otool_out="$(otool -L ./zig-out/bin/roc)"
|
||
num_lines=$(echo "$otool_out" | wc -l)
|
||
if [ "$num_lines" -ne 2 ]; then
|
||
echo "$otool_out"
|
||
echo "Looks like you added a new dynamic dependency to the Roc executable, we want Roc to be super easy to install, so libSystem should be the only dynamic dependency."
|
||
exit 1
|
||
fi
|
||
|
||
- name: check if statically linked (Windows)
|
||
if: startsWith(matrix.os, 'windows')
|
||
run: |
|
||
$imports = (Get-Command zig-out\bin\roc.exe).FileVersionInfo.ImportCharacterSet
|
||
if ($imports) {
|
||
echo "Looks like the executable has dynamic dependencies. We want Roc to be super easy to install, so it should be statically linked."
|
||
echo "Dynamic dependencies found:"
|
||
$imports | ForEach-Object { echo " $_" }
|
||
exit 1
|
||
}
|
||
|
||
zig-cross-compile:
|
||
needs: check-zig
|
||
runs-on: ubuntu-24.04
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
target:
|
||
- aarch64-linux-musl
|
||
- aarch64-macos-none
|
||
- aarch64-windows-gnu
|
||
- arm-linux-musleabihf
|
||
- x86-linux-musl
|
||
- x86_64-linux-musl
|
||
- x86_64-macos-none
|
||
- x86_64-windows-gnu
|
||
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
- uses: mlugg/setup-zig@v1
|
||
with:
|
||
version: 0.14.0
|
||
|
||
- name: cross compile with llvm
|
||
run: |
|
||
zig build -Dtarget=${{ matrix.target }} -Dllvm
|