Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Copy link
Copy Markdown
Contributor Author

@Haleshot Haleshot Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependabot's pre-commit ecosystem works w/ prek since both read the same .pre-commit-config.yaml format. Changed from monthly (the old autoupdate_schedule in the ci block) to weekly to match the github-actions update cadence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the oversight; I thought Dependabot had a pre-commit ecosystem, but after checking the Dependabot options reference | GitHub docs (prompted by the failed CI run), turns out it doesn't.

Will remove this entry in a follow-up; for hook version updates we'd need to run prek autoupdate manually or set up a scheduled action.

Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ updates:
commit-message:
prefix: "ci"
include: "scope"

- package-ecosystem: "pre-commit"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "pre-commit"
commit-message:
prefix: "ci"
include: "scope"
22 changes: 9 additions & 13 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,10 @@ jobs:
- name: Sync Python dependencies
run: uv sync --no-dev --group ci

- name: Cache pre-commit
uses: actions/cache@v4
- name: Install prek
uses: j178/prek-action@v1
with:
path: ~/.cache/pre-commit
key: precommit-${{ matrix.platform.runner }}-${{ matrix.python-version }}

- name: Install pre-commit
run: pip install pre-commit
install-only: true
Comment thread
Haleshot marked this conversation as resolved.

- name: Run build-test hooks
env:
Expand All @@ -74,29 +70,29 @@ jobs:
RUSTC_WRAPPER: "sccache"
UV_NO_SYNC: "1"
# Skip mypy-check - it runs in e2e_type_check workflow
SKIP: mypy-check
PREK_SKIP: mypy-check
shell: bash
run: |
set +e

if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Running pre-commit on PR diff against target branch: ${{ github.base_ref }}"
echo "Running prek on PR diff against target branch: ${{ github.base_ref }}"
git fetch --no-tags --prune --depth=1 origin \
"${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}"

pre-commit run \
prek run \
--from-ref "origin/${{ github.base_ref }}" \
--to-ref "${{ github.sha }}" \
--show-diff-on-failure
status=$?
else
echo "Running pre-commit on all files (event: ${{ github.event_name }})"
pre-commit run --all-files --show-diff-on-failure
echo "Running prek on all files (event: ${{ github.event_name }})"
prek run --all-files --show-diff-on-failure
status=$?
fi

if [ $status -ne 0 ]; then
echo "::error::Build-test checks failed. Please run 'uv run pre-commit run --all-files' locally."
echo "::error::Build-test checks failed. Please run 'prek run --all-files' locally."
exit $status
fi

Expand Down
24 changes: 3 additions & 21 deletions .github/workflows/e2e_type_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,9 @@ jobs:
- name: Sync Python dependencies
run: uv sync --no-dev --group ci

- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: precommit-e2e-type-check-${{ matrix.python-version }}

- name: Install pre-commit
run: pip install pre-commit

- name: Run mypy-check hook
uses: j178/prek-action@v1
with:
extra-args: 'mypy-check --all-files'
env:
UV_NO_SYNC: "1"
shell: bash
run: |
set +e

echo "Running mypy-check on all files (event: ${{ github.event_name }})"
pre-commit run mypy-check --all-files --show-diff-on-failure
status=$?

if [ $status -ne 0 ]; then
echo "::error::E2E type check failed. Please run 'uv run pre-commit run --all-files' locally."
exit $status
fi
24 changes: 4 additions & 20 deletions .github/workflows/fast_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,10 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: precommit-fast-check-ubuntu-latest

- name: Install pre-commit
run: pip install pre-commit

- name: Run fast-check hooks
uses: j178/prek-action@v1
with:
extra-args: '--all-files'
env:
# Skip heavy build/test hooks - only run fast formatting/linting checks
SKIP: uv-lock,mypy-check,maturin-develop,cargo-test,pytest,generate-cli-docs
shell: bash
run: |
set +e

pre-commit run --all-files --show-diff-on-failure
status=$?
if [ $status -ne 0 ]; then
echo "::error::Fast check failed. Please run 'uv run pre-commit run --all-files' locally."
exit $status
fi
PREK_SKIP: uv-lock,mypy-check,maturin-develop,cargo-test,pytest,generate-cli-docs
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
ci:
autofix_prs: false
autoupdate_schedule: 'monthly'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[![CI](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml/badge.svg?event=push&color=5B5BD6)](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml)
[![release](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml/badge.svg?event=push&color=5B5BD6)](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml)
[![Link Check](https://github.com/cocoindex-io/cocoindex/actions/workflows/links.yml/badge.svg)](https://github.com/cocoindex-io/cocoindex/actions/workflows/links.yml)
[![prek](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json)](https://github.com/j178/prek)
[![Discord](https://img.shields.io/discord/1314801574169673738?logo=discord&color=5B5BD6&logoColor=white)](https://discord.com/invite/zpA9S2DR7s)

</div>
Expand Down
2 changes: 1 addition & 1 deletion dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ python dev/generate_cli_docs.py

**Integration:**

- Runs automatically as a pre-commit hook when `python/cocoindex/cli.py` is modified
- Runs automatically as a prek hook when `python/cocoindex/cli.py` is modified
- The generated documentation is directly imported into `docs/docs/core/cli.mdx` via MDX import
- Provides seamless single-page CLI documentation experience without separate reference pages

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/contributing/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ To submit your code:
1. Fork the [CocoIndex repository](https://github.com/cocoindex-io/cocoindex)
2. [Create a new branch](https://docs.github.com/en/desktop/making-changes-in-a-branch/managing-branches-in-github-desktop) on your fork
3. Make your changes
4. Run the pre-commit checks. It will be automatically triggered on `git commit` after you install the pre-commit hooks by `pre-commit install` (see [Setup Development Environment](setup_dev_environment.md)).
4. Run the prek checks. It will be automatically triggered on `git commit` after you install the prek hooks by `prek install` (see [Setup Development Environment](setup_dev_environment.md)).

:::tip
To run them manually (same as CI):
```sh
pre-commit run --all-files
prek run --all-files
```
:::

Expand Down
8 changes: 5 additions & 3 deletions docs/docs/contributing/setup_dev_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Follow the steps below to get CocoIndex built on the latest codebase locally - i

- Setup your local development environment:

- Install and enable pre-commit hooks. This ensures all checks run automatically before each commit:
- Install and enable prek hooks. This ensures all checks run automatically before each commit:

```sh
uv run pre-commit install
uv run prek install
```

- (Optionally) Install all optional dependencies:
Expand Down Expand Up @@ -90,4 +90,6 @@ Workaround:

This wrapper sets `PYTHONHOME`/`PYTHONPATH` for that command only, so embedded Python can locate the stdlib and site-packages.

Note: the cargo-test pre-commit hook uses this wrapper.
:::info

The cargo-test prek hook uses this wrapper.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ci = [
{ include-group = "ci-enabled-optional-deps" },
]

dev-local = ["pre-commit"]
dev-local = ["prek"]
dev = [{ include-group = "ci" }, { include-group = "dev-local" }]

[tool.uv]
Expand Down
Loading
Loading