-
Notifications
You must be signed in to change notification settings - Fork 10
149 lines (144 loc) · 5.54 KB
/
Copy pathci.yml
File metadata and controls
149 lines (144 loc) · 5.54 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check-matrix:
name: check / ${{ matrix.os }} / ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
name: [default, wasm-false, libusb-false]
include:
- name: default
zig_args: ""
- name: wasm-false
zig_args: -Dwasm=false
- name: libusb-false
zig_args: -Dlibusb=false
steps:
- uses: actions/checkout@v4
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Install system dependencies
if: matrix.name != 'libusb-false'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libusb-1.0-0-dev
# Three separate `zig build` processes (Option C from PR #166 fc4937b)
# to avoid Zig issue #22453 inter-step flock contention. Each process
# has its own .zig-cache lock space.
# NOTE: -j1 was tried (commits 9892e14 + 0e330b9) but caused a separate
# Zig scheduler deadlock — empirically reproduced in container. The real
# CI hang was a test-level blocking-pipe issue (TP33), fixed in edf7224.
# Removing -j1 here.
- name: Run all checks (serial via separate processes)
run: |
set -eo pipefail
timeout 600 zig build ${{ matrix.zig_args }} test --summary all 2>&1 | tee test.log
timeout 600 zig build ${{ matrix.zig_args }} test-safe --summary all 2>&1 | tee test-safe.log
timeout 600 zig build ${{ matrix.zig_args }} check-fmt 2>&1 | tee check-fmt.log
check:
name: check
runs-on: ubuntu-22.04
needs: [check-matrix]
if: ${{ always() }}
steps:
- name: Require check matrix success
run: |
if [ "${{ needs.check-matrix.result }}" != "success" ]; then
echo "check-matrix result: ${{ needs.check-matrix.result }}"
exit 1
fi
tsan:
name: tsan / ubuntu-22.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libusb-1.0-0-dev gdb
- name: Run TSAN tests
run: |
set -o pipefail
rm -rf .zig-cache
export TSAN_OPTIONS="halt_on_error=1:verbosity=1:history_size=7:log_path=$PWD/tsan"
timeout 600 zig build test-tsan --summary all 2>&1 | tee tsan-build.log
- name: TSAN diagnostics
if: failure()
run: |
set -euo pipefail
echo "==== TSAN summary from build log ===="
grep -nE "ThreadSanitizer|data race|thread leak|SUMMARY|signal [0-9]+|terminated with signal|error: while executing test" tsan-build.log || true
FAILED_CMD="$(grep -E '^\.?/?\.zig-cache/o/.+/test --cache-dir=' tsan-build.log | tail -n 1 || true)"
if [ -n "${FAILED_CMD}" ]; then
echo "${FAILED_CMD}" > tsan-failed-cmd.txt
echo "==== Re-running failed test command once ===="
bash -lc "${FAILED_CMD}" > tsan-rerun.log 2>&1 || true
echo "==== Running failed command under gdb ===="
eval "set -- ${FAILED_CMD}"
gdb -q -batch \
-ex "set pagination off" \
-ex "set confirm off" \
-ex "run" \
-ex "thread apply all bt full" \
--args "$@" > tsan-gdb.log 2>&1 || true
fi
echo "==== TSAN log files ===="
ls -lah tsan* || true
- name: Upload TSAN logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: tsan-logs
path: |
tsan-build.log
tsan-failed-cmd.txt
tsan-rerun.log
tsan-gdb.log
tsan*
distro-check:
name: distro-check / ${{ matrix.name }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- name: debian-12
image: debian:12
setup: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl xz-utils gcc g++ make pkg-config linux-libc-dev
- name: fedora-41
image: fedora:41
setup: dnf install -y ca-certificates curl xz gcc gcc-c++ make pkgconf-pkg-config kernel-headers glibc-headers glibc-devel
steps:
- uses: actions/checkout@v4
- name: Run check-all in container
env:
DISTRO_IMAGE: ${{ matrix.image }}
DISTRO_SETUP: ${{ matrix.setup }}
run: |
set -euo pipefail
docker run --rm \
-v "$PWD:/work" \
-w /work \
"$DISTRO_IMAGE" \
/bin/sh -lc "
set -eu
${DISTRO_SETUP}
curl -fsSL https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz -o /tmp/zig.tar.xz
tar -xJf /tmp/zig.tar.xz -C /tmp
timeout 600 /tmp/zig-x86_64-linux-0.15.2/zig build -Dlibusb=false test --summary all
timeout 600 /tmp/zig-x86_64-linux-0.15.2/zig build -Dlibusb=false test-safe --summary all
timeout 600 /tmp/zig-x86_64-linux-0.15.2/zig build -Dlibusb=false check-fmt
" 2>&1 | tee distro-check.log