Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion .github/actions/ci-cli-coverage-shard/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ runs:
RIPGREP_VERSION: "14.1.0-1"
run: |
set -euo pipefail
sudo apt-get update -qq
sudo apt-get update -qq \
-o Dir::Etc::sourcelist="sources.list.d/ubuntu.sources" \
-o Dir::Etc::sourceparts="-"
sudo apt-get install -y --no-install-recommends \
"fd-find=${FD_FIND_VERSION}" \
"ripgrep=${RIPGREP_VERSION}"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr-review-advisor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ jobs:
- name: Install locked runtime
run: |
set -euo pipefail
sudo apt-get update -qq
sudo apt-get update -qq \
-o Dir::Etc::sourcelist="sources.list.d/ubuntu.sources" \
-o Dir::Etc::sourceparts="-"
sudo apt-get install -y --no-install-recommends "fd-find=${FD_FIND_VERSION}" "ripgrep=${RIPGREP_VERSION}"
test "$(dpkg-query -W -f='${Version}' fd-find)" = "$FD_FIND_VERSION"
test "$(dpkg-query -W -f='${Version}' ripgrep)" = "$RIPGREP_VERSION"
Expand Down
44 changes: 44 additions & 0 deletions test/automation/pull-requests/pr-workflow-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ describe("pull request and main workflow contracts", () => {
const mainWorkflow = readYaml<CiWorkflow>(".github/workflows/main.yaml");
const dcoWorkflow = readYaml<CiWorkflow>(".github/workflows/dco-check.yaml");
const installerHashWorkflow = readYaml<CiWorkflow>(".github/workflows/installer-hash-check.yaml");
const advisorWorkflow = readYaml<CiWorkflow>(".github/workflows/pr-review-advisor.yaml");
const sdkPackageWorkflow = readYaml<SdkPackageWorkflow>(
".github/workflows/openshell-sdk-package-pr.yaml",
);
Expand Down Expand Up @@ -570,6 +571,49 @@ describe("pull request and main workflow contracts", () => {
);
});

it.each([
[
"CLI shards",
requiredStep(sharedActions.cliCoverageShard, "Install pinned Pi search tools"),
],
[
"Advisor runtime",
requiredWorkflowStep(
advisorWorkflow.jobs["build-advisor-runtime"],
"Install locked runtime",
),
],
])("refreshes only Ubuntu package metadata for %s", (_name, installStep) => {
const temp = mkdtempSync(join(tmpdir(), "nemoclaw-ubuntu-apt-sources-"));
const fakeBin = join(temp, "bin");
const aptArgs = join(temp, "apt-args");
mkdirSync(fakeBin);
writeFileSync(
join(fakeBin, "sudo"),
'#!/usr/bin/env bash\nprintf "%s\\n" "$@" > "$APT_ARGS"\nexit 86\n',
{ mode: 0o755 },
);

try {
const result = runWorkflowShellStep(installStep, {
APT_ARGS: aptArgs,
PATH: `${fakeBin}:${process.env.PATH}`,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
});
expect(result.status).toBe(86);
expect(readFileSync(aptArgs, "utf8").trim().split("\n")).toEqual([
"apt-get",
"update",
"-qq",
"-o",
"Dir::Etc::sourcelist=sources.list.d/ubuntu.sources",
"-o",
"Dir::Etc::sourceparts=-",
]);
} finally {
rmSync(temp, { force: true, recursive: true });
}
});

// source-shape-contract: security -- The PR workflow must select an exact base-controlled package run before publishing its archive internally
it("passes only the base-packaged SDK archive to pull request dependency jobs", () => {
const packageJob = prWorkflow.jobs["openshell-sdk-package"];
Expand Down
Loading