-
Notifications
You must be signed in to change notification settings - Fork 4
94 lines (77 loc) · 2.31 KB
/
unit_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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Unit Tests
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # allow manual triggering
defaults:
run:
shell: bash
jobs:
lint:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Run flake8 (lint)
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'lint' # NOTE: this needs to be the same as the job name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run black (code style)
uses: psf/black@stable
test-matrix:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
max-parallel: 5
steps:
- uses: actions/checkout@v2
- name: Create Python ${{ matrix.python-version }} environment
uses: mamba-org/provision-with-micromamba@main
# use main branch to enable choice of channel-priority
with:
cache-env: true
cache-env-key: env-key-${{ matrix.python-version }}
channel-priority: flexible
environment-file: environment.yml
environment-name: anaconda-test-env-py-${{ matrix.python-version }}
- name: Initial diagnostics
run: |
micromamba info
micromamba list
conda config --show-sources
conda config --show
micromamba env list
printenv | sort
- name: micromamba env & list
run: |
micromamba env list
micromamba list
- name: Run tests with pytest & coverage
shell: bash -l {0}
run: |
python -m pip install pytest coverage coveralls
coverage run --concurrency=thread --parallel-mode -m pytest -vvv .
coverage combine
coverage report --precision 3
- name: Upload to coveralls
# https://github.com/TheKevJames/coveralls-python
shell: bash -l {0}
run: |
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}