-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (79 loc) · 2.55 KB
/
Copy pathcoverage.yaml
File metadata and controls
91 lines (79 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
name: Coverage
on:
push:
branches:
- dev
- master
pull_request:
jobs:
coverage:
name: Lint and test with coverage
runs-on: ubuntu-latest
permissions:
contents: read
services:
postgres:
image: postgres:18.3
env:
POSTGRES_DB: fragforce_read_test
POSTGRES_PASSWORD: insecure
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: '3.13'
- name: Install dependencies
run: uv sync --frozen --extra dev
- name: Lint with ruff
run: uv run --frozen ruff check .
- name: Django system check
env:
DATABASE_URL: postgres://postgres:insecure@localhost/fragforce_read_test
SECRET_KEY: insecure-test-key-not-used-in-production
run: uv run --frozen python manage.py check
- name: Run tests with coverage
continue-on-error: true
env:
DATABASE_URL: postgres://postgres:insecure@localhost/fragforce_read_test
SECRET_KEY: insecure-test-key-not-used-in-production
run: |
uv run --frozen coverage run -m pytest --junitxml=TEST-results.xml
uv run --frozen coverage xml
- name: Save PR metadata
env:
PR_NUMBER: ${{ github.event_name == 'pull_request' && github.event.number || '' }}
COMMIT_SHA: ${{ github.sha }}
BASE_REF: ${{ github.base_ref }}
REF_NAME: ${{ github.ref_name }}
run: |
echo "$PR_NUMBER" > pr_number.txt
echo "$COMMIT_SHA" > pr_sha.txt
echo "$BASE_REF" > pr_base_ref.txt
echo "$REF_NAME" > branch_name.txt
- name: Upload coverage and test artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: coverage-report
path: |
coverage.xml
TEST-*.xml
pr_number.txt
pr_sha.txt
pr_base_ref.txt
branch_name.txt
retention-days: 1