This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
Archived repository #203
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
- 3.8 | |
- 3.9 | |
- '3.10' | |
- '3.11' | |
include: | |
- os: ubuntu-20.04 | |
python-version: 3.5 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
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@v3 | |
- name: setup python ${{ env.DEFAULT_PYTHON }} | |
uses: actions/setup-python@v4 | |
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@v3 | |
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@v4 | |
- name: download sdist artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: sdist | |
path: dist/ | |
- name: download wheel artifact | |
uses: actions/download-artifact@v3 | |
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 }} |