-
Notifications
You must be signed in to change notification settings - Fork 102
207 lines (177 loc) · 5.57 KB
/
test.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Test
on: [push, pull_request]
jobs:
build:
strategy:
fail-fast: false
matrix:
grappelli: ["0", "1"]
python-version: ["3.11"]
django-version: ["4.2"]
exclude:
- python-version: "3.11"
grappelli: "1"
include:
- python-version: "3.9"
django-version: "4.2"
grappelli: "1"
- python-version: "3.9"
django-version: "5.0"
grappelli: "0"
- python-version: "3.10"
django-version: "5.0"
grappelli: "1"
- python-version: "3.12"
django-version: "5.1"
grappelli: "0"
runs-on: ubuntu-latest
name: Django ${{ matrix.django-version }} (Python ${{ matrix.python-version }})${{ matrix.grappelli == '1' && ' + grappelli' || '' }}
env:
DJANGO: ${{ matrix.django-version }}
GRAPPELLI: ${{ matrix.grappelli }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NODE_ENV: test
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup chromedriver
# uses: nanasess/setup-chromedriver@v2.2.2
uses: nanasess/setup-chromedriver@42cc2998329f041de87dc3cfa33a930eacd57eaa
- name: Install tox
run: |
python3 -m pip install tox tox-gh-actions
- name: Cache instrumented static files
id: cache-test-dist
uses: actions/cache@v3
with:
path: nested_admin/tests/static
key: test-dist-${{ hashFiles('package-lock.json', '.github/workflows/test.yml', 'webpack.config.js', 'package.json', '.*rc*', 'nested_admin/static/nested_admin/src/**/*.*s') }}
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}
- name: Setup nodejs
if: steps.cache-test-dist.outputs.cache-hit != 'true'
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: npm ci
if: steps.cache-test-dist.outputs.cache-hit != 'true' && steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm ci || npm ci || npm ci
- name: Build instrumented static files
if: steps.cache-test-dist.outputs.cache-hit != 'true'
run: |
npm run build
- name: Run tests
run: |
tox -- -vvv --selenosis-driver=chrome-headless --numprocesses=4 --exitfirst || \
tox -- -vvv --selenosis-driver=chrome-headless
env:
PIXELMATCH_BIN: ${{ env.GITHUB_WORKSPACE }}/node_modules/.bin/pixelmatch
- name: Upload junit xml
if: always()
uses: actions/upload-artifact@v3
with:
name: junit-reports
path: reports/*.xml
- name: Upload python coverage
run: |
tox -e coverage-report
tox -e codecov
env:
CODECOV_NAME: ${{ github.workflow }}
- name: Upload js coverage
run: npm run report && npm run codecov
env:
CODECOV_NAME: ${{ github.workflow }}
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tool: ["flake8", "black", "eslint", "stylelint"]
include:
- tool: flake8
language: python
- tool: black
language: python
- tool: eslint
language: javascript
- tool: stylelint
language: javascript
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
if: matrix.language == 'python'
with:
python-version: 3.9
- name: Cache node_modules
if: matrix.language == 'javascript'
id: cache-node_modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}-lint
restore-keys: |
node_modules-${{ hashFiles('package-lock.json') }}
- name: Setup nodejs
if: matrix.language == 'javascript'
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: npm ci
if: matrix.language == 'javascript' && steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm ci || npm ci || npm ci
- name: Run black
if: matrix.tool == 'black'
uses: psf/black@stable
with:
src: "nested_admin docs setup.py"
version: "22.8.0"
- name: Install flake8
if: matrix.tool == 'flake8'
run: pip install flake8
- name: Run flake8
if: matrix.tool == 'flake8'
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'lint'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run ${{ matrix.tool }}
if: matrix.language == 'javascript'
run: |
npm run lint:${{ matrix.tool }}
report:
if: always()
needs: build
runs-on: ubuntu-latest
name: "Report Test Results"
steps:
- uses: actions/download-artifact@v3
with:
name: junit-reports
- name: Publish tests report
uses: mikepenz/action-junit-report@1a91e26932fb7ba410a31fab1f09266a96d29971
with:
report_paths: ./*.xml
require_tests: true
fail_on_failure: true
check_name: Test Report
success:
needs: [lint, report]
runs-on: ubuntu-latest
name: Test Successful
steps:
- name: Success
run: echo Test Successful