Better linting #112
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 package | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
check-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up UV cache | |
if: runner.os == 'Linux' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }} | |
restore-keys: ${{ runner.os }}-uv- | |
- name: Install UV | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Run tests | |
run: uv run project.py test --cov | |
- name: Run lint | |
run: uv run project.py lint style types docs | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.python-version }} | |
path: ${{ github.workspace }}/.coverage | |
include-hidden-files: true | |
- name: Build dist | |
run: uv build | |
check-coverage: | |
runs-on: ubuntu-latest | |
needs: check-tests | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 50 | |
- name: Set up UV cache | |
if: runner.os == 'Linux' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/uv | |
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }} | |
restore-keys: ${{ runner.os }}-uv- | |
- name: Download coverage | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-3.12 | |
- run: git fetch origin main | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install UV | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Check coverage | |
run: uv run project.py test --only-cov-report |