-
Notifications
You must be signed in to change notification settings - Fork 118
76 lines (62 loc) · 2.1 KB
/
bun-test.yml
File metadata and controls
76 lines (62 loc) · 2.1 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
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
name: Bun Test
on:
pull_request:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
node: [1, 2, 3, 4]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.5
- name: Install dependencies
run: bun install
- name: Generate test plans
run: bun run scripts/generate-test-plan.ts
- name: Run tests for node ${{ matrix.node }}
run: |
if [ ! -f ".github/test-plans/node${{ matrix.node }}-testplan.txt" ]; then
echo "ERROR: No test plan found for node ${{ matrix.node }}"
exit 1
fi
mapfile -t test_files < .github/test-plans/node${{ matrix.node }}-testplan.txt
if [ ${#test_files[@]} -eq 0 ]; then
echo "ERROR: No test files in plan for node ${{ matrix.node }}"
exit 1
fi
echo "Running ${#test_files[@]} test files for node ${{ matrix.node }}"
attempt=1
while [ $attempt -le 4 ]; do
bun test ${test_files[@]} --timeout 30000
code=$?
if [ $code -eq 0 ]; then
break
fi
if [ $code -ne 139 ] && [ $code -ne 132 ]; then
exit $code
fi
if [ $attempt -eq 4 ]; then
echo "Segmentation fault or illegal instruction detected after $attempt attempts (exit=$code)."
exit $code
fi
attempt=$((attempt + 1))
echo "Segfault (139) or illegal instruction (132) detected, retrying ($attempt/4)..."
done
- name: Upload 3D Snapshot Artifacts on Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: 3d-snapshots-node${{ matrix.node }}
path: |
tests/**/__snapshots__/*.diff.png
tests/**/__snapshots__/*.snap.png
if-no-files-found: ignore