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

fix(ci): set up Python for Windows package verification (#966)

mldangelo-oai03db9822c356
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index a4056f263..6f5f035b9 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -629,6 +629,10 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
+ - name: Set up Python
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: "3.12"
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.ts
index 02be19530..317b05e1b 100644
--- a/sdk/typescript/tests-ts/release-automation.test.ts
+++ b/sdk/typescript/tests-ts/release-automation.test.ts
@@ -156,7 +156,7 @@ const {
const releaseCommit = "1e03c89ad22d2df5ae65b146be1483b3608572a9";
const releaseRun = "30481596229";
const releaseRepository = "openai/codex-security";
-const releaseTagTimeout = process.platform === "win32" ? 20_000 : 10_000;
+const releaseWorkflowTimeout = process.platform === "win32" ? 20_000 : 10_000;
const bash = bashCommand();
@@ -2189,7 +2189,7 @@ describe("GitHub release workflow safeguards", () => {
RELEASE_SHA: releaseCommit,
RELEASE_TAG: "npm-v0.1.2",
},
- timeout: releaseTagTimeout,
+ timeout: releaseWorkflowTimeout,
});
expect(result.status).toBe(0);
@@ -2258,7 +2258,7 @@ describe("GitHub release workflow safeguards", () => {
MOCK_LOOKUP_RESPONSE: lookupResponse,
RELEASE_TAG: "npm-v0.1.2",
},
- timeout: releaseTagTimeout,
+ timeout: releaseWorkflowTimeout,
});
expect(result.status).toBe(status);
@@ -2335,7 +2335,7 @@ describe("GitHub release workflow safeguards", () => {
MOCK_TAG_TYPE: tagType,
RELEASE_TAG: "npm-v0.1.2",
},
- timeout: releaseTagTimeout,
+ timeout: releaseWorkflowTimeout,
});
expect(result.status).toBe(status);
@@ -3711,7 +3711,7 @@ describe("GitHub release workflow safeguards", () => {
RELEASE_TAG: "npm-v0.1.2",
RELEASE_VERSION: "0.1.2",
},
- timeout: 10_000,
+ timeout: releaseWorkflowTimeout,
});
expect(result.status).toBe(status);
diff --git a/sdk/typescript/tests-ts/skeleton.test.ts b/sdk/typescript/tests-ts/skeleton.test.ts
index dc1e83bbd..c1a7a5e83 100644
--- a/sdk/typescript/tests-ts/skeleton.test.ts
+++ b/sdk/typescript/tests-ts/skeleton.test.ts
@@ -164,6 +164,30 @@ describe("TypeScript package skeleton", () => {
"22.13.0",
"24",
]);
+ const verificationSteps = jobs["windows-verify"]!.steps!;
+ const shardPython = jobs["windows-test"]!.steps!.find(({ uses }) =>
+ uses?.startsWith("actions/setup-python@"),
+ );
+ const pythonSetup = verificationSteps.findIndex(({ uses }) =>
+ uses?.startsWith("actions/setup-python@"),
+ );
+ const packageInspection = verificationSteps.findIndex(
+ ({ run }) => run === "node scripts/check-package.mjs ../../dist/*.tgz",
+ );
+ expect(shardPython?.uses).toMatch(/^actions\/setup-python@[a-f0-9]{40}$/);
+ expect(pythonSetup).toBeGreaterThanOrEqual(0);
+ expect(pythonSetup).toBeLessThan(packageInspection);
+ expect(verificationSteps[pythonSetup]).toMatchObject({
+ 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"],
+ );
expect(jobs["required-test"]?.name).toBe("${{ matrix.os }} / node-22");
expect(jobs["required-test"]?.needs).toEqual([
"validate-title",