-
Notifications
You must be signed in to change notification settings - Fork 344
151 lines (122 loc) · 3.71 KB
/
main.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: main
on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
env:
PYTEST_ADDOPTS: "--color=yes"
# Set permissions at the job level.
permissions: {}
jobs:
test:
runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.allow_failure }}
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Setup mysql
if: contains(matrix.name, 'mysql')
run: |
sudo systemctl start mysql.service
echo "TEST_DB_USER=root" >> $GITHUB_ENV
echo "TEST_DB_PASSWORD=root" >> $GITHUB_ENV
- name: Setup postgresql
if: contains(matrix.name, 'postgres')
run: |
sudo systemctl start postgresql.service
sudo -u postgres createuser --createdb $USER
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox==3.25.1
- name: Run tox
run: tox -e ${{ matrix.name }}
- name: Report coverage
if: contains(matrix.name, 'coverage')
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
strategy:
fail-fast: false
matrix:
include:
- name: linting,docs
python: '3.11'
allow_failure: false
- name: py311-dj42-postgres-xdist-coverage
python: '3.11'
allow_failure: false
- name: py310-dj41-postgres-xdist-coverage
python: '3.10'
allow_failure: false
- name: py310-dj32-postgres-xdist-coverage
python: '3.10'
allow_failure: false
- name: py311-dj41-mysql_innodb-coverage
python: '3.11'
allow_failure: false
- name: py310-dj42-mysql_innodb-coverage
python: '3.10'
allow_failure: false
- name: py39-dj32-mysql_innodb-xdist-coverage
python: '3.9'
allow_failure: false
- name: py38-dj41-sqlite-xdist-coverage
python: '3.8'
allow_failure: false
- name: py38-dj32-sqlite-xdist-coverage
python: '3.8'
allow_failure: false
- name: py310-djmain-sqlite-coverage
python: '3.10'
allow_failure: true
- name: py38-dj32-mysql_myisam-coverage
python: '3.8'
allow_failure: false
# Explicitly test min pytest.
- name: py38-dj32-sqlite-pytestmin-coverage
python: '3.8'
allow_failure: false
# pypy3: not included with coverage reports (much slower then).
- name: pypy3-dj32-postgres
python: 'pypy3.9'
allow_failure: false
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest-django'
runs-on: ubuntu-22.04
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@0bf742be3ebe032c25dd15117957dc15d0cfc38d # v1.8.5
with:
user: __token__
password: ${{ secrets.pypi_token }}