chore: update min uv-build version #192
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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_COLOR: "3" | |
| UVX_CONSTRAINT: requirements/lock/uvx-tools.txt | |
| UVX_COMMAND: uvx -crequirements/lock/uvx-tools.txt | |
| NOX_COMMAND: uvx -crequirements/lock/uvx-tools.txt nox | |
| # EXTRA_PYTHON_VERSIONS: "pypy-3.11" | |
| permissions: {} | |
| jobs: | |
| pre_job: | |
| # continue-on-error: true # Uncomment once integration is finished | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
| steps: | |
| - name: Don't run CI on draft PR | |
| if: | |
| github.event_name == 'pull_request' && github.event.pull_request.draft | |
| == true | |
| run: exit 1 | |
| - id: skip_check | |
| uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
| with: | |
| paths_ignore: '[".cruft.json", ".copier.yml"]' | |
| get-parameters: | |
| name: Get parameters | |
| needs: pre_job | |
| if: needs.pre_job.outputs.should_skip != 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Set python version parameters | |
| id: versions | |
| shell: python | |
| run: | | |
| import os | |
| import json | |
| import re | |
| import tomllib | |
| from pathlib import Path | |
| python_versions = [] | |
| for classifier in tomllib.loads(Path("pyproject.toml").read_text())["project"]["classifiers"]: | |
| if match := re.match(r"Programming Language :: Python :: (\d+\.\d+)$", classifier): | |
| python_versions.append(match.group(1)) | |
| default_python_version = Path(".python-version").read_text().strip() | |
| extra_python_versions = [_.strip() for _ in os.getenv("EXTRA_PYTHON_VERSIONS", "").split(",") if _] | |
| min_python_version = python_versions[0] | |
| max_python_version = python_versions[-1] | |
| minmax_python_versions = [min_python_version, max_python_version, *extra_python_versions] | |
| minmax_default_python_versions = list({*minmax_python_versions, default_python_version}) | |
| all_python_versions = list({*python_versions, *extra_python_versions}) | |
| print("{default_python_version=:s}") | |
| print("{min_python_version=:s}") | |
| print("{max_python_version=:s}") | |
| print("{minmax_python_versions=}") | |
| print("{minmax_default_python_versions=}") | |
| print("{all_python_version=}") | |
| with open(os.getenv("GITHUB_OUTPUT"), "a") as f: | |
| f.write(f"{default_python_version=:s}\n") | |
| f.write(f"{min_python_version=:s}\n") | |
| f.write(f"{max_python_version=:s}\n") | |
| f.write(f"minmax_python_versions={json.dumps(minmax_python_versions)}\n") | |
| f.write(f"minmax_default_python_versions={json.dumps(minmax_default_python_versions)}\n") | |
| f.write(f"all_python_versions={json.dumps(all_python_versions)}\n") | |
| outputs: | |
| default-python-version: | |
| ${{ steps.versions.outputs.default_python_version }} | |
| min-python-version: ${{ steps.versions.outputs.min_python_version }} | |
| max-python-version: ${{ steps.versions.outputs.max_python_version }} | |
| minmax-python-versions: | |
| ${{ steps.versions.outputs.minmax_python_versions }} | |
| minmax-default-python-versions: | |
| ${{ steps.versions.outputs.minmax_default_python_versions }} | |
| all-python-version: ${{ steps.versions.outputs.all_python_versions }} | |
| lint: | |
| # only run checks not covered by pre-commit.ci | |
| name: Lint package | |
| needs: pre_job | |
| if: needs.pre_job.outputs.should_skip != 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| # Not always needed but some hooks use it... | |
| - uses: ./.github/actions/setup-cached-uv-and-python | |
| with: | |
| python-version-file: ".python-version" | |
| cache-dependency-path: uv.lock | |
| - name: Get prek version | |
| shell: bash | |
| run: | | |
| prek_version=$(grep prek "$UVX_CONSTRAINT" | cut -d " " -f1 | sed "s/prek==//") | |
| echo "prek_version: ${prek_version}" | |
| echo "prek_version=${prek_version}" >> "$GITHUB_ENV" | |
| - name: Setup prek | |
| uses: j178/prek-action@0bb87d7f00b0c99306c8bcb8b8beba1eb581c037 # v1.1.0 | |
| with: | |
| prek-version: ${{ env.prek_version }} | |
| install-only: true | |
| - name: Run prek | |
| env: | |
| SKIP: "typecheck" | |
| run: >- | |
| prek run --show-diff-on-failure --color=always --all-files | |
| --hook-stage=manual -v | |
| pinact: | |
| name: Pin actions | |
| needs: pre_job | |
| if: needs.pre_job.outputs.should_skip != 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Pin actions | |
| uses: suzuki-shunsuke/pinact-action@1081f5ad49ac904b7d977784f338145150a32112 # v1.4.0 | |
| with: | |
| skip_push: "true" | |
| typecheck: | |
| name: Typecheck package | |
| needs: pre_job | |
| if: needs.pre_job.outputs.should_skip != 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| # - windows-latest | |
| session: | |
| - typecheck | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup-cached-uv-and-python | |
| with: | |
| python-version-file: ".python-version" | |
| cache-dependency-path: uv.lock | |
| - name: Get python version | |
| id: python_version | |
| run: | | |
| python_version=$(cat .python-version) | |
| echo "python_version=${python_version}" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: typecheck | |
| env: | |
| python_version: ${{ steps.python_version.outputs.python_version }} | |
| session: ${{ matrix.session }} | |
| run: $NOX_COMMAND -s "${session}-${python_version}" | |
| shell: bash | |
| test: | |
| name: Test package across pythons | |
| needs: | |
| - pre_job | |
| - get-parameters | |
| if: needs.pre_job.outputs.should_skip != 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| python-version: | |
| - ${{ needs.get-parameters.outputs.default-python-version }} | |
| markers: | |
| - "default and cookie" | |
| - "book and argparse and copier" | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 # needed for copier | |
| - uses: ./.github/actions/setup-cached-uv-and-python | |
| with: | |
| python-version: | | |
| ${{ needs.get-parameters.outputs.min-python-version }} | |
| ${{ needs.get-parameters.outputs.default-python-version }} | |
| ${{ matrix.python-version }} | |
| cache-dependency-path: uv.lock | |
| - name: Setup git | |
| run: | | |
| git config --global init.defaultBranch main | |
| - uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3.1.0 | |
| - name: Test with nox | |
| env: | |
| python_version: ${{ matrix.python-version }} | |
| run: >- | |
| $UVX_COMMAND nox -s test-"$python_version" -- ++no-cov ++test-options | |
| -m \'${{ matrix.markers }}\' | |
| shell: bash | |
| # - name: Upload coverage data | |
| # uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| # with: | |
| # name: coverage-data-${{ matrix.os }}-${{ matrix.python-version }} | |
| # path: .nox/test-*/tmp/.coverage* | |
| # include-hidden-files: true | |
| # if-no-files-found: ignore | |
| # coverage: | |
| # name: Combine coverage | |
| # needs: | |
| # - pre_job | |
| # - test | |
| # if: needs.pre_job.outputs.should_skip != 'true' | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| # with: | |
| # persist-credentials: false | |
| # - name: Download individual coverage reports | |
| # uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 | |
| # with: | |
| # pattern: coverage-data-* | |
| # path: .nox | |
| # merge-multiple: true | |
| # - name: Display structure of downloaded files | |
| # run: ls -aR | |
| # - uses: ./.github/actions/setup-cached-uv-and-python | |
| # with: | |
| # python-version-file: ".python-version" | |
| # cache-dependency-path: requirements/lock/uvx-tools.txt | |
| # - name: Run coverage | |
| # run: | | |
| # $NOX_COMMAND -s coverage -- ++coverage combine html markdown | |
| # cat coverage.md | |
| # cat coverage.md >> "$GITHUB_STEP_SUMMARY" | |
| # # fail if under 100% | |
| # $NOX_COMMAND -s coverage -- ++coverage report ++coverage-options --fail-under=100 | |
| # shell: bash | |
| # - name: Upload HTML report if check failed. | |
| # uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| # with: | |
| # name: html-report | |
| # path: htmlcov | |
| # if: ${{ failure() }} | |
| docs: | |
| needs: pre_job | |
| if: needs.pre_job.outputs.should_skip != 'true' | |
| permissions: | |
| contents: write | |
| uses: ./.github/workflows/docs.yml | |
| with: | |
| deploy: false | |
| # Ensure everything required is passing for branch protection. | |
| required-checks-pass: | |
| if: always() | |
| needs: | |
| - pre_job | |
| - lint | |
| - pinact | |
| - typecheck | |
| - test | |
| # - coverage | |
| - docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 | |
| with: | |
| allowed-skips: "lint,pinact,typecheck,test,coverage,docs" | |
| jobs: ${{ toJSON(needs) }} |