Skip to content

Commit 6ce600a

Browse files
authored
ci: shard runtime tests (#436)
1 parent 60ce9f5 commit 6ce600a

1 file changed

Lines changed: 64 additions & 2 deletions

File tree

.github/workflows/verify.yml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,33 @@ jobs:
5656

5757
test:
5858
name: Test Runtime
59+
if: always()
60+
needs: [test-runtime]
61+
runs-on: ubuntu-latest
62+
steps:
63+
- run: |
64+
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
65+
echo "One or more runtime test shards failed or were cancelled"
66+
exit 1
67+
fi
68+
69+
test-runtime:
70+
name: Test Runtime / ${{ matrix.name }}
5971
runs-on: ubuntu-latest
60-
timeout-minutes: 10
72+
timeout-minutes: 12
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
include:
77+
- name: Node 1/2
78+
artifact: node-1
79+
args: --project node --shard=1/2
80+
- name: Node 2/2
81+
artifact: node-2
82+
args: --project node --shard=2/2
83+
- name: CLI
84+
artifact: cli
85+
args: --project cli
6186
env:
6287
# GitHub-hosted runners are ephemeral, so we can skip the Ryuk sidecar
6388
# and avoid Docker Hub rate limits on testcontainers/ryuk pulls.
@@ -112,10 +137,47 @@ jobs:
112137
eval "$(dbus-launch --sh-syntax)"
113138
eval "$(printf '\n' | gnome-keyring-daemon --unlock)"
114139
eval "$(printf '\n' | gnome-keyring-daemon --start)"
115-
pnpm exec vp test --run --project node --project cli --bail=1
140+
141+
log="runtime-tests-${{ matrix.artifact }}.log"
142+
touch "${log}"
143+
tail -n +1 -f "${log}" &
144+
tail_pid=$!
145+
146+
setsid pnpm exec vp test --run ${{ matrix.args }} --reporter=verbose --bail=1 > "${log}" 2>&1 &
147+
test_pid=$!
148+
149+
(
150+
sleep 9m
151+
if kill -0 "${test_pid}" 2>/dev/null; then
152+
echo "::error::Runtime test shard exceeded 9 minutes" >> "${log}"
153+
kill -TERM "-${test_pid}" 2>/dev/null || true
154+
sleep 30
155+
kill -KILL "-${test_pid}" 2>/dev/null || true
156+
fi
157+
) &
158+
watchdog_pid=$!
159+
160+
set +e
161+
wait "${test_pid}"
162+
test_status=$?
163+
set -e
164+
165+
kill "${watchdog_pid}" 2>/dev/null || true
166+
kill "${tail_pid}" 2>/dev/null || true
167+
wait "${tail_pid}" 2>/dev/null || true
168+
exit "${test_status}"
116169
env:
117170
CI: true
118171

172+
- name: Upload runtime test log
173+
if: ${{ always() }}
174+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
175+
with:
176+
name: runtime-test-log-${{ matrix.artifact }}
177+
path: runtime-tests-${{ matrix.artifact }}.log
178+
if-no-files-found: ignore
179+
retention-days: 7
180+
119181
test-html:
120182
name: Test HTML
121183
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)