Skip to content

Commit 8d56b2d

Browse files
committed
Configure GitHub actions for build and deploy to PyPI
1 parent 613cca4 commit 8d56b2d

File tree

1 file changed

+38
-17
lines changed

1 file changed

+38
-17
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,54 @@
11
name: build
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
77

88
runs-on: ubuntu-latest
9+
910
strategy:
11+
fail-fast: false
1012
matrix:
11-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
12-
13+
python: ["2.7", "3.5", "3.6", "3.7", "3.8"]
14+
1315
steps:
14-
- uses: actions/checkout@v2
15-
- name: Set up Python ${{ matrix.python-version }}
16+
- uses: actions/checkout@v1
17+
- name: Set up Python
1618
uses: actions/setup-python@v1
1719
with:
18-
python-version: ${{ matrix.python-version }}
19-
- name: Install dependencies
20+
python-version: ${{ matrix.python }}
21+
- name: Install tox
2022
run: |
2123
python -m pip install --upgrade pip
22-
pip install -r requirements.txt
23-
- name: Lint with flake8
24+
pip install tox
25+
- name: Test
2426
run: |
25-
pip install flake8
26-
# stop the build if there are Python syntax errors or undefined names
27-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
28-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
29-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
30-
- name: Test with pytest
27+
tox -e py
28+
29+
deploy:
30+
31+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
32+
33+
runs-on: ubuntu-latest
34+
35+
needs: build
36+
37+
steps:
38+
- uses: actions/checkout@v1
39+
- name: Set up Python
40+
uses: actions/setup-python@v1
41+
with:
42+
python-version: "3.7"
43+
- name: Install wheel
3144
run: |
32-
pip install pytest
33-
pytest
45+
python -m pip install --upgrade pip
46+
pip install --upgrade wheel setuptools
47+
- name: Build package
48+
run: |
49+
python setup.py sdist bdist_wheel
50+
- name: Publish package to PyPI
51+
uses: pypa/gh-action-pypi-publish@master
52+
with:
53+
user: __token__
54+
password: ${{ secrets.pypi_token }}

0 commit comments

Comments
 (0)