Merge pull request #446 from damar-wicaksono/dev #740
Workflow file for this run
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: Testing and packaging | |
on: | |
- push | |
jobs: | |
format: | |
name: Check code formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run black | |
run: tox -e format | |
lint: | |
name: Check code linting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run flake8 | |
run: tox -e lint | |
typecheck: | |
name: Static type checking | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run mypy | |
run: tox -e typecheck | |
test: | |
name: Test | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python: | |
- version: "3.7" | |
toxenv: "py37" | |
- version: "3.8" | |
toxenv: "py38" | |
- version: "3.9" | |
toxenv: "py39" | |
- version: "3.11" | |
toxenv: "py311" | |
- version: "3.12" | |
toxenv: "py312" | |
- version: "3.13" | |
toxenv: "py313" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python.version }} | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run pytest | |
run: tox -e ${{ matrix.python.toxenv }} | |
coverage: | |
name: Test (on Python 3.10) w/ coverage to CodeCov | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run pytest | |
run: tox -e "py310" -- --cov-report=xml --cov-report=term | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
build_wheels: | |
name: Build wheels on Ubuntu 20.04 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- name: Install build | |
run: python -m pip install build | |
- name: Build wheels | |
run: python -m build --wheel | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./dist/*.whl | |
build_sdist: | |
name: Build source distribution on Ubuntu 20.04 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- name: Install build | |
run: python -m pip install build | |
- name: Build wheels | |
run: python -m build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./dist/*.tar.gz | |
publish: | |
name: Publish package | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
needs: | |
- format | |
- lint | |
- typecheck | |
- test | |
- coverage | |
- build_wheels | |
- build_sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: ./dist/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |