[pre-commit.ci] pre-commit autoupdate #65
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: Python Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: pip | |
- name: Install dependencies | |
run: python3 -m pip install build | |
- name: Build | |
run: make dist | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: ./dist | |
retention-days: 1 | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
path: ./dist | |
- name: Install dependencies | |
run: python3 -m pip install "$(find ./dist -name '*-py3-none-any.whl' | tail -1)[test]" | |
- name: Test | |
run: make test | |
- name: Upload coverage reports | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
publish: | |
needs: test | |
if: github.event_name == 'release' && github.event.action == 'published' | |
permissions: | |
id-token: write | |
environment: | |
name: release | |
url: https://pypi.org/project/${{ github.event.repository.name }}/ | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
path: ./dist | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 |