-
-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (117 loc) · 3.9 KB
/
ci.yml
File metadata and controls
121 lines (117 loc) · 3.9 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-macos:
runs-on: macos-14 # Apple Silicon (M1)
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Run tests
run: zig build test
- name: Build ReleaseSafe
run: zig build -Doptimize=ReleaseSafe
- name: Smoke test
run: |
./zig-out/bin/cljw -e '(+ 1 2 3)'
./zig-out/bin/cljw -e '(println "CI pass")'
- name: Binary size check
run: |
SIZE=$(stat -f%z zig-out/bin/cljw)
SIZE_MB=$(echo "scale=2; $SIZE / 1048576" | bc)
echo "Binary size: ${SIZE_MB}MB ($SIZE bytes)"
# Threshold: 4.8MB (baseline ~4.5MB, see .dev/baselines.md)
if [ "$SIZE" -gt 5033164 ]; then
echo "FAIL: Binary size ${SIZE_MB}MB exceeds 4.8MB threshold"
exit 1
fi
- name: E2E tests
run: bash test/e2e/run_e2e.sh
- name: Deps E2E tests
run: bash test/e2e/deps/run_deps_e2e.sh
- name: Benchmark smoke test
run: |
echo "Running benchmark smoke tests (10s timeout per benchmark)..."
# macOS doesn't have GNU timeout; use perl-based fallback
run_with_timeout() {
perl -e 'alarm 10; exec @ARGV' -- "$@"
}
PASS=0
FAIL=0
for dir in bench/benchmarks/*/; do
[ -f "$dir/bench.clj" ] || continue
name=$(basename "$dir" | sed 's/^[0-9]*_//')
# Skip wasm benchmarks (require wasm test files)
case "$name" in wasm_*) continue ;; esac
printf " %-24s " "$name"
if run_with_timeout ./zig-out/bin/cljw "$dir/bench.clj" >/dev/null 2>&1; then
echo "OK"
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi
done
echo ""
echo "Benchmarks: $PASS passed, $FAIL failed"
if [ "$FAIL" -gt 0 ]; then
exit 1
fi
test-linux:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Run tests
run: zig build test
- name: Build ReleaseSafe
run: zig build -Doptimize=ReleaseSafe
- name: Smoke test
run: |
./zig-out/bin/cljw -e '(+ 1 2 3)'
./zig-out/bin/cljw -e '(println "CI pass")'
- name: Binary size check
run: |
RAW_SIZE=$(stat -c%s zig-out/bin/cljw)
RAW_MB=$(echo "scale=2; $RAW_SIZE / 1048576" | bc)
echo "Binary size (raw): ${RAW_MB}MB ($RAW_SIZE bytes)"
# Linux ELF includes debug info in ReleaseSafe; check stripped size
cp zig-out/bin/cljw /tmp/cljw_stripped
strip /tmp/cljw_stripped
SIZE=$(stat -c%s /tmp/cljw_stripped)
SIZE_MB=$(echo "scale=2; $SIZE / 1048576" | bc)
echo "Binary size (stripped): ${SIZE_MB}MB ($SIZE bytes)"
# Threshold: 4.8MB stripped (baseline ~4.5MB, see .dev/baselines.md)
if [ "$SIZE" -gt 5033164 ]; then
echo "FAIL: Stripped binary ${SIZE_MB}MB exceeds 4.8MB threshold"
exit 1
fi
- name: E2E tests
run: bash test/e2e/run_e2e.sh
- name: Deps E2E tests
run: bash test/e2e/deps/run_deps_e2e.sh
cross-compile:
runs-on: ubuntu-24.04
strategy:
matrix:
target:
- x86_64-linux-gnu
- aarch64-linux-gnu
- x86_64-macos-none
- aarch64-macos-none
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Cross-compile
run: zig build -Dtarget=${{ matrix.target }} -Doptimize=ReleaseSafe
- name: Check binary
run: file zig-out/bin/cljw && ls -lh zig-out/bin/cljw