-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (105 loc) · 3.44 KB
/
ci.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
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
126
127
128
---
name: "CI"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_call:
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
FORCE_COLOR: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PYTHON_VERSION: "3.11"
jobs:
tests:
name: "Tests"
runs-on: "ubuntu-latest"
services:
db:
image: "postgres:15.1"
ports:
- "5432:5432"
env:
POSTGRES_HOST_AUTH_METHOD: "trust"
options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: "Setup Python ${{ env.PYTHON_VERSION }}"
uses: "actions/setup-python@v5"
with:
python-version: "${{ env.PYTHON_VERSION }}"
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: "Install pip and wheel"
run: "python -m pip install --upgrade pip wheel -c requirements/constraints.txt"
- name: "Install Nox"
run: "python -m pip install nox -c requirements/constraints.txt"
- name: "Run tests (via Nox)"
run: "nox -s tests"
- name: "Upload coverage data"
uses: "actions/upload-artifact@v4"
with:
name: "coverage-data-${{ env.PYTHON_VERSION }}"
path: ".coverage.*"
include-hidden-files: true
coverage:
name: "Coverage report"
runs-on: "ubuntu-latest"
needs: "tests"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: "Setup Python ${{ env.PYTHON_VERSION }}"
uses: "actions/setup-python@v5"
with:
python-version: "${{ env.PYTHON_VERSION }}"
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: "Install pip and wheel"
run: "python -m pip install --upgrade pip wheel -c requirements/constraints.txt"
- name: "Install Nox"
run: "python -m pip install nox -c requirements/constraints.txt"
- uses: "actions/download-artifact@v4"
with:
pattern: "coverage-data-*"
merge-multiple: "true"
- name: "Combine coverage (via Nox)"
run: "nox -s coverage_report"
- name: "Upload coverage reports to Codecov"
uses: "codecov/codecov-action@v4"
with:
files: "coverage.xml"
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
checks:
name: "${{ matrix.name }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
include:
- name: "Code style checks"
nox_session: "code_style_checks"
- name: "Type checks"
nox_session: "type_checks"
- name: "Django checks"
nox_session: "django_checks"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: "Setup Python ${{ env.PYTHON_VERSION }}"
uses: "actions/setup-python@v5"
with:
python-version: "${{ env.PYTHON_VERSION }}"
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: "Install pip and wheel"
run: "python -m pip install --upgrade pip wheel -c requirements/constraints.txt"
- name: "Install Nox"
run: "python -m pip install nox -c requirements/constraints.txt"
- name: "Run '${{ matrix.nox_session }}' Nox session"
run: "nox -s ${{ matrix.nox_session }}"