tests #238
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: ["main"] | |
pull_request: | |
schedule: | |
- cron: "0 8 * * *" | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- uses: pre-commit/action@v3.0.0 | |
tests: | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", " 3.12"] | |
os: [ubuntu-latest] | |
include: | |
- os: windows-latest | |
python-version: "3.12" | |
- os: macos-latest | |
python-version: "3.12" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip hatch | |
- name: Run tests | |
run: hatch run test:test -x | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip hatch | |
- name: Build docs | |
run: | | |
hatch run doc:build | |
publish: | |
name: Publish to PyPi | |
needs: [tests] | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Build package | |
run: | | |
pip install wheel | |
python setup.py sdist bdist_wheel | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@v1.8.11 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_KEY }} |