Skip to content

Commit 3fef3d6

Browse files
committed
ci: make pixi lockfile updates predictable (NVIDIA#2298)
- Fail CI when a committed `pixi.lock` is stale (`pixi lock --check` per workspace). - Run pixi source-build CI with `PIXI_LOCKED=1` so jobs install from the lockfile instead of refreshing it. - Open monthly (and on-demand) lockfile-only PRs, one workspace at a time, via `pixi update --no-install`. - Document the contributor policy in `CONTRIBUTING.md`. Used codex(auto-balance) for changes.
1 parent 3fef50b commit 3fef3d6

6 files changed

Lines changed: 280 additions & 1 deletion

File tree

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Monthly (and on-demand) pixi lockfile refresh. Each workspace gets its own
6+
# PR so a benchmark or docs environment cannot drag unrelated package churn
7+
# into review. See #2298.
8+
9+
name: "CI: pixi lockfile refresh"
10+
11+
on:
12+
schedule:
13+
# 08:17 UTC on the 1st of each month. Offset from hour-start load and
14+
# from the daily CI / pixi source-test windows.
15+
- cron: "17 8 1 * *"
16+
workflow_dispatch:
17+
inputs:
18+
package:
19+
description: "Pixi workspace to refresh"
20+
type: choice
21+
default: all
22+
options:
23+
- all
24+
- root
25+
- cuda_pathfinder
26+
- cuda_bindings
27+
- cuda_core
28+
- benchmarks/cuda_bindings
29+
- benchmarks/cuda_core
30+
31+
defaults:
32+
run:
33+
shell: bash --noprofile --norc -xeuo pipefail {0}
34+
35+
env:
36+
# Keep in sync with ci-pixi-source-test.yml.
37+
PIXI_VERSION: "v0.73.0"
38+
39+
permissions: {}
40+
41+
jobs:
42+
# Job-level `if` cannot use `matrix` (evaluated before expansion). Filter
43+
# the workspace list here and pass it to refresh as a dynamic matrix.
44+
plan:
45+
name: Select workspaces
46+
if: ${{ github.repository_owner == 'nvidia' }}
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 5
49+
outputs:
50+
matrix: ${{ steps.select.outputs.matrix }}
51+
steps:
52+
- name: Select workspaces to refresh
53+
id: select
54+
env:
55+
PACKAGE: ${{ inputs.package || 'all' }}
56+
run: |
57+
all='[
58+
{"id":"root","manifest":".","lockfile":"pixi.lock"},
59+
{"id":"cuda_pathfinder","manifest":"cuda_pathfinder","lockfile":"cuda_pathfinder/pixi.lock"},
60+
{"id":"cuda_bindings","manifest":"cuda_bindings","lockfile":"cuda_bindings/pixi.lock"},
61+
{"id":"cuda_core","manifest":"cuda_core","lockfile":"cuda_core/pixi.lock"},
62+
{"id":"benchmarks/cuda_bindings","manifest":"benchmarks/cuda_bindings","lockfile":"benchmarks/cuda_bindings/pixi.lock"},
63+
{"id":"benchmarks/cuda_core","manifest":"benchmarks/cuda_core","lockfile":"benchmarks/cuda_core/pixi.lock"}
64+
]'
65+
if [ "${PACKAGE}" = "all" ]; then
66+
selected="${all}"
67+
else
68+
selected="$(jq -c --arg id "${PACKAGE}" '[.[] | select(.id == $id)]' <<<"${all}")"
69+
if [ "${selected}" = "[]" ]; then
70+
echo "::error::Unknown package '${PACKAGE}'"
71+
exit 1
72+
fi
73+
fi
74+
echo "matrix=$(jq -c '{include:.}' <<<"${selected}")" >> "${GITHUB_OUTPUT}"
75+
76+
refresh:
77+
name: "pixi update (${{ matrix.id }})"
78+
needs: plan
79+
runs-on: ubuntu-latest
80+
timeout-minutes: 30
81+
permissions:
82+
contents: write
83+
pull-requests: write
84+
concurrency:
85+
group: pixi-lock-refresh-${{ matrix.id }}
86+
cancel-in-progress: false
87+
strategy:
88+
fail-fast: false
89+
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
90+
steps:
91+
- name: Checkout ${{ github.event.repository.name }}
92+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
93+
with:
94+
fetch-depth: 0
95+
ref: ${{ github.event.repository.default_branch }}
96+
97+
- name: Setup pixi
98+
# Pinned to a commit SHA; install logic lives in the action and is
99+
# auditable/pinned (vs. a curl|bash of an unverified installer).
100+
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
101+
with:
102+
pixi-version: ${{ env.PIXI_VERSION }}
103+
run-install: false
104+
105+
- name: Update lockfile without installing
106+
run: pixi update --no-install --manifest-path "${{ matrix.manifest }}"
107+
108+
- name: Open or update a lockfile-only PR
109+
id: cpr
110+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
111+
with:
112+
token: ${{ github.token }}
113+
add-paths: ${{ matrix.lockfile }}
114+
commit-message: |
115+
chore: refresh pixi.lock for ${{ matrix.id }}
116+
117+
Scheduled pixi update --no-install for this workspace only.
118+
signoff: true
119+
sign-commits: true
120+
branch: ci/pixi-lock-refresh/${{ matrix.id }}
121+
delete-branch: true
122+
title: "chore: refresh pixi.lock (${{ matrix.id }})"
123+
labels: |
124+
CI/CD
125+
dependencies
126+
body: |
127+
Automated lockfile refresh for `${{ matrix.id }}` (`pixi update --no-install --manifest-path ${{ matrix.manifest }}`).
128+
129+
This PR is workspace-scoped so other packages are not forced to review unrelated solver churn. See #2298.
130+
131+
If the diff looks wrong, close this PR and leave the branch deleted; the next scheduled run will open a fresh one if an update is still needed.
132+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
133+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
134+
135+
- name: Summarize
136+
run: |
137+
{
138+
echo "### pixi lock refresh (${{ matrix.id }})"
139+
echo ""
140+
echo "- Manifest: \`${{ matrix.manifest }}\`"
141+
echo "- Lockfile: \`${{ matrix.lockfile }}\`"
142+
echo "- Operation: \`${{ steps.cpr.outputs.pull-request-operation }}\`"
143+
if [ -n "${{ steps.cpr.outputs.pull-request-url }}" ]; then
144+
echo "- PR: ${{ steps.cpr.outputs.pull-request-url }}"
145+
else
146+
echo "- No lockfile diff; PR not opened."
147+
fi
148+
} >> "$GITHUB_STEP_SUMMARY"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Fails when a committed pixi.lock is out of date with its pixi.toml.
6+
# Remediation: regenerate and commit the stale lockfile, e.g.
7+
# pixi lock --manifest-path <path>
8+
# See #2298.
9+
10+
name: "CI: pixi lockfile freshness"
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
14+
cancel-in-progress: true
15+
16+
on:
17+
pull_request:
18+
paths:
19+
- "**/pixi.toml"
20+
- "**/pixi.lock"
21+
- ".github/workflows/ci-pixi-lockfile.yml"
22+
push:
23+
branches:
24+
- "pull-request/[0-9]+"
25+
- "main"
26+
paths:
27+
- "**/pixi.toml"
28+
- "**/pixi.lock"
29+
- ".github/workflows/ci-pixi-lockfile.yml"
30+
workflow_dispatch: {}
31+
32+
defaults:
33+
run:
34+
shell: bash --noprofile --norc -xeuo pipefail {0}
35+
36+
env:
37+
# Keep in sync with ci-pixi-source-test.yml. Must be >=0.71.0 so the
38+
# committed lockfile format (v7) matches what this job checks against.
39+
PIXI_VERSION: "v0.73.0"
40+
41+
permissions: {}
42+
43+
jobs:
44+
lockfile-fresh:
45+
name: "pixi lock --check (${{ matrix.manifest }})"
46+
if: ${{ github.repository_owner == 'nvidia' }}
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 20
49+
permissions:
50+
contents: read
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
manifest:
55+
- .
56+
- cuda_pathfinder
57+
- cuda_bindings
58+
- cuda_core
59+
- benchmarks/cuda_bindings
60+
- benchmarks/cuda_core
61+
steps:
62+
- name: Checkout ${{ github.event.repository.name }}
63+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
64+
with:
65+
fetch-depth: 1
66+
persist-credentials: false
67+
68+
- name: Setup pixi
69+
# Pinned to a commit SHA; install logic lives in the action and is
70+
# auditable/pinned (vs. a curl|bash of an unverified installer).
71+
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
72+
with:
73+
pixi-version: ${{ env.PIXI_VERSION }}
74+
run-install: false
75+
76+
- name: Check lockfile is current with its manifest
77+
run: |
78+
if ! pixi lock --check --manifest-path "${{ matrix.manifest }}"; then
79+
echo "::error::Lockfile is stale for '${{ matrix.manifest }}'. Regenerate with: pixi lock --manifest-path ${{ matrix.manifest }}"
80+
exit 1
81+
fi

