-
Notifications
You must be signed in to change notification settings - Fork 75
104 lines (93 loc) · 2.99 KB
/
on-push.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
95
96
97
98
99
100
101
102
103
104
name: on-push
on: [push]
jobs:
unit-tests:
runs-on: ${{ matrix.os }}-latest
strategy:
max-parallel: 5
matrix:
os: [ubuntu]
python: [3.6, 3.7, 3.8, 3.9]
extras: ['']
include:
- os: macos
python: 3.8
- os: ubuntu
python: 3.8
- os: ubuntu
python: 3.8
extras: -minimal
- os: windows
python: 3.8
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python }}
activate-environment: ${{ matrix.os }}-${{ matrix.python }}${{ matrix.extras }}
environment-file: tests/environment-${{ matrix.os }}-${{ matrix.python }}${{ matrix.extras }}.yml
- name: Test with pytest
shell: bash -l {0}
run: |
conda install pytest pytest-cov pytest-mock
pip install --no-deps -e .
pytest -v --cov=. --cov-report=xml .
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
activate-environment: ubuntu-3.8
environment-file: tests/environment-ubuntu-3.8.yml
- name: Build documentation with Sphinx
shell: bash -l {0}
run: |
conda install sphinx sphinx_rtd_theme
pip install --no-deps -e .
python setup.py build_sphinx
- name: Test README with pytest
shell: bash -l {0}
run: |
conda install pytest pytest-cov
pytest -v --cov=. --cov-report=xml --cov-branch README.rst
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint with flake8
run: |
$CONDA/bin/conda install flake8
# stop the build if there are Python syntax errors or undefined names
$CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
$CONDA/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
code-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check code style with black
run: |
$CONDA/bin/conda install black
$CONDA/bin/black --check .
- name: Check code style with isort
run: |
$CONDA/bin/conda install isort
$CONDA/bin/isort .
distribution:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build distributions
run: |
$CONDA/bin/conda install pip setuptools wheel
$CONDA/bin/python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}