44name : Python package
55
66on :
7- push :
8- branches : [ develop ]
9- pull_request :
10- branches : [ develop ]
7+ push :
8+ branches : [ develop ]
9+ pull_request :
10+ branches : [ develop ]
1111
1212jobs :
13- lint :
14- name : Check code style
15- runs-on : ubuntu-latest
16- container : python:3-slim
17- steps :
18- - uses : actions/checkout@v2
19- - name : Install dependencies
20- run : |
21- python -m pip install --upgrade pip
22- python -m pip install flake8 black
23- - name : Blacken code
24- run : black . --safe --quiet
25- - name : Lint with flake8
26- run : |
27- # stop the build if there are Python syntax errors or undefined names
28- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31- test :
32- name : Test (Python, Django)
33- runs-on : ubuntu-latest
34- needs : lint
35- strategy :
36- matrix :
37- python-version : [ 3.8, 3.9, "3.10" ]
38- django-version : [ "3.2", "4.0" ]
39- env :
40- PYTHON : ${{ matrix.python-version }}
41- DJANGO : ${{ matrix.django-version }}
42- steps :
43- - uses : actions/checkout@v2
44- - name : Set up Python ${{ matrix.python-version }}
45- uses : actions/setup-python@v2
46- with :
47- python-version : ${{ matrix.python-version }}
48- - name : Install dependencies
49- run : |
50- python -m pip install --upgrade pip
51- python -m pip install --upgrade django~=${{ matrix.django-version }}
52- if [ -f requirements/local.txt ]; then pip install -r requirements/local.txt; fi
53- - name : Test with pytest and update coverage
54- run : |
55- coverage run -m pytest
56- coverage xml
57- - name : Upload coverage to Codecov
58- uses : codecov/codecov-action@v1
59- with :
60- token : ${{ secrets.CODECOV_TOKEN }}
61- files : coverage.xml
62- flags : unittests
63- env_vars : PYTHON, DJANGO
64- fail_ci_if_error : true
65- verbose : true
13+ lint :
14+ name : Check code style
15+ runs-on : ubuntu-latest
16+ container : python:3-slim
17+ steps :
18+ - uses : actions/checkout@v2
19+ - name : Install dependencies
20+ run : |
21+ python -m pip install --upgrade pip
22+ python -m pip install flake8 black
23+ - name : Blacken code
24+ run : black . --safe --quiet
25+ - name : Lint with flake8
26+ run : |
27+ # stop the build if there are Python syntax errors or undefined names
28+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
32+ tests :
33+ name : Python ${{ matrix.python-version }}
34+ runs-on : ubuntu-20.04
35+ strategy :
36+ matrix :
37+ python-version :
38+ - ' 3.9'
39+ - ' 3.10'
40+ - ' 3.11'
41+ - ' 3.12'
42+ steps :
43+ - uses : actions/checkout@v4
44+ - uses : actions/setup-python@v5
45+ with :
46+ python-version : ${{ matrix.python-version }}
47+ cache : ' pip'
48+ cache-dependency-path : ' requirements/*.txt'
49+ - name : Upgrade packaging tools
50+ run : python -m pip install --upgrade pip setuptools virtualenv wheel
51+ - name : Install dependencies
52+ run : python -m pip install --upgrade codecov tox
53+ - name : Run tox targets for ${{ matrix.python-version }}
54+ run : tox run -f py$(echo ${{ matrix.python-version }} | tr -d . | cut -f 1 -d '-')
55+ - name : Upload coverage
56+ run : |
57+ codecov -e TOXENV,DJANGO
0 commit comments