Skip to content

Commit 2464220

Browse files
committed
Start service before link checking in CI
1 parent 9733a4e commit 2464220

1 file changed

Lines changed: 49 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,55 @@ jobs:
5252
validate-links:
5353
name: Check for dead links
5454
runs-on: ubuntu-latest
55+
timeout-minutes: 30
5556
steps:
5657
- uses: actions/checkout@v4
57-
- name: check readme links
58+
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: '3.12'
63+
64+
- name: Install uv
65+
uses: astral-sh/setup-uv@v4
66+
with:
67+
enable-cache: true
68+
69+
- name: Install dependencies
70+
run: uv sync
71+
72+
- name: Start service in background
73+
run: |
74+
uv run uvicorn main:app --host 127.0.0.1 --port 3003 &
75+
echo $! > service.pid
76+
echo "Service started with PID $(cat service.pid)"
77+
78+
- name: Wait for service to be ready
79+
run: |
80+
echo "Waiting for service on port 3003..."
81+
timeout=60
82+
elapsed=0
83+
while ! curl -f http://localhost:3003/templates 2>/dev/null; do
84+
if [ $elapsed -ge $timeout ]; then
85+
echo "Service did not start within ${timeout} seconds"
86+
exit 1
87+
fi
88+
echo "Waiting... (${elapsed}s/${timeout}s)"
89+
sleep 2
90+
elapsed=$((elapsed + 2))
91+
done
92+
echo "Service is ready!"
93+
94+
- name: Check readme links
5895
run: npx linkinator README.md
96+
97+
- name: Stop service
98+
if: always()
99+
run: |
100+
if [ -f service.pid ]; then
101+
PID=$(cat service.pid)
102+
echo "Stopping service with PID $PID"
103+
kill $PID || true
104+
sleep 5
105+
kill -9 $PID 2>/dev/null || true
106+
fi

0 commit comments

Comments
 (0)