Skip to content

Commit 7ad5d55

Browse files
committed
Add CI config
1 parent d7579bd commit 7ad5d55

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build and upload to PyPI
2+
3+
# Build on every branch push, tag push, and pull request change:
4+
# on: [push, pull_request]
5+
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
6+
on:
7+
# push:
8+
# pull_request:
9+
release:
10+
types:
11+
- published
12+
13+
env:
14+
CIBW_SKIP: cp27-* pp27-* cp35-* # skip python2.7 builds, python3.5 EOL
15+
16+
jobs:
17+
build_wheels:
18+
name: Build wheels on ${{ matrix.os }}
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest, macos-latest]
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- uses: actions/setup-python@v2
28+
name: Install Python
29+
with:
30+
python-version: '3.7'
31+
32+
- name: Install cibuildwheel
33+
run: |
34+
python -m pip install git+https://github.com/joerick/cibuildwheel.git@master
35+
36+
- name: Build wheels
37+
run: |
38+
python -m cibuildwheel --output-dir wheelhouse
39+
- uses: actions/upload-artifact@v2
40+
with:
41+
path: ./wheelhouse/*.whl
42+
43+
build_sdist:
44+
name: Build source distribution
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
49+
- uses: actions/setup-python@v2
50+
name: Install Python
51+
with:
52+
python-version: '3.7'
53+
54+
- name: Build sdist
55+
run: python setup.py sdist
56+
57+
- uses: actions/upload-artifact@v2
58+
with:
59+
path: dist/*.tar.gz
60+
61+
upload_pypi:
62+
needs: [build_wheels, build_sdist]
63+
runs-on: ubuntu-latest
64+
# upload to PyPI on every tag starting with 'v'
65+
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
66+
# alternatively, to publish when a GitHub Release is created, use the following rule:
67+
if: github.event_name == 'release' && github.event.action == 'published'
68+
steps:
69+
- uses: actions/download-artifact@v2
70+
with:
71+
name: artifact
72+
path: dist
73+
74+
- uses: pypa/gh-action-pypi-publish@master
75+
with:
76+
user: __token__
77+
password: ${{ secrets.pypi_password }}
78+
# To test: repository_url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)