Merge pull request #3 from QTSurfer/feat/regenerate-for-spec-0.99.2 #16
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: | |
| push: | |
| branches: [main] | |
| tags: ["v[0-9]+.[0-9]+.[0-9]+"] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: lint + mypy + pytest (py${{ matrix.python }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python }} | |
| run: uv python install ${{ matrix.python }} | |
| - name: Sync dependencies | |
| run: uv sync --frozen --python ${{ matrix.python }} | |
| - name: Ruff (lint) | |
| run: uv run ruff check src/ tests/ | |
| - name: Ruff (format) | |
| run: uv run ruff format --check src/ tests/ | |
| - name: Mypy (--strict) | |
| run: uv run mypy src/ tests/ | |
| - name: Pytest | |
| run: uv run pytest -v | |
| build: | |
| name: build wheel + sdist | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Sync dependencies | |
| run: uv sync --frozen | |
| - name: Fetch openapi.yaml | |
| run: curl -fsSL https://raw.githubusercontent.com/QTSurfer/qtsurfer.github.io/main/openapi.yaml -o openapi.yaml | |
| - name: Verify pyproject.toml version matches openapi.yaml | |
| run: | | |
| PYPROJECT_VERSION=$(uv run python -c "import tomllib; print(tomllib.loads(open('pyproject.toml','rb').read().decode())['project']['version'])") | |
| SPEC_VERSION=$(uv run python -c "import yaml; print(yaml.safe_load(open('openapi.yaml'))['info']['version'])") | |
| echo "pyproject: $PYPROJECT_VERSION" | |
| echo "openapi: $SPEC_VERSION" | |
| if [ "$PYPROJECT_VERSION" != "$SPEC_VERSION" ]; then | |
| echo "::error::pyproject.toml version ($PYPROJECT_VERSION) does not match openapi.yaml info.version ($SPEC_VERSION). Run scripts/regenerate.sh." | |
| exit 1 | |
| fi | |
| - name: Build | |
| run: uv run python -m build | |
| - name: Twine check | |
| run: uv run twine check dist/* | |
| - name: Upload artefacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ |