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
4 changes: 3 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ jobs:
persist-credentials: false
ref: ${{ needs.release-context.outputs.orchestration_ref }}
path: .release-orchestration
sparse-checkout: cli/scripts/publish-release.ts
sparse-checkout: |
cli/scripts/publish-release.ts
cli/src/lib/object.ts
sparse-checkout-cone-mode: false

- name: Install Bun
Expand Down
2 changes: 1 addition & 1 deletion cli/scripts/publish-release.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { basename, join, resolve } from "node:path";
import { isRecord } from "@/lib/object.ts";
import { isRecord } from "../src/lib/object.ts";

export type NpmVersionLookup = { status: "published"; version: string } | { status: "missing" };

Expand Down
39 changes: 36 additions & 3 deletions cli/scripts/release.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, test } from "bun:test";
import { mkdtemp, readFile, rm } from "node:fs/promises";
import { copyFile, mkdir, mkdtemp, readFile, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { dirname, join } from "node:path";
import {
assertReleaseTag,
assertToolchain,
Expand Down Expand Up @@ -575,7 +575,9 @@ describe("release infrastructure wiring", () => {
expect(releaseCheckout?.with?.ref).toContain("release_ref");
expect(orchestrationCheckout?.with?.ref).toContain("orchestration_ref");
expect(orchestrationCheckout?.with?.path).toBe(".release-orchestration");
expect(orchestrationCheckout?.with?.["sparse-checkout"]).toBe("cli/scripts/publish-release.ts");
expect(orchestrationCheckout?.with?.["sparse-checkout"]).toBe(
"cli/scripts/publish-release.ts\ncli/src/lib/object.ts\n",
);

const orderedSteps = [
"Download tested release binaries",
Expand Down Expand Up @@ -608,6 +610,37 @@ describe("release infrastructure wiring", () => {
}
});

test("builds release publication from only the orchestration checkout", async () => {
const workflow = await readWorkflow("release-please.yml");
const checkout = workflow.jobs["release-artifacts"]?.steps?.find(
({ name }) => name === "Check out current release orchestration",
);
const sparseCheckout = checkout?.with?.["sparse-checkout"];
if (typeof sparseCheckout !== "string") {
throw new Error("Release orchestration sparse checkout is missing");
}
const paths = sparseCheckout
.trim()
.split("\n")
.map((path) => path.trim());
const directory = await mkdtemp(join(tmpdir(), "altertable-release-orchestration-test-"));
try {
for (const path of paths) {
const destination = join(directory, path);
await mkdir(dirname(destination), { recursive: true });
await copyFile(join(repositoryRoot, path), destination);
}
const result = await Bun.build({
entrypoints: [join(directory, "cli/scripts/publish-release.ts")],
outdir: join(directory, "dist"),
target: "bun",
});
expect(result.success).toBe(true);
} finally {
await rm(directory, { recursive: true, force: true });
}
});

test("retains recoverable release binaries longer than diagnostic artifacts", async () => {
const releaseWorkflow = await readWorkflow("release-please.yml");
const verificationWorkflow = await readWorkflow("verify.yml");
Expand Down
Loading