Skip to content

Commit 3f34ce3

Browse files
authored
chore: add lance dependency bump automation (#130)
1 parent 0da11b8 commit 3f34ce3

4 files changed

Lines changed: 421 additions & 0 deletions

File tree

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
13+
name: Codex Update Lance Dependency
14+
15+
on:
16+
workflow_call:
17+
inputs:
18+
tag:
19+
description: "Tag name from Lance (e.g., v2.0.0)"
20+
required: true
21+
type: string
22+
workflow_dispatch:
23+
inputs:
24+
tag:
25+
description: "Tag name from Lance (e.g., v2.0.0)"
26+
required: true
27+
type: string
28+
29+
permissions:
30+
contents: write
31+
pull-requests: write
32+
actions: read
33+
34+
jobs:
35+
update:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Show inputs
39+
run: |
40+
echo "tag = ${{ inputs.tag }}"
41+
42+
- name: Checkout Repo
43+
uses: actions/checkout@v5
44+
with:
45+
fetch-depth: 0
46+
persist-credentials: true
47+
48+
- name: Set up Node.js
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: 20
52+
53+
- name: Install Codex CLI
54+
run: npm install -g @openai/codex
55+
56+
- name: Set up Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: "3.11"
60+
61+
- name: Set up Rust toolchain
62+
uses: dtolnay/rust-toolchain@stable
63+
with:
64+
components: rustfmt, clippy
65+
66+
- name: Configure git user
67+
run: |
68+
git config user.name "lance-community"
69+
git config user.email "community@lance.org"
70+
71+
- name: Run Codex to update Lance dependency
72+
env:
73+
TAG: ${{ inputs.tag }}
74+
GITHUB_TOKEN: ${{ secrets.LANCE_RELEASE_TOKEN }}
75+
GH_TOKEN: ${{ secrets.LANCE_RELEASE_TOKEN }}
76+
OPENAI_API_KEY: ${{ secrets.CODEX_TOKEN }}
77+
run: |
78+
set -euo pipefail
79+
VERSION="${TAG#refs/tags/}"
80+
VERSION="${VERSION#v}"
81+
BRANCH_NAME="codex/update-lance-${VERSION//[^a-zA-Z0-9]/-}"
82+
83+
cat <<EOF >/tmp/codex-prompt.txt
84+
You are running inside the lance-duckdb repository on a GitHub Actions runner.
85+
Update the Lance Rust dependencies to version ${VERSION} (semver format) and prepare a pull request for maintainers to review.
86+
87+
Follow these steps exactly:
88+
1. Update versions in Cargo.toml:
89+
- In the [dependencies] section, update the versions for these crates to "${VERSION}":
90+
lance, lance-arrow, lance-core, lance-index, lance-linalg, lance-namespace, lance-namespace-impls, lance-table.
91+
- Keep existing features/flags unchanged.
92+
2. Update Cargo.lock to match the new versions.
93+
- Prefer precise updates like:
94+
cargo update -p lance --precise ${VERSION}
95+
cargo update -p lance-arrow --precise ${VERSION}
96+
... (repeat for each of the crates above)
97+
- If Cargo complains about incompatible Arrow/DataFusion versions, update the pinned Arrow/DataFusion versions in Cargo.toml to match the Lance ${VERSION} dependency requirements, then update Cargo.lock again.
98+
3. Run these checks:
99+
- cargo fmt --all
100+
- cargo check --manifest-path Cargo.toml
101+
- cargo clippy --manifest-path Cargo.toml --all-targets
102+
4. Inspect "git status --short" and "git diff" to confirm the dependency update and any required fixes.
103+
5. Create and switch to a new branch named "${BRANCH_NAME}" (replace any duplicated hyphens if necessary).
104+
6. Stage all relevant files with "git add -A". Commit using the message "chore: update lance dependency to v${VERSION}".
105+
7. Push the branch to origin. If the branch already exists, force-push your changes.
106+
8. env "GH_TOKEN" is available; use "gh" tools for GitHub operations like creating pull requests.
107+
9. Create a pull request targeting "main" with title "chore: update lance dependency to v${VERSION}".
108+
- First, write the PR body to /tmp/pr-body.md using a heredoc (cat <<'EOF' > /tmp/pr-body.md).
109+
- The body should summarize the dependency bump, key resolver changes (if any), the commands run in step 3, and link the triggering tag (${TAG}).
110+
- Then run "gh pr create --body-file /tmp/pr-body.md".
111+
10. Display the PR URL, "git status --short", and a concise summary of the commands run and their results.
112+
113+
Constraints:
114+
- Use bash commands.
115+
- Do not merge the PR.
116+
- If any command fails, diagnose and fix the issue instead of aborting.
117+
- For compatibility issues, consult lance-format/lance at tag v${VERSION} for the expected Rust dependency versions.
118+
EOF
119+
120+
printenv OPENAI_API_KEY | codex login --with-api-key
121+
codex --config shell_environment_policy.ignore_default_excludes=true exec --dangerously-bypass-approvals-and-sandbox "$(cat /tmp/codex-prompt.txt)"
122+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
13+
name: Lance Release Timer
14+
15+
on:
16+
schedule:
17+
- cron: "*/10 * * * *"
18+
workflow_dispatch:
19+
20+
permissions:
21+
contents: read
22+
actions: write
23+
24+
concurrency:
25+
group: lance-release-timer
26+
cancel-in-progress: false
27+
28+
jobs:
29+
trigger-update:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v5
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.11"
39+
40+
- name: Check for new Lance tag
41+
id: check
42+
env:
43+
GH_TOKEN: ${{ secrets.LANCE_RELEASE_TOKEN }}
44+
run: |
45+
python3 ci/check_lance_release.py --github-output "$GITHUB_OUTPUT"
46+
47+
- name: Look for existing PR
48+
if: steps.check.outputs.needs_update == 'true'
49+
id: pr
50+
env:
51+
GH_TOKEN: ${{ secrets.LANCE_RELEASE_TOKEN }}
52+
run: |
53+
set -euo pipefail
54+
TITLE="chore: update lance dependency to v${{ steps.check.outputs.latest_version }}"
55+
COUNT=$(gh pr list --search "\"$TITLE\" in:title" --state open --limit 1 --json number --jq 'length')
56+
if [ "$COUNT" -gt 0 ]; then
57+
echo "Open PR already exists for $TITLE"
58+
echo "pr_exists=true" >> "$GITHUB_OUTPUT"
59+
else
60+
echo "No existing PR for $TITLE"
61+
echo "pr_exists=false" >> "$GITHUB_OUTPUT"
62+
fi
63+
64+
- name: Trigger codex update workflow
65+
if: steps.check.outputs.needs_update == 'true' && steps.pr.outputs.pr_exists != 'true'
66+
env:
67+
GH_TOKEN: ${{ secrets.LANCE_RELEASE_TOKEN }}
68+
run: |
69+
set -euo pipefail
70+
TAG=${{ steps.check.outputs.latest_tag }}
71+
gh workflow run codex-update-lance-dependency.yml -f tag=refs/tags/$TAG
72+
73+
- name: Show latest codex workflow run
74+
if: steps.check.outputs.needs_update == 'true' && steps.pr.outputs.pr_exists != 'true'
75+
env:
76+
GH_TOKEN: ${{ secrets.LANCE_RELEASE_TOKEN }}
77+
run: |
78+
set -euo pipefail
79+
gh run list --workflow codex-update-lance-dependency.yml --limit 1 --json databaseId,url,displayTitle
80+

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,18 @@ See the SQL reference for full parameter documentation: [docs/sql.md#search](doc
174174

175175
Issues and PRs are welcome. High-impact areas include pushdown, parallelism/performance, type coverage, and better diagnostics.
176176

177+
### Automation: Lance dependency bumps
178+
179+
This repository includes a GitHub Actions workflow pair that opens a PR when a newer tag is detected in `lance-format/lance`:
180+
181+
- `.github/workflows/lance-release-timer.yml`: polls for a newer Lance tag and triggers the Codex workflow.
182+
- `.github/workflows/codex-update-lance-dependency.yml`: uses Codex CLI to update `Cargo.toml` / `Cargo.lock`, run basic Rust checks, and open a PR.
183+
184+
Required repository secrets:
185+
186+
- `LANCE_RELEASE_TOKEN`: a GitHub token that can read tags and create PRs in this repository.
187+
- `CODEX_TOKEN`: an OpenAI API key used by Codex CLI.
188+
177189
## License
178190

179191
Apache License 2.0.

0 commit comments

Comments
 (0)