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

feat: Move all the configs to one single file #733

Merged
merged 52 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e4bd316
wip
Natoandro May 20, 2024
6538717
fix fat-cli compilation, add pre-commit check
Natoandro May 20, 2024
e6da732
compile the fat cli in tests instead of pre-commit
Natoandro May 20, 2024
bf8df07
chore: upgrade wamstime crate version to 20.0.2
destifo May 20, 2024
d73b2fa
chore: bump bump bump
Yohe-Am May 21, 2024
ef7c92c
fix: add cross to ghjk
Yohe-Am May 21, 2024
c5ae89b
fix: only build xtask once for the tests
Natoandro May 15, 2024
e7fd172
test: build meta-cli only once
Natoandro May 21, 2024
41e2ab5
remove deno task test
Natoandro May 21, 2024
19a8e08
wip: wip
Yohe-Am May 21, 2024
2b38960
wip: wip
Yohe-Am May 21, 2024
47e37ad
fix duplicate key
Natoandro May 21, 2024
f6fa74d
wip: wip
Yohe-Am May 21, 2024
4fd3ed5
fix: bugs
Yohe-Am May 21, 2024
222abc9
fix(ci): fromJson for runs-on
Yohe-Am May 21, 2024
85c1fbb
wip: huh??
Yohe-Am May 21, 2024
be04124
wip: try builder matrix
Yohe-Am May 21, 2024
bba9fb5
wip: try new builder config
Yohe-Am May 21, 2024
ad14d50
wip: final compat matrix config
Yohe-Am May 21, 2024
59d0e4a
fix: don't use clippy on compat jobs
Yohe-Am May 21, 2024
17b48a0
fix: disable linux/arm64
Yohe-Am May 21, 2024
2fd452b
fix: use macos-13
Yohe-Am May 22, 2024
135b47d
Merge branch 'main' into feat/met-521-unify-config
Natoandro May 22, 2024
122e976
Merge branch 'fix-release' into feat/met-522-xtask-compile-in-tests
Natoandro May 22, 2024
c7e2b6b
test: add built meta-cli to path
Natoandro May 22, 2024
295dae1
Merge branch 'feat/met-522-xtask-compile-in-tests' into feat/met-521-…
Natoandro May 22, 2024
b93f2b9
wip
Natoandro May 22, 2024
b40c639
fix typing
Natoandro May 22, 2024
4785b38
Merge branch 'main' into feat/met-522-xtask-compile-in-tests
Yohe-Am May 23, 2024
41093f5
fix: address feedback
Yohe-Am May 23, 2024
5dbc820
fix: bugs
Yohe-Am May 23, 2024
2439b26
switch order of entries in $PATH env var
Natoandro May 23, 2024
00bd4bc
remove changes on .vscode/settings.json
Natoandro May 23, 2024
1d6d51e
Merge branch 'feat/met-522-xtask-compile-in-tests' into feat/met-521-…
Natoandro May 23, 2024
45186e2
Merge branch 'main' into feat/met-521-unify-config
Natoandro Jun 17, 2024
b1150b0
fix crypto_test and auth test
Natoandro Jun 18, 2024
c397f1c
Merge branch 'main' into feat/met-521-unify-config
Natoandro Jun 18, 2024
a7cd0f3
fix some tests
Natoandro Jun 18, 2024
8ddabcb
fix tmp_dir config on test
Natoandro Jun 18, 2024
b4bfee4
restore remove lines from artifacts/local.ts
Natoandro Jun 18, 2024
433d101
update typegate/src/main.ts
Natoandro Jun 19, 2024
7c63d15
fix policies test and sync test
Natoandro Jun 20, 2024
6075835
fix loader
Natoandro Jun 20, 2024
be24bee
(docs) add example for each env var
Natoandro Jun 20, 2024
cb48b0b
add deno_v8_flags do the global config schema
Natoandro Jun 20, 2024
beb90bd
Merge branch 'main' into feat/met-521-unify-config
Natoandro Jun 20, 2024
6676cfd
fix wasm wire tests
Natoandro Jun 21, 2024
eb379da
Merge branch 'main' into feat/met-521-unify-config
Natoandro Jun 21, 2024
060d58f
remove obsolete comments
Natoandro Jun 24, 2024
99acab0
Merge branch 'main' into feat/met-521-unify-config
Natoandro Jun 24, 2024
ff78b23
fix pre-commit
Natoandro Jun 25, 2024
452769a
update snapshot for e2e typegraph test
Natoandro Jun 25, 2024
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
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 44 additions & 56 deletions dev/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,44 +79,45 @@ if (flags._.length === 0) {

const filter: string | undefined = flags.filter || flags.f;
const prefixLength = `${projectDir}/typegate/tests/`.length;
const fuse = new Fuse(testFiles.map((f) => f.slice(prefixLength)), {
includeScore: true,
useExtendedSearch: true,
threshold: 0.4,
});
const fuse = new Fuse(
testFiles.map((f) => f.slice(prefixLength)),
{
includeScore: true,
useExtendedSearch: true,
threshold: 0.4,
},
);
const filtered = filter ? fuse.search(filter) : null;
const filteredTestFiles = filtered?.map((res) => testFiles[res.refIndex]) ??
testFiles;

const tmpDir = join(projectDir, "tmp");
const env: Record<string, string> = {
"CLICOLOR_FORCE": "1",
"RUST_LOG": "off,xtask=debug,meta=debug",
"RUST_SPANTRACE": "1",
CLICOLOR_FORCE: "1",
RUST_LOG: "off,xtask=debug,meta=debug",
RUST_SPANTRACE: "1",
// "RUST_BACKTRACE": "short",
"RUST_MIN_STACK": "8388608",
"LOG_LEVEL": "DEBUG",
RUST_MIN_STACK: "8388608",
LOG_LEVEL: "DEBUG",
// "NO_COLOR": "1",
"DEBUG": "true",
"PACKAGED": "false",
"TG_SECRET":
DEBUG: "true",
PACKAGED: "false",
TG_SECRET:
"a4lNi0PbEItlFZbus1oeH/+wyIxi9uH6TpL8AIqIaMBNvp7SESmuUBbfUwC0prxhGhZqHw8vMDYZAGMhSZ4fLw==",
"TG_ADMIN_PASSWORD": "password",
"DENO_TESTING": "true",
"TMP_DIR": tmpDir,
"TIMER_MAX_TIMEOUT_MS": "30000",
"NPM_CONFIG_REGISTRY": "http://localhost:4873",
TG_ADMIN_PASSWORD: "password",
DENO_TESTING: "true",
TMP_DIR: tmpDir,
TIMER_MAX_TIMEOUT_MS: "30000",
NPM_CONFIG_REGISTRY: "http://localhost:4873",
// NOTE: ordering of the variables is important as we want the
// `meta` build to be resolved before any system meta builds
"PATH": `${join(projectDir, "target/debug")}:${Deno.env.get("PATH")}`,
PATH: `${join(projectDir, "target/debug")}:${Deno.env.get("PATH")}`,
};

await Deno.mkdir(tmpDir, { recursive: true });
// remove non-vendored caches
for await (const cache of Deno.readDir(tmpDir)) {
if (
cache.name.endsWith(".wasm") || cache.name == "libpython"
) {
if (cache.name.endsWith(".wasm") || cache.name == "libpython") {
continue;
}
await Deno.remove(join(tmpDir, cache.name), { recursive: true });
Expand Down Expand Up @@ -154,30 +155,26 @@ const denoConfig = join(projectDir, "typegate/deno.jsonc");
function createRun(testFile: string): Run {
const start = Date.now();
const child = new Deno.Command(xtask, {
args: [
"deno",
"test",
`--config=${denoConfig}`,
testFile,
...flags["--"],
],
args: ["deno", "test", `--config=${denoConfig}`, testFile, ...flags["--"]],
cwd: projectDir,
stdout: "piped",
stderr: "piped",
env: { ...Deno.env.toObject(), ...env },
}).spawn();

const output = mergeReadableStreams(child.stdout, child.stderr).pipeThrough(
new TextDecoderStream(),
).pipeThrough(new TextLineStream());
const output = mergeReadableStreams(child.stdout, child.stderr)
.pipeThrough(new TextDecoderStream())
.pipeThrough(new TextLineStream());

const promise = child.status.then(({ success }) => {
const end = Date.now();
return { success, testFile, duration: end - start };
}).catch(({ success }) => {
const end = Date.now();
return { success, testFile, duration: end - start };
});
const promise = child.status
.then(({ success }) => {
const end = Date.now();
return { success, testFile, duration: end - start };
})
.catch(({ success }) => {
const end = Date.now();
return { success, testFile, duration: end - start };
});

return {
promise,
Expand Down Expand Up @@ -224,9 +221,9 @@ await buildMetaCli();

void (async () => {
while (queues.length > 0) {
const current = Object.values(runs).filter((r) => !r.done).map((r) =>
r.promise
);
const current = Object.values(runs)
.filter((r) => !r.done)
.map((r) => r.promise);
if (current.length <= threads) {
const next = queues.shift()!;
runs[next] = createRun(next);
Expand All @@ -239,8 +236,7 @@ void (async () => {

let nexts = Object.keys(runs);
do {
const file = nexts.find((f) => !runs[f].done) ??
nexts[0];
const file = nexts.find((f) => !runs[f].done) ?? nexts[0];
const run = runs[file];
run.streamed = true;

Expand All @@ -254,9 +250,7 @@ do {
}

const { duration } = await run.promise;
console.log(
`${prefix} Completed ${relPath(file)} in ${duration / 1_000}s`,
);
console.log(`${prefix} Completed ${relPath(file)} in ${duration / 1_000}s`);

nexts = Object.keys(runs).filter((f) => !runs[f].streamed);
} while (nexts.length > 0);
Expand All @@ -281,17 +275,11 @@ for (const run of finished.sort((a, b) => a.duration - b.duration)) {
);
}

console.log(
` successes: ${successes.length}/${filteredTestFiles.length}`,
);
console.log(
` failures: ${failures.length}/${filteredTestFiles.length}`,
);
console.log(` successes: ${successes.length}/${filteredTestFiles.length}`);
console.log(` failures: ${failures.length}/${filteredTestFiles.length}`);
const filteredOutCount = testFiles.length - filteredTestFiles.length;
if (filteredOutCount > 0) {
console.log(
` ${filteredOutCount} test files were filtered out`,
);
console.log(` ${filteredOutCount} test files were filtered out`);
}

console.log("");
Expand Down
4 changes: 2 additions & 2 deletions libs/xtask/src/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ impl Test {
let permissions = mt_deno::deno::deno_runtime::permissions::PermissionsOptions {
allow_run: Some(
[
"cargo", "hostname", "meta", "git", "python3", "rm", "mkdir", "bash", "npm",
"pnpm", "setsid", "temporal", "deno",
"cargo", "deno", "hostname", "meta", "git", "python3", "rm", "mkdir", "bash",
"npm", "pnpm", "setsid", "temporal",
]
.into_iter()
.map(str::to_owned)
Expand Down
Loading
Loading