|
1 | 1 | name: build
|
2 | 2 |
|
3 |
| -on: [push] |
| 3 | +on: [push, pull_request] |
4 | 4 |
|
5 | 5 | jobs:
|
6 | 6 | build:
|
7 | 7 |
|
8 | 8 | runs-on: ubuntu-latest
|
| 9 | + |
9 | 10 | strategy:
|
| 11 | + fail-fast: false |
10 | 12 | 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 | + |
13 | 15 | steps:
|
14 |
| - - uses: actions/checkout@v2 |
15 |
| - - name: Set up Python ${{ matrix.python-version }} |
| 16 | + - uses: actions/checkout@v1 |
| 17 | + - name: Set up Python |
16 | 18 | uses: actions/setup-python@v1
|
17 | 19 | with:
|
18 |
| - python-version: ${{ matrix.python-version }} |
19 |
| - - name: Install dependencies |
| 20 | + python-version: ${{ matrix.python }} |
| 21 | + - name: Install tox |
20 | 22 | run: |
|
21 | 23 | python -m pip install --upgrade pip
|
22 |
| - pip install -r requirements.txt |
23 |
| - - name: Lint with flake8 |
| 24 | + pip install tox |
| 25 | + - name: Test |
24 | 26 | 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 |
31 | 44 | 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