Skip to content

Commit c79958b

Browse files
authored
Merge branch 'main' into unit_tests_for_python_values
2 parents f51556f + 039d924 commit c79958b

File tree

182 files changed

+16448
-7479
lines changed

Some content is hidden

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

182 files changed

+16448
-7479
lines changed

.github/workflows/CI.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,21 @@ permissions:
2626
contents: read
2727

2828
jobs:
29-
build:
30-
runs-on: ${{ matrix.platform.runner }}
31-
strategy:
32-
matrix:
33-
platform:
34-
- { os: linux, runner: ubuntu-24.04, target: x86_64, container: "ghcr.io/rust-cross/manylinux_2_28-cross:x86_64" }
35-
- { os: macos, runner: macos-15, target: aarch64 }
29+
format-check:
30+
name: Check Python formatting
31+
runs-on: ubuntu-latest
3632
steps:
3733
- uses: actions/checkout@v4
3834
- uses: actions/setup-python@v5
3935
with:
40-
python-version: 3.x
41-
- name: Build wheels
42-
uses: PyO3/maturin-action@v1
43-
with:
44-
target: ${{ matrix.platform.target }}
45-
args: --release --out dist --find-interpreter
46-
sccache: 'true'
47-
manylinux: auto
48-
container: ${{ matrix.platform.container }}
36+
python-version: 3.11
37+
- name: Install Ruff
38+
run: |
39+
pip install ruff
40+
- name: Check Python formatting
41+
run: |
42+
ruff format --check .
43+
4944
test:
5045
name: Run test
5146
uses: ./.github/workflows/_test.yml

.github/workflows/_doc_release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release Docs
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
environment: docs-release
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 18
15+
cache: yarn
16+
cache-dependency-path: docs/yarn.lock
17+
- uses: webfactory/[email protected]
18+
with:
19+
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
20+
- name: Deploy to GitHub Pages
21+
env:
22+
USE_SSH: true
23+
run: |
24+
export COCOINDEX_DOCS_POSTHOG_API_KEY=${{ vars.COCOINDEX_DOCS_POSTHOG_API_KEY }}
25+
export COCOINDEX_DOCS_MIXPANEL_API_KEY=${{ vars.COCOINDEX_DOCS_MIXPANEL_API_KEY }}
26+
export COCOINDEX_DOCS_ALGOLIA_APP_ID=${{ vars.COCOINDEX_DOCS_ALGOLIA_APP_ID }}
27+
export COCOINDEX_DOCS_ALGOLIA_API_KEY=${{ vars.COCOINDEX_DOCS_ALGOLIA_API_KEY }}
28+
git config --global user.email "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_EMAIL }}"
29+
git config --global user.name "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_NAME }}"
30+
yarn --cwd docs install --frozen-lockfile
31+
yarn --cwd docs deploy

.github/workflows/_test.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,32 @@ jobs:
2727
run: cargo test --verbose
2828

2929
- uses: actions/setup-python@v5
30+
id: setup_python
3031
with:
3132
python-version: ${{ matrix.python-version }}
3233
cache: 'pip'
3334
- uses: actions/cache@v4
3435
with:
3536
path: .venv
36-
key: ${{ runner.os }}-pythonenv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
37+
key: ${{ runner.os }}-pyenv-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }}
3738
restore-keys: |
38-
${{ runner.os }}-pythonenv-${{ matrix.python-version }}-
39-
- name: Python build & test
39+
${{ runner.os }}-pyenv-${{ steps.setup_python.outputs.python-version }}-
40+
- name: Setup venv
4041
run: |
4142
python -m venv .venv
43+
- name: Install Python toolchains
44+
run: |
45+
source .venv/bin/activate
46+
pip install maturin pytest mypy
47+
- name: Python build
48+
run: |
4249
source .venv/bin/activate
43-
pip install maturin pytest
4450
maturin develop
51+
- name: Python type check (mypy)
52+
run: |
53+
source .venv/bin/activate
54+
mypy python
55+
- name: Python tests
56+
run: |
57+
source .venv/bin/activate
4558
pytest python/cocoindex/tests

.github/workflows/docs.yml

