99 lines
2.7 KiB
YAML
99 lines
2.7 KiB
YAML
name: "CI/CD"
|
|
on:
|
|
- push
|
|
- pull_request
|
|
env:
|
|
DEFAULT_PYTHON: 3.9
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- windows-latest
|
|
- macos-latest
|
|
python-version:
|
|
- 2.7
|
|
- 3.5
|
|
- 3.6
|
|
- 3.7
|
|
- 3.8
|
|
- 3.9
|
|
exclude:
|
|
- os: windows-latest
|
|
python-version: 2.7
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: setup python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: update build tools
|
|
run: python -m pip install --upgrade setuptools pip
|
|
- name: install test runner
|
|
run: python -m pip install tox tox-gh-actions
|
|
- name: run test suite
|
|
run: tox
|
|
env:
|
|
TOX_OS: ${{ matrix.os }}
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
distribution:
|
|
- sdist
|
|
- wheel
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: setup python ${{ env.DEFAULT_PYTHON }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
- name: install build tool
|
|
run: python -m pip install build
|
|
- name: build ${{ matrix.distribution }}
|
|
run: python -m build --$DIST
|
|
env:
|
|
DIST: ${{ matrix.distribution }}
|
|
- name: upload ${{ matrix.distribution }} artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.distribution }}
|
|
path: dist/
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name == 'push' }}
|
|
needs:
|
|
- test
|
|
- build
|
|
steps:
|
|
- name: setup python ${{ env.DEFAULT_PYTHON }}
|
|
uses: actions/setup-python@v2
|
|
- name: download sdist artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: sdist
|
|
path: dist/
|
|
- name: download wheel artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: wheel
|
|
path: dist/
|
|
- name: publish built artifacts to test.pypi.org
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
repository_url: https://test.pypi.org/legacy/
|
|
skip_existing: true
|
|
- name: publish built artifacts to pypi.org
|
|
if: ${{ startsWith(github.ref, 'refs/tag') }}
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|