Increment CI python version #214
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 | |
on: | |
push: | |
branches: | |
- "master" | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- "master" | |
workflow_dispatch: | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: | | |
pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "poetry" | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: ruff check | |
run: | | |
poetry run ruff check src tests docs | |
- name: Check twine | |
shell: bash | |
# TODO: Renable the dist/* line. Currently failing to check the whl | |
run: | | |
poetry build | |
# poetry run twine check dist/* | |
poetry run twine check dist/*.tar.gz | |
test: | |
name: Test | |
needs: check | |
strategy: | |
matrix: | |
os: [ubuntu, macos, windows] | |
fail-fast: true | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: | | |
pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "poetry" | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Run tests | |
run: | | |
poetry run pytest | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: test | |
# Run only on pushing a tag starting with v | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: | | |
pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "poetry" | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Build | |
run: | | |
poetry build | |
- name: Configure PyPI | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
poetry config pypi-token.pypi "$PYPI_TOKEN" | |
- name: Publish to PyPI | |
run: | | |
poetry publish | |
# I suppose this is kinda useful to have, but, really, its just so that the mkdocs scraper | |
# can determine the latest version number in its github section. | |
- name: Github release | |
shell: bash | |
run: | | |
gh release create --generate-notes ${{ github.ref }} dist/* | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |