Skip to content
Open
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
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: "3.11"

Expand All @@ -37,11 +37,11 @@ jobs:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive

- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -59,12 +59,12 @@ jobs:
name: Build embedded (CI check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive

- name: Build (maturin / Linux x86_64)
uses: PyO3/maturin-action@32307a466a178317e8c2ae343b38e73896a047be # v1.47.0
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
args: >-
Expand All @@ -74,7 +74,7 @@ jobs:
before-script-linux: |
dnf install -y protobuf-compiler

- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: "3.12"

Expand Down Expand Up @@ -132,11 +132,11 @@ jobs:
# the demo container sets the same value.
SETUPTOOLS_SCM_PRETEND_VERSION: "999.0.0"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive

- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: "3.13"

Expand Down Expand Up @@ -170,11 +170,11 @@ jobs:
- 7080:7080
- 7084:7084
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive

- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: "3.11"

Expand Down
173 changes: 173 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: Dependabot Auto-Merge

# `pull_request_target`, not `pull_request`, because of how Dependabot runs are
# isolated: a workflow triggered by Dependabot on `pull_request` receives
# Dependabot secrets rather than Actions secrets, so the organisation's
# RELEASER_APP_* secrets resolve to empty strings and the App token step fails
# before it does anything. `pull_request_target` runs in the base branch's
# context, where those secrets are available, which is also GitHub's own
# recommendation for this pattern. This is observed, not assumed: the same
# workflow in the organisation's other repositories, on runs Dependabot
# triggered, logs "Secret source: Actions" and mints the App token. For
# example coordinode-lsm-tree run 38696382130 (event `pull_request_target`,
# actor and triggering actor `dependabot[bot]`) generated the App token and
# armed auto-merge. The restriction GitHub documents for Dependabot-triggered
# `pull_request_target` applies when the base ref was created by Dependabot;
# here the base is the default branch.
#
# That context carries write-capable credentials, so this workflow must never
# execute code from the pull request. It does not: there is no checkout, and
# every step either reads PR metadata through the API or drives `gh`. Do not add
# a checkout here; if one ever becomes necessary, it must not use the head ref.
#
# Enabling auto-merge only arms it: the merge happens when every check the
# default-branch ruleset requires has passed, as for any other pull request.
on:
pull_request_target:
types: [opened, synchronize, reopened]
Comment thread
polaz marked this conversation as resolved.

permissions:
# Only what the default token needs: `dependabot/fetch-metadata` reads the
# pull request. Approving, disarming and merging are done with the App token
# below, so nothing here needs write access to the repository contents.
pull-requests: read

# One run per pull request, and a new push cancels the run it superseded rather
# than leaving it racing toward a head that no longer exists.
concurrency:
group: dependabot-auto-merge-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
auto-merge:
runs-on: ubuntu-latest
# Only the author here. Who triggered the run decides what the job does, not
# whether it runs at all: a push by anyone else is the case that has to be
# handled, and a job that skips it cannot handle anything.
if: github.event.pull_request.user.login == 'dependabot[bot]'

steps:
# Pinned to commit SHAs, not tags, because `pull_request_target` puts the
# App's private key within reach of whatever these resolve to: retargeting
# a mutable tag would be enough to take it. Dependabot updates a pinned
# SHA the same way it updates a tag, so this costs nothing to maintain.
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.RELEASER_APP_ID }}
private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }}
# Least privilege: `pull-requests` to approve, to read whether
# auto-merge is armed and to disarm it; `contents` because the
# squash-merge writes to the default branch. No `actions` grant: the
# merge is made by the App installation, which holds the workflows
# permission, and the organisation's other repositories auto-merge
# Dependabot updates to workflow files with exactly these two: in
# coordinode-lsm-tree, #909 (changes .github/workflows/benchmark.yml)
# and #693 were merged by the App through auto-merge armed this way.
permission-contents: write
permission-pull-requests: write
Comment thread
polaz marked this conversation as resolved.

