Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use uv to speed up pre-commit install #14

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,32 @@ on:
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
python-version: 3.x
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: boidolr/actions/setup-precommit@main
- name: Install uv
uses: astral-sh/setup-uv@c9aa747934b6867b18bf8f6624a8929c4f76147b # v3
with:
working-directory: tests
enable-cache: true
cache-suffix: "precommit"
cache-dependency-glob: tests/.pre-commit-config.yaml

- name: Cache pre-commit
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ env.python-version }}-${{ hashFiles('**/.pre-commit-config.yaml') }}

- name: Check hook pass
run: pre-commit run --config "tests/.pre-commit-config.yaml" --all-files ast-grep-pass
run: uvx pre-commit run --config "tests/.pre-commit-config.yaml" --all-files ast-grep-pass

- name: Check hook failure
shell: bash
run: |
set +e

pre-commit run --config "tests/.pre-commit-config.yaml" --all-files ast-grep-fail
uvx pre-commit run --config "tests/.pre-commit-config.yaml" --all-files ast-grep-fail
if [[ "$?" == "0" ]]; then exit 1; fi
echo "::notice::Hook failed as expected"
Loading