Lines changed: 8 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,83 +6,29 @@ on:
66
paths:
77
- docs/**
88
- ".github/workflows/docs.yml"
9-
push:
10-
branches: [main]
11-
paths:
12-
- docs/**
13-
- ".github/workflows/docs.yml"
149
workflow_dispatch:
1510

1611
permissions:
1712
contents: write
1813

1914
jobs:
2015
test-deploy:
21-
if: github.event_name != 'push'
16+
if: github.event_name == 'pull_request'
2217
runs-on: ubuntu-latest
2318
steps:
2419
- uses: actions/checkout@v4
25-
with:
26-
fetch-depth: 0
27-
sparse-checkout: docs
28-
path: src-staging
29-
- name: Move docs
30-
run: |
31-
shopt -s dotglob
32-
mv src-staging/docs/* .
3320
- uses: actions/setup-node@v4
3421
with:
3522
node-version: 18
3623
cache: yarn
24+
cache-dependency-path: docs/yarn.lock
3725
- name: Install dependencies
38-
run: yarn install --frozen-lockfile
26+
run: yarn --cwd docs install --frozen-lockfile
3927
- name: Test build website
40-
run: yarn build
41-
42-
deploy-precheck:
43-
if: ${{ github.event_name != 'pull_request' }}
44-
runs-on: ubuntu-latest
45-
environment: docs-release
46-
outputs:
47-
gh-deploy-key: ${{ steps.gh-deploy-key.outputs.defined }}
48-
steps:
49-
- id: gh-deploy-key
50-
env:
51-
GH_PAGES_DEPLOY: ${{ secrets.GH_PAGES_DEPLOY }}
52-
if: "${{ env.GH_PAGES_DEPLOY != '' }}"
53-
run: echo "defined=true" >> $GITHUB_OUTPUT
28+
run: yarn --cwd docs build
5429

5530
deploy:
56-
needs: [deploy-precheck]
57-
if: ${{ needs.deploy-precheck.outputs.gh-deploy-key == 'true' }}
58-
runs-on: ubuntu-latest
59-
environment: docs-release
60-
steps:
61-
- uses: actions/checkout@v4
62-
with:
63-
fetch-depth: 0
64-
sparse-checkout: docs
65-
path: src-staging
66-
- name: Move docs
67-
run: |
68-
shopt -s dotglob
69-
mv src-staging/docs/* .
70-
- uses: actions/setup-node@v4
71-
with:
72-
node-version: 18
73-
cache: yarn
74-
- uses: webfactory/[email protected]
75-
with:
76-
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
77-
- name: Deploy to GitHub Pages
78-
env:
79-
USE_SSH: true
80-
run: |
81-
export COCOINDEX_DOCS_POSTHOG_API_KEY=${{ vars.COCOINDEX_DOCS_POSTHOG_API_KEY }}
82-
export COCOINDEX_DOCS_MIXPANEL_API_KEY=${{ vars.COCOINDEX_DOCS_MIXPANEL_API_KEY }}
83-
export COCOINDEX_DOCS_ALGOLIA_APP_ID=${{ vars.COCOINDEX_DOCS_ALGOLIA_APP_ID }}
84-
export COCOINDEX_DOCS_ALGOLIA_API_KEY=${{ vars.COCOINDEX_DOCS_ALGOLIA_API_KEY }}
85-
git config --global user.email "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_EMAIL }}"
86-
git config --global user.name "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_NAME }}"
87-
yarn install --frozen-lockfile
88-
yarn deploy
31+
name: Release Docs
32+
if: ${{ github.event_name == 'workflow_dispatch' }}
33+
uses: ./.github/workflows/_doc_release.yml
34+
secrets: inherit

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,9 @@ jobs:
107107
with:
108108
command: upload
109109
args: --non-interactive --skip-existing wheels-*/*
110+
111+
release-docs:
112+
name: Release Docs
113+
needs: [release]
114+
uses: ./.github/workflows/_doc_release.yml
115+
secrets: inherit

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ __pycache__/
99
*.so
1010

1111
# Distribution / packaging
12-
.venv/
12+
.venv*/
1313
dist/
1414

1515
.DS_Store

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"cocoindex",
44
"reindexing",
55
"timedelta"
6-
]
6+
],
7+
"editor.formatOnSave": true,
8+
"python.formatting.provider": "ruff"
79
}

0 commit comments

Comments
 (0)