-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (88 loc) · 2.55 KB
/
ci.yml
File metadata and controls
106 lines (88 loc) · 2.55 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
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
lint-format-test:
name: Format, linting, type checking, and tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install dependencies
run: uv sync --all-extras
- name: Check formatting with ruff
run: uv run ruff format --check .
- name: Run ruff linting
run: uv run ruff check .
- name: Run type checking with mypy
run: uv run mypy .
- name: Run unit tests
run: uv run pytest tests/ -v --tb=short
spelling:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Spell Check Repo
uses: crate-ci/typos@v1.35.5
validate-links:
name: Check for dead links
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Start service in background
run: |
uv run uvicorn main:app --host 127.0.0.1 --port 3003 &
echo $! > service.pid
echo "Service started with PID $(cat service.pid)"
- name: Wait for service to be ready
run: |
echo "Waiting for service on port 3003..."
timeout=60
elapsed=0
while ! curl -f http://localhost:3003/templates 2>/dev/null; do
if [ $elapsed -ge $timeout ]; then
echo "Service did not start within ${timeout} seconds"
exit 1
fi
echo "Waiting... (${elapsed}s/${timeout}s)"
sleep 2
elapsed=$((elapsed + 2))
done
echo "Service is ready!"
- name: Check readme links
run: npx linkinator README.md
- name: Stop service
if: always()
run: |
if [ -f service.pid ]; then
PID=$(cat service.pid)
echo "Stopping service with PID $PID"
kill $PID || true
sleep 5
kill -9 $PID 2>/dev/null || true
fi