-
Notifications
You must be signed in to change notification settings - Fork 15
67 lines (54 loc) · 1.79 KB
/
unittest.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
name: Unit Tests
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
strategy:
max-parallel: 4
matrix:
python-version: [3.8]
steps:
- name: Checkout repsository
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Display build environment
run: printenv
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install Pipenv
run: python -m pip install --upgrade pip pipenv
- name: Cache dependencies
id: cache-dependencies
uses: actions/[email protected]
with:
path: |
~/.cache/pipenv
~/.local/share/virtualenvs
key: ${{ runner.os }}-env-${{ matrix.python-version }}-${{ hashFiles('**/Pipfile.lock') }}-${{ secrets.ACTIONS_CACHE_KEY_UUID }}
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
pipenv install --dev --ignore-pipfile --python ${{ matrix.python-version }}
- name: Run sanity tests
run: pipenv run tox -e sanity
- name: Run unit tests
run: pipenv run coverage run -m unittest discover ./tests/ -v
- name: Convert coverage report to XML
run: pipenv run coverage xml
- name: Upload coverage to Codecov
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.xml
flags: unittests
name: Python-${{ matrix.python-version}}
fail_ci_if_error: true
plugin: pycoverage # Only run one plugin even though we don't want any to run.