Skip to content
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

chore: Improve ecosystem-ci #9068

Merged
merged 10 commits into from
Jun 17, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function test(options: RunOptions) {
...options,
repo: "huozhi/bunchee",
branch: "main",
build: "build",
test: ["test"],
// build: "build",
test: ["test:ci"],
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export async function test(options: RunOptions) {
branch: "main",
build: "build",
test: ["test"],
agent: "yarn@berry",
});
}
18 changes: 12 additions & 6 deletions .github/swc-ecosystem-ci/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ export async function $(literals: TemplateStringsArray, ...values: any[]) {
const root = dirnameFrom(import.meta.url);

export async function setupEnvironment(): Promise<EnvironmentData> {
const workspace = path.resolve(root, "workspace");
const workspace = path.resolve(
root,
"..",
"..",
"..",
"swc-ecosystem-ci-workspace",
);
swcPath = path.resolve(workspace, ".swc");
cwd = process.cwd();
env = {
Expand Down Expand Up @@ -224,9 +230,10 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
cd(dir);
}
if (options.agent == null) {
const detectedAgent = await detect({ cwd: dir, autoInstall: true });
let detectedAgent = await detect({ cwd: dir, autoInstall: true });
if (detectedAgent == null) {
throw new Error(`Failed to detect packagemanager in ${dir}`);
console.error(`Failed to detect packagemanager in ${dir}`);
detectedAgent = "npm";
}
options.agent = detectedAgent;
}
Expand Down Expand Up @@ -265,8 +272,7 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
}
const overrides = options.overrides || {};
// https://github.com/facebook/react-native/issues/35701#issuecomment-1697798232
overrides["jest"] = path.join(swcPath, "node_modules", "jest");
overrides["ts-node"] = path.join(swcPath, "node_modules", "ts-node");
overrides["@swc/jest"] = path.join(swcPath, "node_modules", "@swc", "jest");
overrides["@swc/core"] = path.join(swcPath, "node_modules", "@swc", "core");
overrides["@swc/types"] = path.join(swcPath, "node_modules", "@swc", "types");
console.log("OVERRIDES", overrides);
Expand Down Expand Up @@ -496,7 +502,7 @@ export async function installSwc({ version }: { version: string }) {
await fs.promises.mkdir(swcPath, { recursive: true });
await fs.promises.writeFile(path.join(swcPath, "package.json"), "{}", "utf8");
cd(swcPath);
await $`npm install @swc/core@${version} @swc/jest @swc/types ts-node@11.0.0-beta.1 jest@29.6.4 --no-save --force`;
await $`npm install @swc/core@${version} @swc/jest @swc/types --no-save --force`;
}

export const isWorkingWithIgnoredTess = process.env.CI_MODE === "ignored";
Expand Down
Loading