138 lines (114 loc) · 3.53 KB
/
github-deploy.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Online linter: https://rhysd.github.io/actionlint/
name: build
on:
push:
branches:
- master
paths-ignore:
- 'doc/**'
- 'README.md'
- 'README.rst'
- 'COPYING'
pull_request:
branches:
- master
paths-ignore:
- 'doc/**'
- 'README.md'
- 'README.rst'
- 'COPYING'
release:
types:
- published
env:
# Skip 32-bit platforms
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*"
CIBW_TEST_REQUIRES: pytest pytest-xdist
CIBW_TEST_EXTRAS: "test"
CIBW_TEST_COMMAND: pytest -n 3 {project}/sumu/tests
# Trying to deal with https://github.com/scipy/scipy/issues/16308
CIBW_BEFORE_ALL_LINUX: yum -y update & yum -y install openblas-devel
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} ${{ matrix.CIBW_BUILD }}
runs-on: ${{ matrix.os }}
env:
CIBW_BUILD: ${{ matrix.CIBW_BUILD }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
CIBW_BUILD: [cp37-*, cp38-*, cp39-*]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.2.2
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
# Apparently no way to read these from pyproject.toml
# https://stackoverflow.com/a/58756491
- name: Install build dependencies
run: pip install cython>=0.29.17 numpy
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
coverage_analysis:
name: Test coverage analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
# Apparently no way to read these from pyproject.toml
# https://stackoverflow.com/a/58756491
- name: Install build dependencies
run: pip install cython>=0.29.17 numpy
- name: Install package and run tests
env:
CYTHON_TRACE: 1
run: |
python -m pip install pytest==6.2.1 coverage==5.3.1 pytest-cov==2.10.1 pytest-xdist==2.2.0 psutil
# Without "--editable" pip builds a wheel which doesn't allow Cython coverage analysis
python -m pip install --editable .
mkdir codecov && pytest -n 2 -v --cov=. --cov-report=xml:codecov/coverage.xml
- name: Upload coverage.xml to Codecov
uses: codecov/codecov-action@v1
with:
directory: codecov
fail_ci_if_error: true
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
# Uncomment for testing
# repository_url: https://test.pypi.org/legacy/