-
-
Notifications
You must be signed in to change notification settings - Fork 40
95 lines (88 loc) · 2.99 KB
/
Copy pathci.yml
File metadata and controls
95 lines (88 loc) · 2.99 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
name: CI
# PR / manual: three native test jobs (no skipped rows). Push to main: Linux-only (fast).
on:
push:
branches: [main]
paths-ignore:
- "doc/**"
- "README.md"
- "**.md"
- "LICENSE**"
pull_request:
paths-ignore:
- "doc/**"
- "README.md"
- "**.md"
- "LICENSE**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ZIG_VERSION: "0.16.0"
jobs:
test:
name: Tests (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include: ${{ github.event_name == 'push' && fromJSON('[{"os":"ubuntu-latest","name":"Linux"}]') || fromJSON('[{"os":"ubuntu-latest","name":"Linux"},{"os":"windows-latest","name":"Windows"},{"os":"macos-14","name":"macOS"}]') }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Pre-create Zig global cache tmp/
shell: bash
run: mkdir -p "$GITHUB_WORKSPACE/zig-global-cache/tmp"
- uses: mlugg/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
cache-key: ${{ hashFiles('build.zig.zon') }}
# Zig 0.16's HTTP client doesn't retry on `HttpConnectionClosing` from
# GitHub. Pre-fetch all deps in a retry loop, separate from the build, so
# the loop only re-runs the network step. After this step `zig build` runs
# offline against the populated global cache.
- name: Fetch dependencies (with retries)
shell: bash
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache
run: |
n=0
until [ "$n" -ge 5 ]; do
zig build --fetch && break
n=$((n+1))
echo "Fetch attempt $n failed, sleeping $((n*10))s before retry..."
sleep $((n*10))
done
if [ "$n" -ge 5 ]; then
echo "All fetch attempts failed"; exit 1
fi
- name: Run tests
shell: bash
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache
run: zig build test --summary all
- name: Fetch wasm dependencies (with retries)
shell: bash
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache
run: |
n=0
until [ "$n" -ge 5 ]; do
zig build --fetch -Dtarget=wasm32-freestanding && break
n=$((n+1))
echo "Fetch attempt $n failed, sleeping $((n*10))s before retry..."
sleep $((n*10))
done
if [ "$n" -ge 5 ]; then
echo "All fetch attempts failed"; exit 1
fi
- name: Compile web (wasm) build
shell: bash
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache
run: zig build check-web
- name: Verify SDK version / ABI fingerprint lock
shell: bash
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache
run: zig build test-sdk-version --summary all