83 lines
1.8 KiB
YAML
83 lines
1.8 KiB
YAML
name: Test and Publish
|
|
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
name: run-tests
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name != 'pull_request' ||
|
|
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.10"
|
|
- "3.11"
|
|
- "3.12"
|
|
- "3.13"
|
|
- "3.14"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
# Install a specific version of uv.
|
|
version: "0.6.14"
|
|
enable-cache: true
|
|
cache-dependency-glob: "uv.lock"
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --all-extras --dev
|
|
|
|
- name: Run tests
|
|
run: |
|
|
uv run poe tests
|
|
uv run poe tests-report
|
|
|
|
- name: Static type check
|
|
run: uv run poe type-check
|
|
|
|
- name: Upload coverage reports to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
if: matrix.python-version == '3.10'
|
|
|
|
publish:
|
|
name: publish
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [test]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
# Install a specific version of uv.
|
|
version: "0.6.14"
|
|
enable-cache: true
|
|
cache-dependency-glob: "uv.lock"
|
|
|
|
- name: Set up Python
|
|
run: uv python install
|
|
|
|
- name: Build source distribution
|
|
run: uv build --sdist
|
|
|
|
- name: Publish
|
|
run: uv publish -t ${{ secrets.PYPI_TOKEN }} |