-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (77 loc) · 2.79 KB
/
testing.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
# Taken from https://github.com/marketplace/actions/install-poetry-action#testing-using-a-matrix
name: test
on: pull_request
jobs:
linting:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
#----------------------------------------------
# load pip cache if cache exists
#----------------------------------------------
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
#----------------------------------------------
# install and run linters
#----------------------------------------------
- run: python -m pip install black flake8 isort
#- run: |
# flake8 .
# black . --check
# isort .
test:
needs: linting
strategy:
fail-fast: true
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
django-version: ["3", "4" ]
runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: update apt
run:
sudo apt-get update
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: install setuptools
run: pip${{ matrix.python-version }} install setuptools
- name: Build requirments.txt
uses: divideprojects/poetry-export-requirements-action@v1
with:
without-hashes: true
outfile-name: requirements.txt
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
run: pip${{ matrix.python-version }} install -r requirements.txt
- name: Install pytest
run: pip${{ matrix.python-version }} install pytest
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: pip${{ matrix.python-version }} install -e .
#----------------------------------------------
# add matrix specifics and run test suite
#----------------------------------------------
- name: Run tests
run: |
pytest tests/
#coverage report