Repository navigation
125 lines (106 loc) · 2.98 KB
/
Copy pathci.yml
File metadata and controls
125 lines (106 loc) · 2.98 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: CI
on:
push:
branches:
- master
paths:
- 'compose.yml'
- 'data/**'
- 'Dockerfile'
- 'guard_core/**'
- 'mypy.ini'
- '.github/**'
- '.pre-commit-config.yaml'
- 'pyproject.toml'
- 'pytest.ini'
- 'reqs.pip'
- 'tests/**'
pull_request:
branches:
- master
paths:
- 'compose.yml'
- 'data/**'
- 'Dockerfile'
- 'guard_core/**'
- 'mypy.ini'
- '.github/**'
- '.pre-commit-config.yaml'
- 'pyproject.toml'
- 'pytest.ini'
- 'reqs.pip'
- 'tests/**'
workflow_dispatch:
permissions:
contents: read
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.10'
- run: pip install uv
- run: uv sync --extra dev --extra otel --extra logfire
- run: uv run pre-commit run --all-files
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.10'
- run: pip install uv
- run: uv sync --extra dev --extra otel --extra logfire
- run: make quality
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
permissions:
pull-requests: write
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
pip install uv
- name: Install dependencies
run: |
uv sync --extra dev --extra otel --extra logfire
- name: Run tests
run: |
IPINFO_TOKEN='${{ secrets.IPINFO_TOKEN || 'test_token' }}' REDIS_URL='redis://localhost:6379' GUARD_TESTS_MAX_TEST_SECONDS=180 uv run pytest -v --cov=guard_core --cov-fail-under=100 -W error
docker-test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
# The 3.10 docker suite runs ~29-30 minutes of pytest after a cold bake,
# so a 30 minute job cap kills the job right after the tests pass.
timeout-minutes: 50
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Run tests in Docker
run: |
COMPOSE_BAKE=true PYTHON_VERSION=3.10 docker compose run --rm --build -e GUARD_TESTS_MAX_TEST_SECONDS=180 guard-core pytest -q -p no:cacheprovider -W error --ignore=tests/live_smoke --cov=guard_core --cov-branch --cov-fail-under=100
- name: Tear down Docker Compose
if: always()
run: |
docker compose down -v --remove-orphans