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
16 changes: 13 additions & 3 deletions .github/actions/setup-jfrog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,19 @@ runs:
EOF
chmod 600 ~/.cargo/credentials.toml

# Exported for tools like cargo-deny / cargo-llvm-cov that
# may read the env directly rather than the credentials file.
echo "CARGO_REGISTRIES_JFROG_TOKEN=Bearer ${JFROG_ACCESS_TOKEN}" >> "$GITHUB_ENV"
# NOTE: we deliberately do NOT export CARGO_REGISTRIES_JFROG_TOKEN
# into $GITHUB_ENV. cargo (and tools that shell out to it —
# cargo-deny, cargo-llvm-cov) read the token from the
# ~/.cargo/credentials.toml written above via the
# `credential-provider = ["cargo:token"]` line in config.toml,
# so the env var was redundant. Critically, the token is
# regenerated on every run, and Swatinem/rust-cache (run by
# actions-rust-lang/setup-rust-toolchain) hashes every
# `CARGO*`-prefixed env var into its cache key — so exporting a
# fresh token here gave every run a unique key and a guaranteed
# cache miss (full cold rebuild of the ~57-crate tree in every
# job). Keeping the token in the credentials file only restores
# stable cache keys and warm builds.

echo "Cargo configured to use JFrog registry"

Expand Down
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

version: 2
updates:
# Root workspace (kernel + the pyo3 member, which share the root
# Cargo.lock).
- package-ecosystem: "cargo"
directory: "/"
schedule:
Expand All @@ -41,6 +43,21 @@ updates:
- "minor"
- "patch"

# napi/ is a standalone Cargo workspace with its own committed
# Cargo.lock (napi CI builds with `--locked`). The root entry above
# does not see it, so without this entry napi's transitive deps
# never get security / version bumps.
- package-ecosystem: "cargo"
directory: "/napi"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
napi-cargo-minor-and-patch:
update-types:
- "minor"
- "patch"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/close-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ permissions:

jobs:
stale:
name: Close stale issues and PRs
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,25 @@ name: Coverage
on:
push:
branches: [main]
# Path-filtered: a full instrumented rebuild (`cargo llvm-cov`) is
# expensive, so only run it when something that can move the
# coverage number changes. Docs / workflow-only PRs skip it.
paths:
- "src/**"
- "tests/**"
- "pyo3/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/coverage.yml"
pull_request:
branches: [main]
paths:
- "src/**"
- "tests/**"
- "pyo3/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/coverage.yml"
workflow_dispatch:

concurrency:
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ on:
- "Cargo.toml"
- "Cargo.lock"
- "deny.toml"
# napi/ is a standalone workspace with its own lockfile; its
# dependency graph is invisible to a root `cargo deny` run, so
# changes there must re-trigger this workflow to scan it.
- "napi/Cargo.toml"
- "napi/Cargo.lock"
- ".github/workflows/license-check.yml"
pull_request:
branches: [main]
paths:
- "Cargo.toml"
- "Cargo.lock"
- "deny.toml"
- "napi/Cargo.toml"
- "napi/Cargo.lock"
- ".github/workflows/license-check.yml"

permissions:
Expand All @@ -52,7 +59,7 @@ defaults:

jobs:
cargo-deny:
name: cargo-deny
name: License & advisory check
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
Expand All @@ -70,9 +77,24 @@ jobs:
with:
tool: cargo-deny

- name: Check licenses, advisories, bans, sources
- name: Check licenses, advisories, bans, sources (root workspace)
# `licenses` is the load-bearing check; `advisories` flags
# RustSec security advisories; `bans` and `sources` are
# empty-permissive in our deny.toml today but the slots are
# there for future hardening.
# there for future hardening. The root workspace covers the
# kernel + pyo3 (pyo3 is a root workspace member).
run: cargo deny check

- name: Check licenses, advisories, bans, sources (napi workspace)
# napi/ is a separate Cargo workspace (its own Cargo.lock) so
# its transitive graph is NOT seen by the root run above. Scan
# it explicitly against the same deny.toml policy. `--config`
# points back at the root deny.toml so both workspaces share
# one allowlist rather than drifting. `--manifest-path` is a
# global cargo-deny flag (before the subcommand); `--config`
# is a `check` flag (after it). Both paths are absolute via
# $GITHUB_WORKSPACE so the step is immune to any
# `defaults.run.working-directory` a future edit might add
# (a relative `--config` would otherwise resolve against the
# manifest dir and look for napi/deny.toml).
run: cargo deny --manifest-path "$GITHUB_WORKSPACE/napi/Cargo.toml" check --config "$GITHUB_WORKSPACE/deny.toml"
36 changes: 29 additions & 7 deletions .github/workflows/napi-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ concurrency:

permissions:
contents: read
# Required for the OIDC token exchange that the
# `.github/actions/setup-jfrog` composite uses to authenticate
# against the JFrog cargo proxy. The protected runner group blocks
# direct crates.io access, so cargo must route through the proxy.
# See go/hardened-gha.
id-token: write

