Skip to content

Commit 9ae2900

Browse files
authored
Run pre-commit via uv in CI (astral-sh#17052)
Installing pre-commit via pip can take up to 6s sometimes in CI (e.g. https://github.com/astral-sh/ruff/actions/runs/14137246278/job/39611795976). Installing pre-commit via uv should be faster. It also simplifies the workflow and improves the amount we're dogfooding our own tools
1 parent 37a40e3 commit 9ae2900

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,7 @@ jobs:
648648
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
649649
with:
650650
persist-credentials: false
651-
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
652-
with:
653-
python-version: ${{ env.PYTHON_VERSION }}
654-
- name: "Install pre-commit"
655-
run: pip install pre-commit
651+
- uses: astral-sh/setup-uv@22695119d769bdb6f7032ad67b9bca0ef8c4a174 # v5
656652
- name: "Cache pre-commit"
657653
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
658654
with:
@@ -663,7 +659,7 @@ jobs:
663659
echo '```console' > "$GITHUB_STEP_SUMMARY"
664660
# Enable color output for pre-commit and remove it for the summary
665661
# Use --hook-stage=manual to enable slower pre-commit hooks that are skipped by default
666-
SKIP=cargo-fmt,clippy,dev-generate-all pre-commit run --all-files --show-diff-on-failure --color=always --hook-stage=manual | \
662+
SKIP=cargo-fmt,clippy,dev-generate-all uvx --python="${PYTHON_VERSION}" pre-commit run --all-files --show-diff-on-failure --color=always --hook-stage=manual | \
667663
tee >(sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[mGK]//g' >> "$GITHUB_STEP_SUMMARY") >&1
668664
exit_code="${PIPESTATUS[0]}"
669665
echo '```' >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)