-
Notifications
You must be signed in to change notification settings - Fork 85
61 lines (59 loc) · 1.85 KB
/
python-unit-test.yml
File metadata and controls
61 lines (59 loc) · 1.85 KB
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
name: Unit Test
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.7", "3.6"]
exclude:
# excludes py3.6 on MacOS to save time/energy
- os: macos-latest
python-version: "3.6"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Ubuntu system dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install graphviz
- name: Install Mac OS system dependencies
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install graphviz
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install codecov==2.1.11
pip install -e .
- name: Linting
# W9006 can't be checked like this as we need to ignore ValueError
run: |
pylint --disable=all --enable=C0103,C0301,R1725,W0107,W9012,W9015 *
pylint --exit-zero *
timeout-minutes: 10
- name: Unit test with pytest
run: |
pytest --cov-report=xml --cov=deepreg --durations=20 --durations-min=1.0 ./test/unit/
timeout-minutes: 20
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml