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
8 changes: 5 additions & 3 deletions src/repos/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export interface RepoConfig {
code?: string[];
docs?: string[];
};
/** Skip applying the version tag to this repo (clone default branch instead) */
skipVersionTag?: boolean;
/** Override specific sparse paths to come from a different branch instead of the tag */
sparsePathOverrides?: { paths: string[]; branch: string }[];
}
Expand All @@ -37,7 +39,6 @@ const BASE_REPOS: Omit<RepoConfig, "tag">[] = [
name: "aztec-packages",
url: "https://github.com/AztecProtocol/aztec-packages",
sparse: [
"docs",
"noir-projects/aztec-nr",
"noir-projects/noir-contracts",
"yarn-project",
Expand Down Expand Up @@ -116,6 +117,7 @@ const BASE_REPOS: Omit<RepoConfig, "tag">[] = [
{
name: "gregoswap",
url: "https://github.com/AztecProtocol/gregoswap",
skipVersionTag: true,
description: "Gregoswap - token swap application built on Aztec",
searchPatterns: {
code: ["*.nr", "*.ts"],
Expand All @@ -133,8 +135,8 @@ export function getAztecRepos(version?: string): RepoConfig[] {

return BASE_REPOS.map((repo) => ({
...repo,
// Only apply version tag to Aztec repos, not Noir repos
tag: repo.url.includes("AztecProtocol") ? tag : undefined,
// Only apply version tag to Aztec repos that don't opt out
tag: repo.url.includes("AztecProtocol") && !repo.skipVersionTag ? tag : undefined,
// Resolve {version} placeholders in sparse path overrides
sparsePathOverrides: repo.sparsePathOverrides?.map((override) => ({
...override,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function cloneRepo(
const git: SimpleGit = simpleGit();

// Determine ref to checkout: commit > tag > branch
const ref = config.commit || config.tag || config.branch;
const ref = config.commit || config.tag || config.branch || "default";
const refType = config.commit ? "commit" : config.tag ? "tag" : "branch";

if (config.sparse && config.sparse.length > 0) {
Expand Down
29 changes: 10 additions & 19 deletions tests/repos/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ describe("AZTEC_REPOS", () => {
expect(noir!.sparse!.length).toBeGreaterThan(0);
});

it("aztec-packages has sparsePathOverrides for docs/docs on next branch", () => {
it("aztec-packages has sparsePathOverrides for versioned docs on next branch", () => {
const ap = AZTEC_REPOS.find((r) => r.name === "aztec-packages");
expect(ap?.sparse).toContain("docs");
expect(ap?.sparse).not.toContain("docs");
expect(ap?.sparsePathOverrides).toEqual([
{
paths: [
Expand All @@ -50,31 +50,22 @@ describe("AZTEC_REPOS", () => {
});

describe("getAztecRepos", () => {
it("applies version tag only to AztecProtocol repos", () => {
it("applies version tag only to AztecProtocol repos without skipVersionTag", () => {
const repos = getAztecRepos();
const aztecProtocolRepos = repos.filter((r) =>
r.url.includes("AztecProtocol")
);
const otherRepos = repos.filter(
(r) => !r.url.includes("AztecProtocol")
);

expect(aztecProtocolRepos).toHaveLength(5);
for (const repo of aztecProtocolRepos) {
const taggedRepos = repos.filter((r) => r.tag !== undefined);
expect(taggedRepos).toHaveLength(4);
for (const repo of taggedRepos) {
expect(repo.tag).toBe(DEFAULT_AZTEC_VERSION);
}

for (const repo of otherRepos) {
expect(repo.tag).toBeUndefined();
}
const gregoswap = repos.find((r) => r.name === "gregoswap");
expect(gregoswap?.tag).toBeUndefined();
});

it("uses custom version when provided", () => {
const repos = getAztecRepos("v2.0.0");
const aztecProtocolRepos = repos.filter((r) =>
r.url.includes("AztecProtocol")
);
for (const repo of aztecProtocolRepos) {
const taggedRepos = repos.filter((r) => r.tag !== undefined);
for (const repo of taggedRepos) {
expect(repo.tag).toBe("v2.0.0");
}
});
Expand Down