-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (64 loc) · 2.1 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
name: Tests
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9']
name: Python ${{ matrix.python-version }} tests
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get full python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Bootstrap environment
run: |
python -m ensurepip
python -m pip install -U pip
python -m pip install poetry
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
- name: Setup cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: |
timeout 10s python -m poetry run pip --version || rm -rf .venv
- name: Install dependencies
run: |
python -m poetry install --no-root
- name: Run tests
env:
DJANGO_SETTINGS_MODULE: tests.settings
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
python -m poetry run python -m pytest -v tests
python -m poetry run coverage report
- name: Upload coverage data to coveralls.io
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
run: python -m poetry run coveralls --service=github
coveralls:
name: Indicate completion to coveralls.io
needs: tests
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip3 install -U coveralls
coveralls --service=github --finish