-
Notifications
You must be signed in to change notification settings - Fork 21
105 lines (100 loc) · 3.26 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
name: Test & Lint
# Inspired by https://github.com/wagtail/wagtail-bakery/blob/0bfff2a7446e6119156279d22cfac2137960145d/.github/workflows/test.yml
on:
push:
branches:
- main
pull_request:
workflow_call: # Allow for the publish workflows to run the tests by calling this workflow
jobs:
qa_javascript:
name: JavaScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: 14
- name: Install dependencies
run: |
npm ci
- name: Lint JavaScript
run: |
npm run lint
- name: Compile JavaScript
run: |
npm run build
qa_python:
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
name: Python ${{ matrix.python}} ${{ matrix.toxenv }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
experimental: [false]
toxenv: ["py"]
include:
# Linting
- python: "3.11"
toxenv: flake8
experimental: false
# Future Wagtail release from main branch (allowed to fail)
- python: "3.11"
toxenv: wagtailmain-sqlite
experimental: true
- python: "3.11"
toxenv: wagtailmain-postgres
experimental: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install tox coverage
# This step runs only for jobs NOT in the include matrix
- name: Run tox targets for Python ${{ matrix.python }}
if: ${{ matrix.toxenv == 'py' }}
run: |
# Run only the tox environments that match the Python version
tox run -f py$(echo ${{ matrix.python }} | tr -d .)
coverage combine
coverage report
# Codecov does not support the .coverage file generated by coverage, so we convert it to xml
coverage xml
env:
DATABASE_URL: postgres://postgres:postgres@localhost/wagtail_ab_testing
- name: Upload coverage reports to Codecov
if: ${{ matrix.toxenv == 'py' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# This step runs only for jobs in the include matrix and covers linting
- name: Run tox targets for Python ${{ matrix.python }} (${{ matrix.toxenv }})
if: ${{ matrix.toxenv != 'py' }}
run: |
tox -e ${{ matrix.toxenv }}
env:
TOXENV: ${{ matrix.toxenv }}
DATABASE_URL: postgres://postgres:postgres@localhost/wagtail_ab_testing
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}