# Auto-merge, once enabled, outlives the head it was enabled for. GitHub
# turns it off by itself only when the pusher lacks write access, so a
# maintainer adding commits to an open Dependabot pull request leaves it
# armed, and it then merges those commits. `--match-head-commit` does not
# cover this: it is a precondition checked when the command runs, not a
# standing binding to that SHA.
#
# So the run a foreign push triggers disarms rather than skips. The
# approval is left to the repository's stale-review dismissal, which is
# the setting that exists for it. The push itself cannot merge in the
# meantime: the ruleset requires up-to-date, passing checks, which rerun
# on the new head and take minutes, while this job disarms in seconds.
#
# `github.actor` is who caused the event, and a rerun keeps it: rerunning
# a Dependabot run leaves `actor` as dependabot with `triggering_actor`
# set to whoever asked, and rerunning a foreign-push run keeps the pusher
# in `actor`. So the actor of a `synchronize` event says whether the head
# moved under someone else, on the first attempt and on every rerun
# alike. A reopen moves no head, so it never disarms; see below.
- name: Disarm auto-merge when someone else moved the head
if: github.event.action == 'synchronize' && github.actor != 'dependabot[bot]'
# The head is checked because disarming has no precondition of its own:
# `--match-head-commit` maps to `expectedHeadOid`, which the mutation
# behind `--disable-auto` does not take. Without the check, a slow run
# from one push can disable the auto-merge a later Dependabot run
# legitimately armed.
#
# Every value the script reads arrives through the environment. An
# expression interpolated into `run:` is expanded before the shell sees
# the line, so its contents become script rather than data.
run: |
state=$(gh pr view "$PR_NUMBER" --json autoMergeRequest,headRefOid \
--jq '"\(.autoMergeRequest != null) \(.headRefOid)"')
armed=${state%% *}
current=${state##* }
if [ "$current" != "$HEAD_SHA" ]; then
echo "head is now $current, not the $HEAD_SHA this run saw;"
echo "a later run owns this pull request, leaving its state alone"
elif [ "$armed" = "true" ]; then
gh pr merge --disable-auto "$PR_NUMBER"
Comment thread
polaz marked this conversation as resolved.
echo "auto-merge disarmed: the head moved under a push by $PUSHER"
else
echo "auto-merge was not armed; nothing to disarm"
fi
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PUSHER: ${{ github.triggering_actor }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}

# No token passed: the action's `github-token` already defaults to
# `github.token`, which the permissions block above scopes to reading the
# pull request. Keyed on the event actor, not on who pressed rerun: a
# maintainer rerunning a failed Dependabot run must be able to restore the
# approval and auto-merge, and both are bound to the head SHA below, so
# the rerun cannot approve anything Dependabot did not push.
#
# A reopen by a maintainer runs this too: closing the pull request
# disarmed its auto-merge, and nothing else would arm it again until
# Dependabot's next push. That is safe because this action verifies that
# every commit on the pull request is Dependabot's and fails otherwise,
# so a branch someone else pushed to is never approved on reopen.
- name: Dependabot metadata
id: metadata
if: github.actor == 'dependabot[bot]' || github.event.action == 'reopened'
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0

# The metadata step is skipped for a foreign push, so its outputs are
# empty there and this condition is false: approval happens only on a run
# Dependabot itself triggered, or on a reopen of a branch holding only
# Dependabot's commits.
#
# Every update merges once CI is green, majors included, where CI runs
# what changed: Python and Rust updates are what the test, integration,
# embedded and demo jobs run on. Two stay manual. A major GitHub Actions
# update: several actions run only in release.yml, on a tag, so a green
# pull request proves nothing about them. Any Docker update: no job
# builds the demo image (the demo job installs the lock without Docker),
# so a base-image change is untested until someone builds it.
#
# `package-ecosystem` is `github_actions`, with an underscore: the action
# takes it from the second segment of the Dependabot branch name
# (`dependabot/github_actions/...`), not from the `github-actions` key
# of dependabot.yml.
- name: Approve and enable auto-merge
if: >-
steps.metadata.outcome == 'success'
&& steps.metadata.outputs.package-ecosystem != 'docker'
&& !(steps.metadata.outputs.package-ecosystem == 'github_actions'
Comment thread
polaz marked this conversation as resolved.
&& steps.metadata.outputs.update-type == 'version-update:semver-major')
Comment thread
polaz marked this conversation as resolved.
# Both operations name the head this run actually inspected, rather than
# just the pull request: the approval is recorded against a commit id,
# and the merge refuses outright if the head has moved.
run: |
gh api "repos/${GH_REPO}/pulls/${PR_NUMBER}/reviews" \
-f event=APPROVE -f commit_id="$HEAD_SHA" --silent
gh pr merge --auto --squash --match-head-commit "$HEAD_SHA" "$PR_NUMBER"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_REPO: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
8 changes: 4 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
steps:
- name: Generate release bot token
id: app-token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.RELEASER_APP_ID }}
private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }}

- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: rp
with:
token: ${{ steps.app-token.outputs.token }}
Expand All @@ -37,14 +37,14 @@ jobs:
# runs on the new commit.
- name: Check out the release branch
if: steps.rp.outputs.pr
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ fromJSON(steps.rp.outputs.pr).headBranchName }}
token: ${{ steps.app-token.outputs.token }}
# hatch-vcs derives the member versions from tags while locking.
fetch-depth: 0

- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
if: steps.rp.outputs.pr
with:
python-version: "3.11"
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
- name: llama-index-graph-stores-coordinode
path: llama-index-coordinode
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
fetch-depth: 0 # hatch-vcs needs full history for tag detection

- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: "3.11"

Expand All @@ -59,7 +59,7 @@ jobs:
uv build --no-build --out-dir dist

- name: Upload dist artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist-${{ matrix.package.name }}
path: ${{ matrix.package.path }}/dist/
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
fetch-depth: 0
Expand All @@ -123,15 +123,15 @@ jobs:
# Linux builds run inside a manylinux container that manages Python itself.
- name: Set up Python ${{ matrix.python-version || '3.13' }}
if: runner.os != 'Linux'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version || '3.13' }}

# QEMU is required for maturin-action to cross-compile Linux aarch64 wheels
# on the x86_64 ubuntu-latest runner using the manylinux container.
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.target == 'aarch64'
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0

- name: Install protoc (macOS / Windows)
if: runner.os != 'Linux'
Expand All @@ -140,7 +140,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build wheels
uses: PyO3/maturin-action@32307a466a178317e8c2ae343b38e73896a047be # v1.47.0
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
args: >-
Expand All @@ -159,7 +159,7 @@ jobs:
fi

- name: Upload wheels
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist-coordinode-embedded-${{ matrix.target }}-${{ matrix.os }}
path: dist/
Expand All @@ -183,7 +183,7 @@ jobs:
- langchain-coordinode
- llama-index-graph-stores-coordinode
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist-${{ matrix.package }}
path: dist/
Expand All @@ -202,7 +202,7 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: dist-coordinode-embedded-*
merge-multiple: true
Expand All @@ -221,13 +221,13 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: dist-*
merge-multiple: true
path: dist/

- uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
- uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
generate_release_notes: true
Expand Down
Loading
Loading