ci: simplify branching, harden release, update PyPI publishing flow #1
Workflow file for this run
This file contains hidden or 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: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: pr-${{ github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint (ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "poetry" | |
| - name: Install dependencies | |
| run: poetry install --with dev | |
| - name: Run ruff check | |
| run: poetry run ruff check . | |
| - name: Run ruff format check | |
| run: poetry run ruff format --check . | |
| typecheck: | |
| name: Type check (pyright) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "poetry" | |
| - name: Install dependencies | |
| run: poetry install --with dev | |
| - name: Run pyright | |
| run: poetry run pyright | |
| build: | |
| name: Build package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "poetry" | |
| - name: Install dependencies | |
| run: poetry install --only main | |
| - name: Build package | |
| run: poetry build | |
| - name: Check package | |
| run: | | |
| python -m pip install --upgrade twine | |
| twine check dist/* | |
| tests: | |
| name: Tests (Python ${{ matrix.python-version }}, ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "poetry" | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run unit tests | |
| run: poetry run pytest tests/ -v |