Skip to content

Commit 2f1e0d2

Browse files
authored
Merge branch 'main' into main
2 parents b71485d + 919ec94 commit 2f1e0d2

383 files changed

Lines changed: 22817 additions & 11378 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.lib_debug

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,20 @@ export RUST_LOG=warn,cocoindex_engine=trace,tower_http=trace
22
export RUST_BACKTRACE=1
33

44
export COCOINDEX_SERVER_CORS_ORIGINS=http://localhost:3000,https://cocoindex.io
5+
6+
# Set COCOINDEX_DEV_ROOT to the directory containing this file (repo root)
7+
# This allows running examples from any subdirectory
8+
export COCOINDEX_DEV_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
9+
10+
# Function for running examples with the local editable cocoindex package
11+
# Usage: coco-dev-run cocoindex update main
12+
coco-dev-run() {
13+
local pyver
14+
if [ -f "$COCOINDEX_DEV_ROOT/.python-version" ]; then
15+
pyver="$(cat "$COCOINDEX_DEV_ROOT/.python-version")"
16+
else
17+
pyver="3.11"
18+
fi
19+
20+
uv run --python "$pyver" --with-editable "$COCOINDEX_DEV_ROOT" "$@"
21+
}

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
labels:
8+
- "dependencies"
9+
- "github-actions"
10+
commit-message:
11+
prefix: "ci"
12+
include: "scope"

.github/workflows/CI.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
# This file is autogenerated by maturin v1.8.1
2-
# To update, run
3-
#
4-
# maturin generate-ci github
5-
#
61
name: CI
72

