-
-
Notifications
You must be signed in to change notification settings - Fork 7
79 lines (68 loc) · 2.05 KB
/
tests.yml
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
name: Linting and Testing
on:
pull_request:
branches:
- main
env:
SECRET_KEY: "some-insecure-key"
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"
CSRF_TRUSTED_ORIGIN: http://127.0.0.1
UV_INDEX_TSD_USERNAME: ${{ secrets.UV_INDEX_TSD_USERNAME }}
UV_INDEX_TSD_PASSWORD: ${{ secrets.UV_INDEX_TSD_PASSWORD }}
DEBUG: "true"
jobs:
linters:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup Python and Poetry
uses: './.github/actions/setup-python'
with:
python-version: "3.12"
- name: Install dependencies
run: uv sync --frozen
- name: Run linters
run: |
mkdir test_results
uv run ruff check .
uv run ruff format --check .
uv run mypy .
tests:
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup Python & Poetry
uses: './.github/actions/setup-python'
with:
python-version: "3.12"
- name: Install dependencies
run: |
uv sync --frozen
- name: Run tests
run: uv run pytest --junitxml=test_results/TEST-pytest.xml
- name: Publish test report
uses: mikepenz/action-junit-report@v5
if: success() || failure() # always run even if the previous step fails
with:
report_paths: "test_results/TEST-*.xml"