name: CI on: push: branches: - main tags: - '**' pull_request: permissions: contents: read env: FORCE_COLOR: 1 jobs: lint: runs-on: ubuntu-latest continue-on-error: true steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: python-version: '3.14' enable-cache: true # zizmor: ignore[cache-poisoning] -- Job does not produce release artifacts and does not have sensitive permissions - name: Install dependencies # Install pip for pre-commit run: | uv sync --group lint uv pip install pip - name: Run Ruff formatter run: make format-diff - name: Run Ruff linter run: make lint-github - name: Run Pyright run: make typecheck - name: Run pre-commit uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 with: extra_args: --all-files --verbose env: # https://pre-commit.com/#temporarily-disabling-hooks: SKIP: no-commit-to-branch UV_NO_PROGRESS: '1' test: name: Run tests strategy: fail-fast: false matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: python-version: ${{ matrix.python-version }} enable-cache: true # zizmor: ignore[cache-poisoning] -- Job does not produce release artifacts and does not have sensitive permissions - name: Install dependencies run: uv sync --group tests - name: Run tests run: make test env: COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }} - name: Store coverage files uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: coverage-${{ matrix.os }}-${{ matrix.python-version }} path: coverage include-hidden-files: true test-typing-extensions: name: Run test on typing-extensions runs-on: ubuntu-latest strategy: fail-fast: false matrix: typing-extensions: [main, lowest] python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: python-version: ${{ matrix.python-version }} enable-cache: true # zizmor: ignore[cache-poisoning] -- Job does not produce release artifacts and does not have sensitive permissions - name: Install dependencies and typing-extensions main run: | uv sync --group tests uv pip install 'typing-extensions @ git+https://github.com/python/typing_extensions.git' if: matrix.typing-extensions == 'main' - name: Install lowest dependencies run: uv sync --group tests --resolution lowest-direct if: matrix.typing-extensions == 'lowest' - name: Run tests run: make test docs: name: Build and check documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: python-version: '3.13' enable-cache: true # zizmor: ignore[cache-poisoning] -- Job does not produce release artifacts and does not have sensitive permissions - name: Install dependencies run: uv sync --group docs - run: uv run mkdocs build coverage-combine: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: python-version: '3.14' enable-cache: true # zizmor: ignore[cache-poisoning] -- Job does not produce release artifacts and does not have sensitive permissions - name: Install dependencies run: uv sync --no-install-project --only-group tests - name: Get coverage files uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: merge-multiple: true pattern: coverage-* path: coverage - run: | ls -la coverage/ uv run coverage combine coverage/ uv run coverage report uv run coverage html --show-contexts --title "typing-inspection coverage for ${{ github.sha }}" env: UV_NO_SYNC: '1' - name: Store coverage data uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: coverage-data path: .coverage include-hidden-files: true - name: Store coverage HTML uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: coverage-html path: htmlcov coverage-pr-comment: needs: coverage-combine runs-on: ubuntu-latest if: github.event_name == 'pull_request' permissions: pull-requests: write contents: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Download coverage data uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: coverage-data - name: Generate coverage comment id: coverage-comment uses: py-cov-action/python-coverage-comment-action@5d8df5979747514c914e1c5a12335a7cf9a2745f # v4.1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Store coverage comment uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 if: steps.coverage-comment.outputs.COMMENT_FILE_WRITTEN == 'true' with: name: python-coverage-comment-action path: python-coverage-comment-action.txt check: if: always() outputs: result: ${{ steps.all-green.outputs.result }} needs: - lint - test - docs - test-typing-extensions - coverage-combine runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 id: all-green with: jobs: ${{ toJSON(needs) }} release: needs: check if: needs.check.outputs.result == 'success' && startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest environment: release permissions: id-token: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: python-version: '3.14' enable-cache: false - run: uv sync --no-install-project --only-group build - name: Check version uses: samuelcolvin/check-python-version@ee87cddb8049d2694cc03badc8569765a05cef00 # v5 with: version_file_path: pyproject.toml - name: Build library run: uv run --no-sync python -m build - name: Upload package to PyPI uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2