83
on:
94
pull_request:
10-
branches: [main]
5+
branches: [main, v1]
116
paths:
127
- rust/**
138
- python/**
149
- "*.toml"
1510
- ".github/workflows/*.yml"
1611
push:
17-
branches: [main]
12+
branches: [main, v1]
1813
paths:
1914
- rust/**
2015
- python/**
@@ -26,6 +21,6 @@ permissions:
2621
contents: read
2722

2823
jobs:
29-
test:
30-
name: Run test
24+
build-test:
25+
name: Build & Test
3126
uses: ./.github/workflows/_test.yml

.github/workflows/_docs_release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
runs-on: ubuntu-latest
1313
environment: docs-release
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
with:
1717
fetch-depth: 1
18-
- uses: actions/setup-node@v4
18+
- uses: actions/setup-node@v6
1919
with:
2020
cache: yarn
2121
cache-dependency-path: docs/yarn.lock
22-
- uses: webfactory/ssh-agent@v0.5.0
22+
- uses: webfactory/ssh-agent@v0.9.1
2323
with:
2424
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
2525
- name: Deploy to GitHub Pages

.github/workflows/_test.yml

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,97 @@ jobs:
1313
build-test:
1414
strategy:
1515
matrix:
16-
python-version: [3.11]
16+
python-version: ["3.11"]
1717
platform:
18-
- { runner: ubuntu-latest, python_exec: ".venv/bin/python" }
19-
- { runner: ubuntu-24.04-arm, python_exec: ".venv/bin/python" }
20-
- { runner: macos-latest, python_exec: ".venv/bin/python", extra_rustflags: "-C split-debuginfo=off"}
21-
- { runner: macos-15-intel, python_exec: ".venv/bin/python", extra_rustflags: "-C split-debuginfo=off"}
22-
- { runner: windows-latest, python_exec: ".venv\\Scripts\\python" }
18+
- { runner: ubuntu-latest }
19+
- { runner: ubuntu-24.04-arm }
20+
- { runner: macos-latest, extra_rustflags: "-C split-debuginfo=off" }
21+
- { runner: macos-15-intel, extra_rustflags: "-C split-debuginfo=off" }
22+
- { runner: windows-latest }
2323
runs-on: ${{ matrix.platform.runner }}
2424
env:
25-
RUSTFLAGS: "-C debuginfo=0 ${{ matrix.platform.extra_rustflags }}"
26-
CARGO_INCREMENTAL: "0"
2725
SCCACHE_GHA_ENABLED: "true"
28-
RUSTC_WRAPPER: "sccache"
2926

3027
steps:
31-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
3229
with:
3330
fetch-depth: 1
3431

35-
- name: Run sccache-cache
32+
- name: Setup sccache
3633
uses: mozilla-actions/sccache-action@v0.0.9
34+
with:
35+
# Latest version doesn't work well because of https://github.com/mozilla/sccache/issues/2554
36+
version: "v0.12.0"
37+
38+
- run: rustup toolchain install stable --profile minimal
39+
40+
- name: Setup Rust Cache
41+
uses: Swatinem/rust-cache@v2
42+
with:
43+
key: rust-${{ matrix.platform.runner }}
44+
cache-targets: 'true'
45+
cache-all-crates: 'false'
46+
cache-workspace-crates: 'false'
3747

38-
- uses: actions/setup-python@v5
48+
- uses: actions/setup-python@v6
3949
id: setup_python
4050
with:
4151
python-version: ${{ matrix.python-version }}
4252
# Python cache is huge and saves little time, so disabled for now, until we have higher cache size limits
4353
# cache: 'pip'
4454

45-
- run: rustup toolchain install stable --profile minimal
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v7
4657

47-
# Disable Rust cache until we have higher cache size limits
48-
# - name: Rust Cache
49-
# uses: Swatinem/rust-cache@v2
50-
# with:
51-
# key: rust-${{ matrix.platform.runner }}-${{ matrix.python-version }}
52-
# cache-targets: 'false'
53-
# cache-all-crates: 'false'
54-
# cache-workspace-crates: 'false'
58+
- name: Sync Python dependencies
59+
run: uv sync --no-dev --group ci
5560

56-
- name: Rust tests (no default features)
57-
run: cargo test --no-default-features --verbose
61+
- name: Cache pre-commit
62+
uses: actions/cache@v4
63+
with:
64+
path: ~/.cache/pre-commit
65+
key: precommit-${{ matrix.platform.runner }}-${{ matrix.python-version }}
5866

59-
- name: Rust tests
60-
run: cargo test --verbose
67+
- name: Install pre-commit
68+
run: pip install pre-commit
6169

62-
- name: Setup venv
63-
run: |
64-
python -m venv .venv
65-
- name: Install Python toolchains
66-
run: |
67-
${{ matrix.platform.python_exec }} -m pip install maturin
68-
- name: Python build
69-
run: |
70-
${{ matrix.platform.python_exec }} -m maturin develop --strip -E all-ci
71-
- name: Python type check (mypy)
72-
run: |
73-
${{ matrix.platform.python_exec }} -m mypy python
74-
${{ matrix.platform.python_exec }} -m mypy --namespace-packages --explicit-package-bases --ignore-missing-imports examples
75-
- name: Python tests
70+
- name: Run build-test hooks
71+
env:
72+
RUSTFLAGS: "-C debuginfo=0 ${{ matrix.platform.extra_rustflags }}"
73+
CARGO_INCREMENTAL: "0"
74+
RUSTC_WRAPPER: "sccache"
75+
UV_NO_SYNC: "1"
76+
# Skip mypy-check - it runs in e2e_type_check workflow
77+
SKIP: mypy-check
78+
shell: bash
7679
run: |
77-
${{ matrix.platform.python_exec }} -m pytest --capture=no python/cocoindex/tests
80+
set +e
81+
82+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
83+
echo "Running pre-commit on PR diff against target branch: ${{ github.base_ref }}"
84+
git fetch --no-tags --prune --depth=1 origin \
85+
"${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}"
86+
87+
pre-commit run \
88+
--from-ref "origin/${{ github.base_ref }}" \
89+
--to-ref "${{ github.sha }}" \
90+
--show-diff-on-failure
91+
status=$?
92+
else
93+
echo "Running pre-commit on all files (event: ${{ github.event_name }})"
94+
pre-commit run --all-files --show-diff-on-failure
95+
status=$?
96+
fi
97+
98+
if [ $status -ne 0 ]; then
99+
echo "::error::Build-test checks failed. Please run 'uv run pre-commit run --all-files' locally."
100+
exit $status
101+
fi
78102
79103
validate-3p-notices:
80104
runs-on: ubuntu-latest
81105
steps:
82-
- uses: actions/checkout@v4
106+
- uses: actions/checkout@v6
83107
with:
84108
fetch-depth: 1
85109
- name: Install Rust toolchain

.github/workflows/docs_release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Regular docs release is part of CocoIndex release (see `release.yml`).
2+
# This workflow is for manually triggered docs release, e.g. urgent docs-only fixes.
3+
#
14
name: Release Docs
25

36
on:
@@ -11,4 +14,4 @@ jobs:
1114
deploy:
1215
name: Release Docs
1316
uses: ./.github/workflows/_docs_release.yml
14-
secrets: inherit
17+
secrets: inherit

.github/workflows/docs_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test Docs
22

33
on:
44
pull_request:
5-
branches: [main]
5+
branches: [main, v1]
66
paths:
77
- docs/**
88
- ".github/workflows/docs_test.yml"
@@ -14,10 +14,10 @@ jobs:
1414
test-deploy:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v6
1818
with:
1919
fetch-depth: 1
20-
- uses: actions/setup-node@v4
20+
- uses: actions/setup-node@v6
2121
with:
2222
cache: yarn
2323
cache-dependency-path: docs/yarn.lock
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: E2E Type Check
2+
3+
on:
4+
pull_request:
5+
branches: [main, v1]
6+
paths:
7+
- python/**
8+
- examples*/**
9+
- "*.toml"
10+
- ".github/workflows/e2e_type_check.yml"
11+
push:
12+
branches: [main, v1]
13+
paths:
14+
- python/**
15+
- examples*/**
16+
- "*.toml"
17+
- ".github/workflows/e2e_type_check.yml"
18+
workflow_dispatch:
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
e2e-type-check:
25+
strategy:
26+
matrix:
27+
python-version: ["3.11", "3.12", "3.13", "3.14"]
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v6
31+
with:
32+
fetch-depth: 1
33+
34+
- uses: actions/setup-python@v6
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v7
40+
41+
- name: Sync Python dependencies
42+
run: uv sync --no-dev --group ci
43+
44+
- name: Cache pre-commit
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/.cache/pre-commit
48+
key: precommit-e2e-type-check-${{ matrix.python-version }}
49+
50+
- name: Install pre-commit
51+
run: pip install pre-commit
52+
53+
- name: Run mypy-check hook
54+
env:
55+
UV_NO_SYNC: "1"
56+
shell: bash
57+
run: |
58+
set +e
59+
60+
echo "Running mypy-check on all files (event: ${{ github.event_name }})"
61+
pre-commit run mypy-check --all-files --show-diff-on-failure
62+
status=$?
63+
64+
if [ $status -ne 0 ]; then
65+
echo "::error::E2E type check failed. Please run 'uv run pre-commit run --all-files' locally."
66+
exit $status
67+
fi

.github/workflows/fast_check.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Fast Check
2+
3+
on:
4+
pull_request:
5+
branches: [main, v1]
6+
push:
7+
branches: [main, v1]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
fast-check:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
fetch-depth: 1
20+
21+
- run: rustup toolchain install stable --profile minimal
22+
23+
- uses: actions/setup-python@v6
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v7
29+
30+
- name: Cache pre-commit
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/pre-commit
34+
key: precommit-fast-check-ubuntu-latest
35+
36+
- name: Install pre-commit
37+
run: pip install pre-commit
38+
39+
- name: Run fast-check hooks
40+
env:
41+
# Skip heavy build/test hooks - only run fast formatting/linting checks
42+
SKIP: uv-lock,mypy-check,maturin-develop,cargo-test,pytest,generate-cli-docs
43+
shell: bash
44+
run: |
45+
set +e
46+
47+
pre-commit run --all-files --show-diff-on-failure
48+
status=$?
49+
if [ $status -ne 0 ]; then
50+
echo "::error::Fast check failed. Please run 'uv run pre-commit run --all-files' locally."
51+
exit $status
52+
fi

0 commit comments

Comments
 (0)