defaults:
run:
Expand All @@ -62,14 +68,14 @@ jobs:
# this workflow via root Cargo.toml changes before the napi crate
# has merged.
precondition:
name: "Check napi/ sub-crate exists"
name: "Check napi sub-crate exists"
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
outputs:
ready: ${{ steps.check.outputs.ready }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: "Check for napi/Cargo.toml"
id: check
Expand All @@ -93,9 +99,18 @@ jobs:
# All cargo commands run from the napi/ standalone workspace.
working-directory: napi
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2
# Route cargo through the JFrog crates proxy. The protected
# runner group blocks direct crates.io, so without this every
# cargo command below fails to update the registry index. The
# composite writes ~/.cargo/config.toml (a source replacement),
# which preserves resolved versions, so `--locked` stays valid.
- uses: ./.github/actions/setup-jfrog
with:
cargo: "true"

- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
components: rustfmt, clippy

Expand All @@ -117,8 +132,15 @@ jobs:

# Release-profile build verifies the cdylib actually links with
# the production profile knobs (lto=true, codegen-units=1,
# strip="debuginfo"). Slower (~1m) but cheap insurance against
# release-only regressions that the debug-profile `cargo test`
# above wouldn't catch.
# strip="debuginfo"). The lto=true link is the slow part (~4 min
# here), and `cargo check --release` would NOT exercise it
# (check doesn't link the cdylib), so we keep the real build but
# run it only on push to main — a post-merge canary — rather
# than on every PR push. napi is not a required check, so this
# keeps PR feedback fast (fmt + clippy + test, ~2.5 min) while
# still catching release-only link regressions before they
# accumulate on main. The merge group does not run napi (no
# merge_group trigger), so main is the gate.
- name: cargo build --release --locked
if: github.event_name == 'push'
run: cargo build --release --locked
19 changes: 18 additions & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,26 @@ on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
# The `protect-main` ruleset enables a merge queue and lists this
# workflow's "Unit + doc tests" job as a required status check.
# GitHub re-evaluates required checks against the merge-group ref,
# so without this trigger the queue entry hangs until
# `check_response_timeout_minutes` expires. The sibling jobs
# (Formatting / Clippy / Build (tls-rustls feature)) also run on the
# merge group — they are advisory, not required, so the extra runs
# are harmless and keep the workflow trigger simple.
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
# pull_request: coalesce per head_ref (PR branch).
# merge_group: head_ref is empty, so fall back to github.ref (the
# unique gh-readonly-queue ref) — distinct queue entries stay
# separate.
# push to main: head_ref is also empty, but falling back to
# github.ref ("refs/heads/main") would make cancel-in-progress
# cancel the previous main push's in-flight CI. Pin to github.sha
# on push so each landed commit keeps its own isolated run.
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.head_ref || github.ref }}
cancel-in-progress: true

permissions:
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/pyo3-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
# kernel-only PRs that trigger this workflow via root Cargo.toml
# / Cargo.lock changes.
precondition:
name: "Check pyo3/ sub-crate exists"
name: "Check pyo3 sub-crate exists"
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
Expand Down Expand Up @@ -99,7 +99,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
# Cover the supported floor through the newest release. 3.13
# and 3.14 exercise the GIL / free-threading changes where
# PyO3 extensions most often break. Floor is 3.10 — matches
# `requires-python` in pyo3/pyproject.toml.
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Expand Down Expand Up @@ -132,7 +136,14 @@ jobs:
# age filter on `db-pypi` are the baseline protection. uv
# re-resolves each run within those bounds.
working-directory: pyo3
run: uv sync --group dev
# `--no-install-project` installs only the dependency groups,
# NOT the kernel cdylib itself. Without it, `uv sync` runs a
# full maturin/cargo RELEASE build of the extension here — and
# then the `maturin develop` step below rebuilds it again in
# debug, so the kernel compiled twice per matrix Python version
# (~5 min each, x5 versions). The Rust extension is built
# exactly once, by `maturin develop`.
run: uv sync --group dev --no-install-project

- name: Cargo unit tests (pyo3 crate)
# The pyo3 crate's Rust-side unit tests cover the GIL handoff
Expand All @@ -145,7 +156,12 @@ jobs:
# `develop` builds the extension and installs it into the
# uv-managed venv from the previous step. Debug build is
# fine for tests and ~2x faster than --release.
run: uv run maturin develop --interpreter python${{ matrix.python-version }}
#
# maturin's `develop` always targets the active virtualenv's
# interpreter and (unlike `build`) has no --interpreter flag;
# `uv run` already activates the venv `uv sync` created for the
# matrix Python version, so the interpreter is selected for us.
run: uv run maturin develop

- name: pytest (no-network + live tiers)
working-directory: pyo3
Expand Down
Loading
Loading