Tests #438
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: Tests | |
on: | |
push: | |
branches: [master] | |
tags: [v*] | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 6 * * 0" | |
jobs: | |
tests: | |
name: ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
# Checks | |
- { name: 'Lint', tox: lint, python: '3.8' } | |
- { name: 'Type checking', tox: mypy, python: '3.8' } | |
- { name: 'Twine check', tox: twine, python: '3.8' } | |
# Test using Click 8 | |
- { name: 'Python 3.7, Click 8', tox: 'py37-click8', python: '3.7' } | |
- { name: 'Python 3.8, Click 8', tox: 'py38-click8', python: '3.8' } | |
- { name: 'Python 3.9, Click 8', tox: 'py39-click8', python: '3.9' } | |
- { name: 'Python 3.10, Click 8', tox: 'py310-click8', python: '3.10' } | |
- { name: 'Python 3.11, Click 8', tox: 'py311-click8', python: '3.11' } | |
# Docs | |
- { name: 'Docs', tox: docs, python: '3.8' } | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U wheel | |
pip install -U setuptools | |
pip install "tox < 4" | |
- name: Run tox -e ${{ matrix.tox }} | |
run: tox -e ${{ matrix.tox }} | |
- name: Install and run codecov (py38-click8 only) | |
if: ${{ matrix.tox == 'py38-click8' }} | |
run: | | |
pip install codecov | |
codecov | |
publish: # only if tests passed and this is a tagged commit. | |
name: Publish package to PyPI | |
needs: tests | |
if: > | |
startsWith(github.ref, 'refs/tags/v') && | |
github.repository == 'janluke/cloup' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python 3.7 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.7 | |
- name: Install pypa/build | |
run: python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python -m build . --sdist --wheel --outdir dist/ | |
- name: Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |