Repository navigation
chore: Cherry-picked changes from upstream #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1d2d636
Add dependency cooldowns (#1021)
github-actions[bot] b54ffe5
chore: update known checksums for 0.12.5 (#1020)
github-actions[bot] f15e5f7
Use JSON + a typed wrapper instead of TS codegen (#1025)
github-actions[bot] a989306
Use JSON + a typed wrapper instead of TS codegen (#1025)
github-actions[bot] 12e62f2
Harden npm install defaults (#1026)
github-actions[bot] b9630c1
Harden npm install defaults (#1026)
github-actions[bot] 75c320a
Verify downloads with astral-sh/versions checksums (#1033)
github-actions[bot] fe22e18
Verify downloads with astral-sh/versions checksums (#1033)
github-actions[bot] ad9b512
Verify downloads with astral-sh/versions checksums (#1033)
github-actions[bot] a005646
Verify downloads with astral-sh/versions checksums (#1033)
github-actions[bot] cde9cc2
Verify downloads with astral-sh/versions checksums (#1033)
github-actions[bot] c9b03ce
Expose a Python "identity" output (#1036)
github-actions[bot] 4c8b911
Expose a Python "identity" output (#1036)
github-actions[bot] 3266937
Expose a Python "identity" output (#1036)
github-actions[bot] d231dc0
Expose a Python "identity" output (#1036)
github-actions[bot] 0f945cf
fix: respect no proxy directive (#1037)
github-actions[bot] 94d6d39
chore(deps-dev): roll up Dependabot updates (#1043)
github-actions[bot] 69dcf87
fix: apply code build script
github-actions[bot] d9394a0
fix: apply code build script
github-actions[bot] 25ddea0
conflicted commits cherry-picked
Raj-StepSecurity e3d5e6e
comments addressed
Raj-StepSecurity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| engine-strict = true | ||
| ignore-scripts = true | ||
| min-release-age=3 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 24 | ||
| 24.19.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
__tests__/download/checksum/update-known-checksums.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { promises as fs } from "node:fs"; | ||
| import os from "node:os"; | ||
| import path from "node:path"; | ||
| import { expect, test } from "@jest/globals"; | ||
| import { updateChecksums } from "../../../src/download/checksum/update-known-checksums"; | ||
|
|
||
| test("serializes checksum entries as JSON data", async () => { | ||
| const tempDirectory = await fs.mkdtemp( | ||
| path.join(os.tmpdir(), "setup-uv-checksums-test-"), | ||
| ); | ||
| const outputPath = path.join(tempDirectory, "known-checksums.json"); | ||
| const key = 'platform-1.0.0"\n};\nglobalThis.compromised = true;'; | ||
| const checksum = 'checksum"\\\nvalue'; | ||
|
|
||
| try { | ||
| await updateChecksums(outputPath, [ | ||
| { checksum, key }, | ||
| { checksum: "duplicate", key }, | ||
| ]); | ||
|
|
||
| const content = await fs.readFile(outputPath, "utf8"); | ||
| expect(JSON.parse(content)).toEqual({ [key]: checksum }); | ||
| expect(content.endsWith("\n")).toBe(true); | ||
| } finally { | ||
| await fs.rm(tempDirectory, { force: true, recursive: true }); | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import { promisify } from "node:util"; | ||
| import { beforeEach, expect, it, jest } from "@jest/globals"; | ||
| import { createSetupInputs } from "../helpers/setup-inputs"; | ||
|
|
||
| const mockExecFile = | ||
| jest.fn< | ||
| (...args: unknown[]) => Promise<{ stdout: string; stderr: string }> | ||
| >(); | ||
| const inputs = createSetupInputs({ | ||
| activateEnvironment: true, | ||
| pythonVersion: "3.15t", | ||
| }); | ||
|
|
||
| jest.unstable_mockModule("node:child_process", () => ({ | ||
| // execFile's custom promisifier returns both stdout and stderr. | ||
| execFile: Object.assign(mockExecFile, { [promisify.custom]: mockExecFile }), | ||
| })); | ||
|
|
||
| const { getPythonRuntimeId } = await import("../../src/utils/python-runtime"); | ||
|
|
||
| beforeEach(() => { | ||
| mockExecFile.mockReset(); | ||
| mockExecFile.mockResolvedValue({ | ||
| stderr: "", | ||
| stdout: '[{"key":"cpython-3.13.1-linux-x86_64-gnu"}]\r\n', | ||
| }); | ||
| }); | ||
|
|
||
| it("does not query uv without environment activation", async () => { | ||
| expect( | ||
| await getPythonRuntimeId({ ...inputs, activateEnvironment: false }), | ||
| ).toBe(""); | ||
| expect(mockExecFile).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it.each([ | ||
| "cpython-3.13.1-linux-x86_64-gnu", | ||
| "cpython-3.15.0rc1+freethreaded-macos-aarch64-none", | ||
| "cpython-3.15.0rc2+freethreaded-windows-x86_64-none", | ||
| "pypy-3.11.15-linux-x86_64-gnu", | ||
| ])("returns uv's opaque runtime key unchanged: %s", async (key) => { | ||
| mockExecFile.mockResolvedValue({ | ||
| stderr: "", | ||
| stdout: `${JSON.stringify([{ key }])}\r\n`, | ||
| }); | ||
| expect(await getPythonRuntimeId(inputs)).toBe(key); | ||
| }); | ||
|
|
||
| it.each(['/runner temp/a "quoted" venv', "C:\\runner temp\\custom venv"])( | ||
| "queries the exact venv directory: %s", | ||
| async (venvPath) => { | ||
| await getPythonRuntimeId({ ...inputs, venvPath }); | ||
| expect(mockExecFile).toHaveBeenCalledWith( | ||
| "uv", | ||
| [ | ||
| "python", | ||
| "list", | ||
| venvPath, | ||
| "--only-installed", | ||
| "--output-format", | ||
| "json", | ||
| ], | ||
| { encoding: "utf8" }, | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| it.each([ | ||
| new Error("uv failed"), | ||
| "not JSON", | ||
| "null", | ||
| "{}", | ||
| "[]", | ||
| '[{"key":""}]', | ||
| '[{"key":123}]', | ||
| '[{"key":"first"},{"key":"second"}]', | ||
| ])("rejects uv failure or invalid results: %s", async (result) => { | ||
| if (result instanceof Error) { | ||
| mockExecFile.mockRejectedValue(result); | ||
| } else { | ||
| mockExecFile.mockResolvedValue({ stderr: "", stdout: result }); | ||
| } | ||
| await expect(getPythonRuntimeId(inputs)).rejects.toThrow( | ||
| "Failed to identify the activated environment's Python runtime:", | ||
| ); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.