-
Notifications
You must be signed in to change notification settings - Fork 173
88 lines (78 loc) · 2.61 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
name: CI
on:
pull_request:
jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['py38', 'py311', 'py312']
django-version: ['django42']
db-version: ['mysql80']
pytest-split-group: [1, 2, 3, 4, 5, 6]
status: ['']
steps:
- uses: actions/checkout@v3
- name: Format Python Version
id: format_python_version
shell: bash
run: |
# Remove 'py' and insert a dot to format the version
FORMATTED_VERSION=${{ matrix.python-version }} # e.g., py38
FORMATTED_VERSION=${FORMATTED_VERSION/py3/3.} # becomes 3.8
# Set environment variables
echo "PYTHON_VERSION=$FORMATTED_VERSION" >> $GITHUB_ENV
# Output formatted version for use in subsequent steps
echo "Using Python Version: $FORMATTED_VERSION"
- run: make ci_up
- name: run tests
env:
DB_HOST: ${{ matrix.db-version }}
PYTEST_SPLIT_GROUP: ${{ matrix.pytest-split-group }}
run: make ci_test TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }}
# Unfortunately, continue-on-error marks the job as successful. We really want something like "allow failure"
# that would note the failure, but not fail the entire workflow and not email the author about it.
# See https://github.com/actions/toolkit/issues/399
continue-on-error: ${{ matrix.status == 'ignored' }}
- name: Upload coverage
if: matrix.db-version == 'mysql80'
uses: actions/upload-artifact@v4
with:
name: coverage${{ matrix.pytest-split-group }}
path: .coverage
# Combine and upload coverage reports.
coverage:
needs: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make ci_up
env:
PYTHON_VERSION: 3.8
- name: Download all artifacts
# Downloads coverage1, coverage2, etc.
uses: actions/download-artifact@v2
- name: Run coverage
run: make ci_coverage
- uses: codecov/codecov-action@v1
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make ci_up
env:
PYTHON_VERSION: 3.8
- run: make ci_quality
semgrep:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- run: make ci_up
env:
PYTHON_VERSION: ${{ matrix.python-version }}
- name: Run semgrep Django rules
run: make ci_semgrep