-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (102 loc) · 3.04 KB
/
Copy pathci.yml
File metadata and controls
124 lines (102 loc) · 3.04 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
name: CI
on:
push:
branches: ["master"]
paths-ignore:
- "README.md"
- "docs/**"
- "*.md"
pull_request:
branches: ["master"]
paths-ignore:
- "README.md"
- "docs/**"
- "*.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
SECRET_KEY: test-secret-key
jobs:
lint-and-format:
name: Code Quality & Linting
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install packages
run: uv sync --dev --locked
- name: Cache pre-commit hooks
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-
- name: Install pre-commit hooks
run: uv run pre-commit run --all-files --show-diff-on-failure
test:
name: Test Python ${{ matrix.python-version }} / Django ${{ matrix.django-version }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
django-version: ["4.2", "5.0", "5.1"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages
run: uv sync --dev --locked
- name: Install Django ${{ matrix.django-version }}
run: uv add "django==${{ matrix.django-version }}.*"
- name: Run migrations
run: uv run manage.py migrate
- name: Run tests with coverage
run: |
uv run coverage run manage.py test
uv run coverage xml
uv run coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
files : ./coverage.xml
flags: unittests
name: codecov-python-${{ matrix.python-version }}-django-${{ matrix.django-version }}
fail_ci_if_error: false
all-checks:
name: All Checks Passed
runs-on: ubuntu-latest
needs: [lint-and-format, test]
if: always()
steps:
- name: Check all jobs
run: |
if [[ "${{ needs.lint-and-format.result }}" != "success" ||
"${{ needs.test.result }}" != "success" ]]; then
echo "One or more checks failed"
exit 1
fi
echo "All checks passed successfully"