-
Notifications
You must be signed in to change notification settings - Fork 19
55 lines (47 loc) · 1.64 KB
/
ci.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
# tox enviroments that run on both pull requests and merge to main
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
strategy:
# fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, '3.10']
# you can separate the tox-envs in different .yml files
# see version 0.10.1
# https://github.com/joaomcteixeira/python-project-skeleton/releases/tag/v0.10.1
# below the list of tox envs that you wish to include in the matrix
tox-envs: [docs, lint, build, test, pr]
# workaround to ignore 'pr' when merging to main
# see: https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6
isMerge:
- ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
exclude:
- isMerge: true
tox-envs: pr
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install tox
- name: unit tests
run: tox -e ${{ matrix.tox-envs }}
# from https://github.com/codecov/codecov-action
- name: Upload coverage to Codecov
if: matrix.tox-envs == 'test'
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
fail_ci_if_error: true
verbose: true