update template (#41) #219
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: check | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
latest-python-version: 3.13 | |
jobs: | |
py-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: UV cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ matrix.python-version }}-uv-${{ hashFiles('pyproject.toml') }} | |
- name: Install UV | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: latest | |
python-version: ${{ matrix.python-version }} | |
enable-cache: true | |
cache-dependency-glob: '**/pyproject.toml' | |
- name: Run tests | |
run: uv run dev.py cov | |
- name: Upload coverage | |
if: matrix.python-version == env.latest-python-version | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-xml | |
include-hidden-files: true | |
path: ${{ github.workspace }}/coverage.xml | |
if-no-files-found: error | |
py-coverage: | |
runs-on: ubuntu-latest | |
needs: py-tests | |
if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch) | |
steps: | |
- uses: actions/checkout@v4 | |
with: {fetch-depth: 50} | |
- name: Download new coverage | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-xml | |
path: ${{ github.workspace }} | |
- name: Download old coverage | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
branch: ${{ github.event.pull_request.base.ref }} | |
name: coverage-xml | |
path: ${{ github.workspace }}/old-coverage | |
- name: UV cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ env.latest-python-version }}-uv-${{ hashFiles('pyproject.toml') }} | |
- run: git fetch origin main | |
- name: Install UV | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install Python | |
run: uv python install ${{ matrix.python-version }} | |
- name: Check coverage | |
run: uv run dev.py cov --no-test --old-coverage-xml=${{ github.workspace }}/old-coverage/coverage.xml | |
py-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: UV cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ env.latest-python-version }}-uv-${{ hashFiles('pyproject.toml') }} | |
- name: Install UV | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install Python | |
run: uv python install ${{ matrix.python-version }} | |
- name: Check lint | |
run: uv run dev.py lint --check | |
py-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: UV cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ env.latest-python-version }}-uv-${{ hashFiles('pyproject.toml') }} | |
- name: Install UV | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install Python | |
run: uv python install ${{ matrix.python-version }} | |
- name: Check lint | |
run: uv build | |
docs-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: UV cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-${{ env.latest-python-version }}-uv-${{ hashFiles('pyproject.toml') }} | |
- name: Install UV | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install Python | |
run: uv python install ${{ matrix.python-version }} | |
- name: Build docs | |
run: uv run dev.py docs build |