‎.github/workflows/ci-pixi-source-test.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ env:
6161
# older pixi re-ran the editable source build on every `pixi run`, recompiling
6262
# all Cython extensions (#2138). The fix (content-addressed source-build cache,
6363
# prefix-dev/pixi#6285 + #6123) also bumps the pixi.lock format to v7.
64+
# Keep in sync with ci-pixi-lockfile-refresh.yml and ci-pixi-lockfile.yml.
6465
PIXI_VERSION: "v0.73.0"
66+
# Install from the committed lockfile only. Covers nested `pixi run` calls
67+
# from root pixi.toml tasks; a stale lock must fail rather than being
68+
# refreshed in CI (#2298). Equivalent to `pixi run --locked`.
69+
PIXI_LOCKED: "1"
6570

6671
jobs:
6772
# ── PR guard: CPU-only build + import + placement smoke ──

‎.github/workflows/ci-workflow-health.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- "CI: Coverage"
1414
- "CI: Nightly optional-deps"
1515
- "CI: pixi run test (source build)"
16+
- "CI: pixi lockfile refresh"
1617
- "Security Suite (Pulse + CodeQL)"
1718
- "Static Analysis: Bandit Scan"
1819
types:

‎.github/workflows/pr-metadata-check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
PR_NUMBER: ${{ github.event.pull_request.number }}
3333
GH_REPO: ${{ github.repository }}
3434
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
IS_BOT: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' || github.actor == 'copy-pr-bot[bot]' }}
35+
IS_BOT: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' || github.actor == 'copy-pr-bot[bot]' || github.actor == 'github-actions[bot]' }}
3636
IS_DRAFT: ${{ github.event.pull_request.draft }}
3737
run: |
3838
if [ "$IS_BOT" = "true" ] || [ "$IS_DRAFT" = "true" ]; then

