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
32 changes: 32 additions & 0 deletions .github/actions/npm-ci-retry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# npm ci with retry

This action installs the checkout dependencies with up to three attempts and restores a node_modules tree only when its complete cache key matches. Node, npm, lockfile, project npm configuration, postinstall helpers and the action itself participate in the key. Cached and freshly installed trees still pass the existing native-runtime verification.

The installation step sets `ONNXRUNTIME_NODE_INSTALL=skip` before invoking npm. ONNX Runtime reads this environment variable directly, so skipping its additional CUDA installation does not depend on npm forwarding the custom `.npmrc` key. The repository retains that key temporarily; its npm warning can therefore remain.

## Installing this checkout locally

For a POSIX shell, set the variable on the install command:

```sh
ONNXRUNTIME_NODE_INSTALL=skip npm ci
```

Use `npm install` in place of `npm ci` when deliberately updating the lockfile.

In PowerShell, set it in the current shell before starting npm:

```powershell
$env:ONNXRUNTIME_NODE_INSTALL = "skip"
npm ci
```

The PowerShell assignment remains in that process environment and is inherited by its children. npm does not load the application's `.env` file for this purpose. A package preinstall script cannot set the environment of its parent npm process.

## Scope

The environment is scoped to this action's install step. Direct checkout-install steps in the enumerated workflows set the same variable themselves. It is not exported to unrelated workflow steps or changed for tarball smoke tests.

The Dockerfile checkout install already uses `--ignore-scripts`, then builds only the SQLite native dependency; that path does not execute the ONNX install script.

This policy does not force an environment variable on people installing the published package, on remote deployment commands, or inside a separate container. The checkout `.npmrc` is also not a configuration mechanism for those consumers. Those installation paths have their own contracts. The regression tests exercise the ONNX flag parser and a local npm lifecycle without downloading CUDA, installing the application or claiming to reproduce a startup crash.
4 changes: 3 additions & 1 deletion .github/actions/npm-ci-retry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ runs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: node_modules
key: node-modules-v3-${{ runner.os }}-${{ runner.arch }}-${{ steps.node.outputs.version }}-${{ steps.npm.outputs.version }}-${{ hashFiles('package-lock.json', '.npmrc', 'scripts/build/postinstall.mjs', 'scripts/build/postinstallSupport.mjs', 'scripts/build/colocateOptionals.mjs', 'scripts/build/wreqJsNative.mjs', 'scripts/build/fixPlaywrightAndroid.mjs', 'scripts/build/native-binary-compat.mjs', 'scripts/build/betterSqlitePrebuildTarget.mjs', 'scripts/ci/verify-ci-install.mjs') }}
key: node-modules-v3-${{ runner.os }}-${{ runner.arch }}-${{ steps.node.outputs.version }}-${{ steps.npm.outputs.version }}-${{ hashFiles('package-lock.json', '.npmrc', 'scripts/build/postinstall.mjs', 'scripts/build/postinstallSupport.mjs', 'scripts/build/colocateOptionals.mjs', 'scripts/build/wreqJsNative.mjs', 'scripts/build/fixPlaywrightAndroid.mjs', 'scripts/build/native-binary-compat.mjs', 'scripts/build/betterSqlitePrebuildTarget.mjs', 'scripts/ci/verify-ci-install.mjs', '.github/actions/npm-ci-retry/action.yml') }}

- name: npm ci (with retry)
if: steps.node-modules.outputs.cache-hit != 'true'
shell: bash
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
run: |
set -euo pipefail

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:

- name: Install dependencies
run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"

- name: Build Next.js app & CLI bundle
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/electron-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
- name: Install dependencies
run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
NPM_CONFIG_LEGACY_PEER_DEPS: true

- name: Build Next.js standalone
Expand Down Expand Up @@ -179,6 +180,7 @@ jobs:
- name: Install dependencies
run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
NPM_CONFIG_LEGACY_PEER_DEPS: true

# The Linux leg produces x64 + arm64 installers from one x64 runner. npm
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/mutation-redundancy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Run Stryker (disableBail)
env:
BATCH_MUTATE: ${{ matrix.batch.mutate }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/nightly-llm-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
- uses: actions/setup-node@v7
with: { node-version: "24", cache: npm }
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build CLI bundle
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
Expand Down Expand Up @@ -87,6 +89,8 @@ jobs:
if: steps.gate.outputs.run == 'true'
with: { node-version: "24", cache: npm }
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
if: steps.gate.outputs.run == 'true'
- name: Build CLI bundle
if: steps.gate.outputs.run == 'true'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly-mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ jobs:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Restore Stryker incremental cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly-property.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: fast-check random seed (high runs)
id: prop
run: FC_SEED=random FC_NUM_RUNS=2000 npm run test:property
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/nightly-resilience.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- run: npm run test:heap

chaos:
Expand All @@ -36,6 +38,8 @@ jobs:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- run: npm run test:chaos

k6-soak:
Expand All @@ -51,6 +55,8 @@ jobs:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build CLI bundle
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
Expand Down Expand Up @@ -121,6 +127,8 @@ jobs:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Cache Playwright browsers
uses: actions/cache@v6.1.0
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly-schemathesis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
} >> "$GITHUB_ENV"
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build CLI bundle
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/radar-export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
node-version: ${{ env.CI_NODE_VERSION }}
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Generate catalog export with provenance
run: node --import tsx/esm scripts/release/radar-export.mjs "$RUNNER_TEMP/export-omniroute.json"
- name: Publish to the stable release asset
Expand Down
1 change: 1 addition & 0 deletions changelog.d/features/16225-onnx-install-env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Set `ONNXRUNTIME_NODE_INSTALL=skip` explicitly for the shared dependency-install action and direct checkout install steps, include the action policy in the dependency cache identity, and document local shell usage. The legacy `.npmrc` key remains for compatibility; published-package consumer installs are outside this checkout policy.
Loading
Loading