-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (94 loc) · 3.08 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
name: hatch-tests
on:
pull_request:
branches: [ "master", "main" ]
paths-ignore: [ "docs/**" ]
push:
branches: [ "master", "main" ]
paths-ignore: [ "docs/**" ]
schedule:
- cron: '0 12 * * 0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.12"]
django-version: ["3.2", "4.2"]
backend: ["sqlite", "mysql"]
mariadb-version: ["10.4"] # What we're currently running with.
include:
- python-version: "3.12" # Possible future update.
django-version: "4.2"
backend: "mysql"
mariadb-version: "10.5"
- python-version: "3.12" # Possible future update.
django-version: "4.2"
backend: "mysql"
mariadb-version: "10.11"
name: "py${{ matrix.python-version }}-dj${{ matrix.django-version }}-${{ matrix.backend }}-${{ matrix.mariadb-version }}"
runs-on: ubuntu-latest
env:
PYTEST_ADDOPTS: "--maxfail=20" # Stop testing after too many failures.
TEST_ENV: "test-${{ matrix.backend }}.py${{ matrix.python-version }}-${{ matrix.django-version }}"
services:
database:
image: mariadb:${{ matrix.mariadb-version }}
env:
MYSQL_ROOT_PASSWORD: rootpw
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --tmpfs /var/lib/mysql
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install hatch
run: python -m pip install --upgrade hatch
- name: Set environment variables
if: ${{ matrix.backend == 'mysql' }}
run: |
echo "DBNAME=test" >> $GITHUB_ENV
echo "DBUSER=root" >> $GITHUB_ENV
echo "DBPASSWORD=rootpw" >> $GITHUB_ENV
echo "DBHOST=127.0.0.1" >> $GITHUB_ENV
- name: Run Tests
run: hatch run $TEST_ENV:cov
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ strategy.job-index }}
path: ".coverage.*"
if-no-files-found: error
coverage:
name: Check coverage.
runs-on: "ubuntu-latest"
needs: [test]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install hatch
run: python -m pip install --upgrade hatch
- name: Download coverage data
uses: actions/download-artifact@v4
with:
path: ./artifacts/
- name: Merge coverage files
run: |
mv ./artifacts/coverage-data*/.coverage* .
ls -la .coverage*
- name: Combine coverage data
run: hatch run cov-combine:combine
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}