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
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
profile=${1:-ci}
if [[ $# -gt 1 || ( "$profile" != ci && "$profile" != release ) ]]; then
echo 'usage: checks/run [ci|release]' >&2
exit 2
fi
zig=${ZIG:-zig}
results="checks/results/$profile"
mkdir -p "$results" zig-out/bin
jq -n \
--arg commit "$(git rev-parse HEAD)" \
--arg status "$(git status --porcelain)" \
--arg profile "$profile" \
--arg zig "$("$zig" version)" \
--arg go "$(go version)" \
--arg platform "$(uname -sm)" \
--arg date "$(date -u +%FT%TZ)" \
--arg upstream "$(cd checks && go list -m github.com/bluesky-social/jetstream)" \
--argjson cpus "$(nproc)" \
'{commit: $commit, dirty: ($status != ""), profile: $profile,
zig: $zig, go: $go, platform: $platform, logical_cpus: $cpus,
upstream: $upstream, started_at: $date, optimize: "ReleaseSafe"}' \
| tee "$results/metadata.json"
failed=0
run() {
local name=$1
shift
echo "CHECK $name"
if "$@" > "$results/$name.log" 2>&1; then
cat "$results/$name.log"
echo "PASS $name"
else
cat "$results/$name.log"
echo "FAIL $name" >&2
failed=1
fi
}
measure() {
local name=$1
shift
echo "CHECK $name"
if zig-out/bin/conformance "$@" > "$results/$name.json" 2> "$results/$name.log"; then
cat "$results/$name.log" "$results/$name.json"
echo "PASS $name"
else
cat "$results/$name.log" "$results/$name.json"
echo "FAIL $name" >&2
failed=1
fi
}
run format "$zig" fmt --check build.zig build.zig.zon src examples checks/client.zig
run whitespace git diff --check
run go-checks bash -c 'cd checks && test -z "$(gofmt -l .)" && go vet ./...'
run debug "$zig" build test --summary all
run release-safe "$zig" build test -Doptimize=ReleaseSafe --summary all
run examples "$zig" build -Doptimize=ReleaseSafe
"$zig" build check-client -Doptimize=ReleaseSafe
(cd checks && go build -mod=readonly -o ../zig-out/bin/conformance .)
measure conformance
if [[ "$profile" == ci ]]; then
measure live load ci
measure catchup catchup ci
else
measure live load
measure catchup catchup
fi
measure regressions regressions
exit "$failed"