-
-
Notifications
You must be signed in to change notification settings - Fork 326
106 lines (92 loc) · 3.5 KB
/
ci_zig.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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.13.0
- run: |
zig build check-fmt
# -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.13.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: 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.13.0
- name: cross compile with llvm
run: |
zig build -Dtarget=${{ matrix.target }} -Dllvm