-
Notifications
You must be signed in to change notification settings - Fork 17
47 lines (42 loc) · 1.25 KB
/
test-python.yml
File metadata and controls
47 lines (42 loc) · 1.25 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
name: Python CI
# Run this workflow every time a new commit is pushed to repository
on: [pull_request, workflow_dispatch]
jobs:
run-unit-tests:
name: Run all unit tests in code base
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
PYTHON_VERSION: 3.8
steps:
- uses: actions/checkout@v2
- name: Cache conda env
uses: actions/cache@v2
env:
# Increase this value to reset cache if environment_linux.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{hashFiles('environment_linux.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: tbv-v0
environment-file: environment_linux.yml
python-version: 3.8
- name: Environment setup
run: |
bash .github/scripts/setup.sh
pip install pytest-cov
pip install flake8
conda info
- name: Flake check
run: |
flake8 --max-line-length 120 --ignore E201,E202,E203,E231,W291,W293,E303,W391,E402,W503,E731 tbv
- name: Unit tests
run: |
pytest tests --cov tbv
coverage report