-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (71 loc) · 2.05 KB
/
tests.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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
tests:
name: ${{ matrix.tox-env }} - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- 3.5
- 3.9
tox-env:
- py3
- py3-django
- py3-openedx
include:
- python-version: 3.5
tox-env: flake8
- python-version: 3.9
tox-env: bandit
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox flake8
- name: Test with tox
run: |
tox -e ${{ matrix.tox-env }}
if [ -f .coverage ]; then mv .coverage ".coverage.${{ matrix.python-version }}-${{ matrix.tox-env }}"; fi
- name: Upload coverage data
uses: actions/upload-artifact@v2
with:
name: coverage-data
path: "*.coverage.*"
if-no-files-found: ignore
coverage:
name: Combine and check coverage
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
# Use latest, so it understands all syntax.
python-version: '3.10'
- run: python -m pip install --upgrade coverage[toml]
- name: Download coverage data
uses: actions/[email protected]
with:
name: coverage-data
- name: 'Combine coverage & fail if it is less than 100%'
id: coverage
run: |
coverage combine
coverage html --skip-covered --skip-empty
coverage report --fail-under=100
- name: Upload HTML report if check failed
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: html-report
path: htmlcov