‎CONTRIBUTING.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of
2626
- [Type stubs for cuda.core](#type-stubs-for-cudacore)
2727
- [Pre-commit](#pre-commit)
2828
- [Pre-commit on Windows](#pre-commit-on-windows)
29+
- [Pixi lockfiles](#pixi-lockfiles)
2930
- [Signing Your Work](#signing-your-work)
3031
- [Code signing](#code-signing)
3132
- [Developer Certificate of Origin (DCO)](#developer-certificate-of-origin-dco)
@@ -179,6 +180,49 @@ commit` workflow. To resolve this, you can either:
179180
2. Skip it by setting the environment variable `SKIP` to `lychee`. This would
180181
be `$env:SKIP = "lychee"` in PowerShell or `set SKIP=lychee` in cmd.
181182

183+
## Pixi lockfiles
184+
185+
The repository checks in a `pixi.lock` next to each `pixi.toml`. Those lockfiles
186+
pin the solved dependency graph used by local pixi workflows and by CI, so they
187+
must stay in sync with their manifests and easy to review.
188+
189+
Manifests and lockfiles currently live at:
190+
191+
- `pixi.toml` / `pixi.lock`
192+
- `cuda_pathfinder/pixi.toml` / `cuda_pathfinder/pixi.lock`
193+
- `cuda_bindings/pixi.toml` / `cuda_bindings/pixi.lock`
194+
- `cuda_core/pixi.toml` / `cuda_core/pixi.lock`
195+
- `benchmarks/cuda_bindings/pixi.toml` / `benchmarks/cuda_bindings/pixi.lock`
196+
- `benchmarks/cuda_core/pixi.toml` / `benchmarks/cuda_core/pixi.lock`
197+
198+
Contributor expectations:
199+
200+
- If a PR changes a `pixi.toml`, update the corresponding `pixi.lock` in the
201+
same PR. Regenerating one lockfile:
202+
203+
```console
204+
$ pixi lock --manifest-path cuda_core
205+
```
206+
207+
Use `--manifest-path .` for the repository-root environment.
208+
- If a PR does not intentionally change pixi dependencies or metadata, do not
209+
include unrelated lockfile churn. `pixi run` can refresh a stale lockfile
210+
implicitly; revert that noise unless the refresh is the point of the change.
211+
- If a lockfile changes, the PR description should briefly say why.
212+
- Isolate large dependency refreshes from feature work when possible. Prefer a
213+
dedicated lockfile-only PR over mixing solver churn into an unrelated change.
214+
215+
CI enforces the contract: `pixi lock --check` fails when a committed lockfile is
216+
stale, and pixi source-build jobs run with `PIXI_LOCKED=1` so they install from
217+
the committed lock rather than updating it during the job. If either check
218+
fails, regenerate and commit the affected lockfile.
219+
220+
A monthly scheduled workflow (`CI: pixi lockfile refresh`) runs
221+
`pixi update --no-install` per workspace and opens a dedicated PR when that
222+
lockfile changes, so broad dependency churn is reviewed as maintenance rather
223+
than landing inside unrelated feature work. The workflow can also be dispatched
224+
manually for one package or for all of them.
225+
182226
## Secret Scanning
183227

184228
The `secret-scan-trufflehog` pre-commit hook scans staged files and installs TruffleHog into its own environment on first run, on Linux, macOS, and Windows. If it flags a secret, remove it before committing, or contact a maintainer if it's a false positive. Secrets are also scanned server-side in CI.

0 commit comments

Comments
 (0)