Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

ci: use one matrix for installed package checks (#2018)

Michael D'Angeloa3821d15825f
diff --git a/.github/scripts/check-ci-results.mjs b/.github/scripts/check-ci-results.mjs
index 3538afc19..fe83b1f51 100644
--- a/.github/scripts/check-ci-results.mjs
+++ b/.github/scripts/check-ci-results.mjs
@@ -8,7 +8,7 @@ export function failedChecks(needs) {
const required = ["static-checks"];
const groups = {
"package-required": ["native", "package", "compatibility"],
- "source-required": ["test", "windows-test", "windows-verify"],
+ "source-required": ["test", "windows-test"],
"plugin-tests-required": ["mcp", "plugin-host", "plugin-source"],
"workflow-quality": ["workflow-quality"],
"container-validate": ["container-validate"],
diff --git a/.github/scripts/select-ci-checks.mjs b/.github/scripts/select-ci-checks.mjs
index dd159562d..c990df89f 100644
--- a/.github/scripts/select-ci-checks.mjs
+++ b/.github/scripts/select-ci-checks.mjs
@@ -66,6 +66,10 @@ export function selectChecks(paths, options) {
.filter((version) => full || version !== "26")
.map((version) => ({ os: "ubuntu-latest", node: version }));
compatibility.push({ os: "macos-latest", node: "22.13.0" });
+ if (scope !== "python-tests") {
+ compatibility.push({ os: "windows-latest", node: "22.13.0" });
+ if (full) compatibility.push({ os: "windows-latest", node: "24" });
+ }
const pythonMatrix = [
...["3.10", "3.12", "3.14"]
.filter((version) => full || version === "3.12")
@@ -104,9 +108,6 @@ export function selectChecks(paths, options) {
: compatibility,
}),
"python-matrix": JSON.stringify({ include: pythonMatrix }),
- "windows-node-matrix": JSON.stringify({
- node: full ? ["22.13.0", "24"] : ["22.13.0"],
- }),
};
if (scope === "python-tests") {
for (const name of ["source-required", "action-ci", "eval-contracts"])
diff --git a/.github/scripts/test-ci-selection.mjs b/.github/scripts/test-ci-selection.mjs
index 09fff0ec5..4c9169e9b 100644
--- a/.github/scripts/test-ci-selection.mjs
+++ b/.github/scripts/test-ci-selection.mjs
@@ -25,6 +25,7 @@ const regularSource = {
{ os: "ubuntu-latest", node: "24" },
{ os: "ubuntu-latest", node: "26.0.0" },
{ os: "macos-latest", node: "22.13.0" },
+ { os: "windows-latest", node: "22.13.0" },
],
}),
"python-matrix": JSON.stringify({
@@ -42,7 +43,6 @@ const regularSource = {
},
],
}),
- "windows-node-matrix": JSON.stringify({ node: ["22.13.0"] }),
};
const fullQualification = {
...regularSource,
@@ -57,6 +57,8 @@ const fullQualification = {
{ os: "ubuntu-latest", node: "26.0.0" },
{ os: "ubuntu-latest", node: "26" },
{ os: "macos-latest", node: "22.13.0" },
+ { os: "windows-latest", node: "22.13.0" },
+ { os: "windows-latest", node: "24" },
],
}),
"python-matrix": JSON.stringify({
@@ -76,7 +78,6 @@ const fullQualification = {
},
],
}),
- "windows-node-matrix": JSON.stringify({ node: ["22.13.0", "24"] }),
};
const docs = {
@@ -120,6 +121,11 @@ test("only edits to existing direct pytest modules skip independent jobs", (t) =
commit("test_2fa.py", "conftest.py");
const reduced = {
...fullQualification,
+ "compatibility-matrix": JSON.stringify({
+ include: JSON.parse(
+ fullQualification["compatibility-matrix"],
+ ).include.filter(({ os }) => os !== "windows-latest"),
+ }),
"source-required": "false",
"action-ci": "false",
"eval-contracts": "false",
@@ -435,7 +441,6 @@ function successfulFullRun() {
"plugin-host",
"plugin-source",
"windows-test",
- "windows-verify",
"workflow-quality",
"container-validate",
].map((name) => [name, { result: "success" }]),
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index f2c6d61af..c276131ef 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -42,7 +42,6 @@ jobs:
workflow-quality: ${{ steps.scope.outputs.workflow-quality }}
compatibility-matrix: ${{ steps.scope.outputs.compatibility-matrix }}
python-matrix: ${{ steps.scope.outputs.python-matrix }}
- windows-node-matrix: ${{ steps.scope.outputs.windows-node-matrix }}
steps:
- name: Checkout repository for change classification
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -249,16 +248,19 @@ jobs:
matrix: ${{ fromJSON(needs.classify-changes.outputs.compatibility-matrix) }}
steps:
- *checkout-repository
- - &set-up-node-js
- name: Set up Node.js
+ - name: Set up Python on Windows
+ if: runner.os == 'Windows'
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: "3.12"
+ - name: Set up Node.js
id: node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: sdk/typescript/pnpm-lock.yaml
- - &resolve-npm-cache
- name: Resolve npm download cache
+ - name: Resolve npm download cache
id: npm-cache
if: steps.node.outputs.cache-hit != 'true'
shell: bash
@@ -267,8 +269,7 @@ jobs:
run: |
echo "path=$(npm config get cache)" >> "$GITHUB_OUTPUT"
echo "restore-prefix=${PRIMARY_CACHE_KEY%-*}-" >> "$GITHUB_OUTPUT"
- - &restore-npm-cache
- name: Restore previous npm downloads
+ - name: Restore previous npm downloads
if: steps.node.outputs.cache-hit != 'true'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
@@ -278,7 +279,8 @@ jobs:
- *download-package-for-this-commit
- name: Inspect installed package
working-directory: sdk/typescript
- env: &package-deep-retry
+ shell: bash
+ env:
# A successful main push can be tagged for release. Only PRs sample retries by runtime.
PACKAGE_DEEP_RETRY: ${{ github.event_name != 'pull_request' || matrix.node == '22.13.0' || strategy.job-total == 1 }}
run: node scripts/check-package.mjs ../../dist/*.tgz
@@ -487,7 +489,6 @@ jobs:
container-validate,
workflow-quality,
windows-test,
- windows-verify,
]
if: always()
runs-on: ubuntu-latest
@@ -563,25 +564,3 @@ jobs:
TMPDIR: ${{ steps.windows-temp.outputs.path }}
CODEX_SECURITY_ALLOW_MACHINE_POLICY_TEST: "true"
run: bun test --timeout 360000 ./tests-ts/windows-machine-policy.test.ts
-
- windows-verify:
- if: needs.classify-changes.outputs.source-required == 'true'
- name: windows-latest / node-${{ matrix.node == '22.13.0' && '22' || matrix.node }} / verify
- needs: [classify-changes, package]
- runs-on: windows-latest
- timeout-minutes: 20
- strategy:
- fail-fast: false
- matrix: ${{ fromJSON(needs.classify-changes.outputs.windows-node-matrix) }}
- steps:
- - *checkout-repository
- - *set-up-python
- - *set-up-node-js
- - *resolve-npm-cache
- - *restore-npm-cache
- - *download-package-for-this-commit
- - name: Inspect installed package
- working-directory: sdk/typescript
- shell: bash
- env: *package-deep-retry
- run: node scripts/check-package.mjs ../../dist/*.tgz
diff --git a/sdk/typescript/tests-ts/skeleton.test.ts b/sdk/typescript/tests-ts/skeleton.test.ts
index 11a2864b0..87d18a631 100644
--- a/sdk/typescript/tests-ts/skeleton.test.ts
+++ b/sdk/typescript/tests-ts/skeleton.test.ts
@@ -20,10 +20,7 @@ const { selectChecks } = (await import(
selectChecks(
paths: string[],
options: { event: string; baseChanged?: boolean },
- ): Record<
- "compatibility-matrix" | "windows-node-matrix" | "python-matrix",
- string
- >;
+ ): Record<"compatibility-matrix" | "python-matrix", string>;
};
interface WorkflowStep {
@@ -119,18 +116,13 @@ describe("TypeScript package skeleton", () => {
node,
})),
{ os: "macos-latest", node: "22.13.0" },
+ { os: "windows-latest", node: "22.13.0" },
+ { os: "windows-latest", node: "24" },
]);
expect(jobs["windows-test"]?.strategy?.matrix).toEqual({
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
});
- expect(jobs["windows-verify"]?.strategy?.matrix).toBe(
- "${{ fromJSON(needs.classify-changes.outputs.windows-node-matrix) }}",
- );
- expect(JSON.parse(selected["windows-node-matrix"]).node).toEqual([
- "22.13.0",
- "24",
- ]);
- const verificationSteps = jobs["windows-verify"]!.steps!;
+ const verificationSteps = jobs["compatibility"]!.steps!;
const shardPython = jobs["windows-test"]!.steps!.find(({ uses }) =>
uses?.startsWith("actions/setup-python@"),
);
@@ -144,58 +136,50 @@ describe("TypeScript package skeleton", () => {
expect(pythonSetup).toBeGreaterThanOrEqual(0);
expect(pythonSetup).toBeLessThan(packageInspection);
expect(verificationSteps[pythonSetup]).toMatchObject({
+ if: "runner.os == 'Windows'",
uses: shardPython?.uses,
with: { "python-version": "3.12" },
});
- expect(verificationSteps[pythonSetup]).not.toHaveProperty("if");
expect(verificationSteps[pythonSetup]).not.toHaveProperty(
"continue-on-error",
);
expect([false, "false"]).not.toContain(
verificationSteps[pythonSetup]?.with?.["update-environment"],
);
- for (const name of ["compatibility", "windows-verify"]) {
- expect(jobs[name]?.steps).toContainEqual(
- expect.objectContaining({
- run: "node scripts/check-package.mjs ../../dist/*.tgz",
- }),
- );
- expect(jobs[name]?.steps!.some(({ name }) => name === "Set up Bun")).toBe(
- false,
- );
- }
+ expect(verificationSteps[packageInspection]?.shell).toBe("bash");
+ expect(verificationSteps.some(({ name }) => name === "Set up Bun")).toBe(
+ false,
+ );
});
test("reuses npm downloads after lockfile changes without skipping package installation", async () => {
const { jobs } = await workflow("node-ci.yml");
- for (const name of ["compatibility", "windows-verify"]) {
- const steps = jobs[name]!.steps!;
- const setup = steps.findIndex(({ id }) => id === "node");
- const resolver = steps.findIndex(({ id }) => id === "npm-cache");
- const restore = steps.findIndex(({ uses }) =>
- uses?.startsWith("actions/cache/restore@"),
- );
- const inspection = steps.findIndex(
- ({ name }) => name === "Inspect installed package",
- );
- expect(setup).toBeGreaterThanOrEqual(0);
- expect(setup).toBeLessThan(resolver);
- expect(resolver).toBeLessThan(restore);
- expect(restore).toBeLessThan(inspection);
- expect(steps[setup]?.with?.["cache"]).toBe("npm");
- expect(steps[resolver]?.env).toEqual({
- PRIMARY_CACHE_KEY: "${{ steps.node.outputs.cache-primary-key }}",
- });
- for (const index of [resolver, restore]) {
- expect(steps[index]?.if).toBe("steps.node.outputs.cache-hit != 'true'");
- }
- expect(steps[restore]?.with).toEqual({
- path: "${{ steps.npm-cache.outputs.path }}",
- key: "${{ steps.node.outputs.cache-primary-key }}",
- "restore-keys": "${{ steps.npm-cache.outputs.restore-prefix }}",
- });
- expect(steps[inspection]).not.toHaveProperty("if");
+ const steps = jobs["compatibility"]!.steps!;
+ const setup = steps.findIndex(({ id }) => id === "node");
+ const resolver = steps.findIndex(({ id }) => id === "npm-cache");
+ const restore = steps.findIndex(({ uses }) =>
+ uses?.startsWith("actions/cache/restore@"),
+ );
+ const inspection = steps.findIndex(
+ ({ name }) => name === "Inspect installed package",
+ );
+ expect(setup).toBeGreaterThanOrEqual(0);
+ expect(setup).toBeLessThan(resolver);
+ expect(resolver).toBeLessThan(restore);
+ expect(restore).toBeLessThan(inspection);
+ expect(steps[setup]?.with?.["cache"]).toBe("npm");
+ expect(steps[resolver]?.env).toEqual({
+ PRIMARY_CACHE_KEY: "${{ steps.node.outputs.cache-primary-key }}",
+ });
+ for (const index of [resolver, restore]) {
+ expect(steps[index]?.if).toBe("steps.node.outputs.cache-hit != 'true'");
}
+ expect(steps[restore]?.with).toEqual({
+ path: "${{ steps.npm-cache.outputs.path }}",
+ key: "${{ steps.node.outputs.cache-primary-key }}",
+ "restore-keys": "${{ steps.npm-cache.outputs.restore-prefix }}",
+ });
+ expect(steps[inspection]).not.toHaveProperty("if");
});
test("npm cache fallback shares lockfile versions within each platform and architecture", async () => {
@@ -369,13 +353,7 @@ describe("TypeScript package skeleton", () => {
"if-no-files-found": "error",
});
expect(uploads[upload]).not.toHaveProperty("continue-on-error");
- for (const name of [
- "test",
- "windows-test",
- "mcp",
- "compatibility",
- "windows-verify",
- ]) {
+ for (const name of ["test", "windows-test", "mcp", "compatibility"]) {
const job = jobs[name]!;
expect(job.needs).toContain("package");
expect(