-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (60 loc) · 2.05 KB
/
publish.yaml
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
name: Build and Publish Package to Pypi
on:
push:
branches:
- "main"
jobs:
tests:
strategy:
matrix:
python-version: [3.7, 3.8]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install from source (required for the pre-commit tests)
run: pip install ".[all]"
- name: Install dependencies
run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# install black if available (Python 3.6 and above), and autopep8 for testing the pipe mode
pip install black || true
pip install autopep8 || true
- name: Lint with flake8
run: |
pip install flake8==3.8.3
pip install flake8-black==0.2.1
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# all Python files should follow PEP8
# echo "flake8 all python"
# flake8 durst tests
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
echo "flake8 BLK"
flake8 durst --count --exit-zero --max-complexity=18 --statistics --select BLK
- name: Test with pytest
run: nosetests
build-n-publish:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Generate dist
run: python setup.py sdist
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}