Skip to content

Commit 7504fa8

Browse files
committed
ci: add race condition test workflow
1 parent 7f84826 commit 7504fa8

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Race Condition Test
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
race-condition-test:
9+
runs-on: ubuntu-24.04
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
test: [
14+
"examples.hello_esp32.main",
15+
"examples.hello_esp32_sync.main",
16+
"examples.micropython_esp32.main"
17+
]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
- run: pip install hatch
25+
- name: Run a Wokwi CI server
26+
uses: wokwi/wokwi-ci-server-action@v1
27+
- name: Run race condition test for 30 minutes
28+
if: env.WOKWI_CLI_TOKEN != ''
29+
env:
30+
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
31+
WOKWI_SLEEP_TIME: "5" # Shorter sleep time for more iterations
32+
run: |
33+
echo "Starting race condition test for ${{ matrix.test }}"
34+
echo "Test will run for 30 minutes..."
35+
36+
start_time=$(date +%s)
37+
end_time=$((start_time + 1800)) # 30 minutes = 1800 seconds
38+
iteration=1
39+
40+
while [ $(date +%s) -lt $end_time ]; do
41+
echo "=== Iteration $iteration for ${{ matrix.test }} ==="
42+
echo "Time: $(date)"
43+
44+
if ! timeout 120 hatch run python -m ${{ matrix.test }}; then
45+
echo "ERROR: Test failed on iteration $iteration"
46+
echo "Failure time: $(date)"
47+
exit 1
48+
fi
49+
50+
echo "Iteration $iteration completed successfully"
51+
iteration=$((iteration + 1))
52+
53+
# Small delay between iterations
54+
sleep 2
55+
done
56+
57+
echo "Race condition test completed successfully after $((iteration - 1)) iterations"
58+
echo "Total runtime: 30 minutes"

0 commit comments

Comments
 (0)