Skip to content

Commit f089fbc

Browse files
committed
feat: initial setup
1 parent a630d1f commit f089fbc

File tree

7 files changed

+909
-0
lines changed

7 files changed

+909
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
workspace

ecosystem-ci.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { readdir } from "node:fs/promises";
2+
import { resolve } from "node:path";
3+
import { cac } from "cac";
4+
5+
import { CommandOptions } from "./types";
6+
import { setupEnvironment } from "./utils";
7+
8+
const cli = cac();
9+
cli
10+
.command("[...suites]", "run selected suites")
11+
.option(
12+
"--release <version>",
13+
"@webcontainer/api release to use from npm registry"
14+
)
15+
.action(async (suites: string[], options: CommandOptions) => {
16+
await assertSuites(suites);
17+
18+
const { root, workspace } = await setupEnvironment();
19+
20+
for (const suite of suites) {
21+
const { test } = (await import(
22+
`./tests/${suite}.ts`
23+
)) as typeof import("./tests/starters");
24+
25+
await test({
26+
root,
27+
release: options.release,
28+
workspace: resolve(workspace, suite),
29+
});
30+
}
31+
});
32+
33+
cli.parse();
34+
35+
async function assertSuites(suites: string[]) {
36+
const directory = resolve(import.meta.dirname, "./tests");
37+
const tests = await readdir(directory);
38+
39+
for (const suite of suites) {
40+
if (!tests.includes(`${suite}.ts`)) {
41+
throw new Error(`"${suite}" does not exist in ${directory}`);
42+
}
43+
}
44+
}

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "webcontainers-ecosystem-ci",
3+
"version": "0.0.1",
4+
"description": "WebContainers Ecosystem CI",
5+
"license": "MIT",
6+
"type": "module",
7+
"packageManager": "[email protected]",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/stackblitz/webcontainers-ecosystem-ci.git"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/stackblitz/webcontainers-ecosystem-ci/issues"
14+
},
15+
"homepage": "https://github.com/stackblitz/webcontainers-ecosystem-ci#readme",
16+
"scripts": {
17+
"tsx": "tsx",
18+
"test": "tsx ecosystem-ci.ts"
19+
},
20+
"dependencies": {
21+
"@actions/core": "^1.11.1",
22+
"@antfu/ni": "^24.3.0",
23+
"cac": "^6.7.14",
24+
"tinyexec": "^1.0.1"
25+
},
26+
"devDependencies": {
27+
"@types/node": "^22.15.3",
28+
"tsx": "^4.19.3"
29+
}
30+
}

0 commit comments

Comments
 (0)