ci(pre-commit.ci): autoupdate (#39) #945
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*] | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" # run daily | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-manifest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: pipx run check-manifest | |
| test: | |
| name: >- | |
| Test ${{ matrix.os }} py${{ matrix.python-version }} | |
| ${{ matrix.pydantic }} | |
| ${{ matrix.resolution != 'highest' && matrix.resolution || '' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| pydantic: ["pydantic"] | |
| resolution: ["highest"] | |
| include: | |
| - os: ubuntu-latest | |
| python-version: "3.12" | |
| pydantic: "'pydantic<2'" | |
| pydantic-label: "pydantic-v1" | |
| - os: ubuntu-latest | |
| python-version: "3.11" | |
| pydantic: "pydantic" | |
| resolution: "lowest-direct" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Dependencies | |
| run: uv sync --group test | |
| env: | |
| UV_NO_DEV: 1 | |
| UV_RESOLUTION: ${{ matrix.resolution || 'highest' }} | |
| UV_PRERELEASE: ${{ github.event_name == 'schedule' && 'allow' || 'if-necessary-or-explicit' }} | |
| - name: Install pydantic variant | |
| if: matrix.pydantic != 'pydantic' | |
| run: uv pip install ${{ matrix.pydantic }} | |
| - name: Test | |
| run: uv run --no-sync coverage run -p -m pytest -v | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: covreport-${{ matrix.os }}-py${{ matrix.python-version }}-${{ matrix.pydantic-label || 'pydantic' }}-${{ matrix.resolution }} | |
| path: ./.coverage* | |
| include-hidden-files: true | |
| upload_coverage: | |
| if: always() | |
| needs: [test] | |
| uses: pyapp-kit/workflows/.github/workflows/upload-coverage.yml@v2 | |
| secrets: inherit | |
| build-and-inspect-package: | |
| name: Build & inspect package. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: hynek/build-and-inspect-python-package@v2 | |
| upload-to-pypi: | |
| name: Upload package to PyPI | |
| needs: [test, build-and-inspect-package] | |
| if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Download built artifact to dist/ | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: Packages | |
| path: dist | |
| - name: 🚢 Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: "./dist/*" |