-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (81 loc) · 2.5 KB
/
test.yml
File metadata and controls
106 lines (81 loc) · 2.5 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: Test
on:
pull_request:
jobs:
lint:
name: Lint & format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Python
run: uv python install 3.13
- name: Sync dependencies
run: uv sync --extra dev
- name: Run ruff check
run: uv run ruff check .
- name: Run ruff format check
run: uv run ruff format --check .
- name: Check changelog fragment exists
run: uv run towncrier check --compare-with origin/main
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Python
run: uv python install 3.13
- name: Sync dependencies
run: uv sync --extra dev
- name: Run tests
run: uv run pytest -v -m "not integration and not staging" --cov=src/policyengine_api --cov-report=term-missing
openapi-diff:
name: OpenAPI schema diff
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
path: pr
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
path: main
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Python
run: uv python install 3.13
- name: Generate main branch schema
working-directory: main
run: |
uv sync
uv run python -c "
import json
from policyengine_api.main import app
print(json.dumps(app.openapi(), indent=2))
" > /tmp/openapi-main.json
- name: Generate PR branch schema
working-directory: pr
run: |
uv sync
uv run python -c "
import json
from policyengine_api.main import app
print(json.dumps(app.openapi(), indent=2))
" > /tmp/openapi-pr.json
- name: Install oasdiff
run: |
curl -sSL https://raw.githubusercontent.com/Tufin/oasdiff/main/install.sh | sh
- name: Check for breaking changes
run: oasdiff breaking /tmp/openapi-main.json /tmp/openapi-pr.json --fail-on ERR
- name: Full diff summary
if: always()
run: oasdiff diff /tmp/openapi-main.json /tmp/openapi-pr.json --format text || true