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
# a push or pull request that only changes docs, the site or the devlog skips
# this run; deploy-website.yml and publish-standard-records.yml cover those.
when:
- event: ["push", "pull_request"]
branch: main
paths: ["src/**", "scripts/**", "pbt/**", "examples/**", build.zig, build.zig.zon, justfile, .tangled/workflows/ci.yml]
engine: nixery
dependencies:
nixpkgs:
- coreutils
- curl
- gnutar
- xz
- git
- bash
# saving the cache below needs zstd in the image
- zstd
environment:
ZIG_GLOBAL_CACHE_DIR: /tangled/workspace/.ci-cache/global
# the pinned compiler and zig's package cache persist between runs, so a run
# neither downloads the compiler nor refetches dependencies from tangled.org.
# the compiled build cache is left out: zig 0.17 rebuilds it after a restore.
cache:
- key: zig
hash:
- build.zig.zon
- scripts/ci-zig.sh
fallback: true
compression-level: 1
when: always
paths:
- .zig
- .ci-cache/global/p
steps:
- name: install pinned zig
command: scripts/ci-zig.sh /tangled/workspace/.zig
- name: fetch dependencies
command: |
# tangled.org rate-limits archive downloads; three workflows fetching at
# once on every push has tripped it. retry with backoff before building.
ok=0
for attempt in 1 2 3 4 5; do
if /tangled/workspace/.zig/zig build --fetch; then ok=1; break; fi
echo "dependency fetch attempt $attempt failed; retrying" >&2
sleep $((attempt * 15))
done
[ "$ok" = 1 ]
- name: check formatting and import paths
command: |
/tangled/workspace/.zig/zig build check
- name: run tests
command: |
/tangled/workspace/.zig/zig build test --summary all
- name: compile tests for 32-bit arm (no 64-bit atomics)
command: |
/tangled/workspace/.zig/zig build test -Dtarget=arm-linux-musleabihf -Dcpu=arm1176jzf_s --summary all
- name: property campaigns with reach checks
command: |
export PATH="/tangled/workspace/.zig:$PATH"
for name in mst codecs runtime xrpc identity firehose oauth permissions; do
scripts/campaign run "$name" --out "/tmp/zat-$name" || { tail -n 40 /tmp/zat-$name/*.stderr.log; exit 1; }
done