Skip to content

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Jun 17, 2024
1 parent 74949d5 commit 28637dc
Show file tree
Hide file tree
Showing 23 changed files with 490 additions and 381 deletions.
458 changes: 236 additions & 222 deletions .ghjk/lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
- checks_requested

env:
GHJK_VERSION: "5bb0d24"
GHJK_VERSION: "fbd977d"
DENO_VERSION: "1.43.6"
RUST_BACKTRACE: "full"
RUST_LOG: "info,swc_ecma_codegen=off,tracing::span=off"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
- main

env:
GHJK_VERSION: "5bb0d24"
GHJK_VERSION: "fbd977d"

jobs:
changes:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- v*

env:
GHJK_VERSION: "5bb0d24"
GHJK_VERSION: "fbd977d"
GHJK_ENV: "ci"
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/typegate

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- ready_for_review

env:
GHJK_VERSION: "5bb0d24"
GHJK_VERSION: "fbd977d"
GHJK_ENV: "ci"
RUST_BACKTRACE: "full"
DENO_DIR: deno-dir
Expand Down Expand Up @@ -240,8 +240,6 @@ jobs:
# start the docker containers
ghjk x dev-compose base prisma
export NPM_CONFIG_REGISTRY=http://localhost:4873
WASM_OPT=1 ghjk x build-tgraph
ghjk x clean-deno-lock
Expand Down
2 changes: 1 addition & 1 deletion dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ RUN set -eux; \
; \
apt clean autoclean; apt autoremove --yes; rm -rf /var/lib/{apt,dpkg,cache,log}/;

ARG GHJK_VERSION=5bb0d24
ARG GHJK_VERSION=fbd977d
RUN GHJK_INSTALL_EXE_DIR=/usr/bin GHJK_INSTALL_HOOK_SHELLS=bash \
deno run -A https://raw.github.com/metatypedev/ghjk/$GHJK_VERSION/install.ts

Expand Down
2 changes: 1 addition & 1 deletion dev/cross.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN set -eux \
xz-utils \
unzip

ARG GHJK_VERSION=5bb0d24
ARG GHJK_VERSION=fbd977d
ENV GHJK_SHARE_DIR=/ghjk
RUN curl -fsSL https://raw.github.com/metatypedev/ghjk/$GHJK_VERSION/install.sh \
| GHJK_INSTALL_EXE_DIR=/usr/bin GHJK_INSTALL_HOOK_SHELLS=bash sh
Expand Down
8 changes: 4 additions & 4 deletions dev/deps.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright Metatype OÜ, licensed under the Elastic License 2.0.
// SPDX-License-Identifier: Elastic-2.0

export { file } from "https://raw.github.com/metatypedev/ghjk/5bb0d24/mod.ts";
export * from "https://raw.github.com/metatypedev/ghjk/5bb0d24/mod.ts";
export * as ports from "https://raw.github.com/metatypedev/ghjk/5bb0d24/ports/mod.ts";
export { file } from "https://raw.github.com/metatypedev/ghjk/fbd977d/mod.ts";
export * from "https://raw.github.com/metatypedev/ghjk/fbd977d/mod.ts";
export * as ports from "https://raw.github.com/metatypedev/ghjk/fbd977d/ports/mod.ts";
export {
std_url,
zod,
} from "https://raw.github.com/metatypedev/ghjk/5bb0d24/deps/common.ts";
} from "https://raw.github.com/metatypedev/ghjk/fbd977d/deps/common.ts";
// export * from "../../ghjk/mod.ts";
// export * as ports from "../../ghjk/ports/mod.ts";
// export * as utils from "../../ghjk/utils/mod.ts";
Expand Down
2 changes: 1 addition & 1 deletion dev/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export async function grepLock() {
$.logStep(`Updated ${relPath(pathStr)}`);
dirty = true;
} else {
$.logLight(`No change ${relPath(pathStr)}`);
// $.logLight(`No change ${relPath(pathStr)}`);
}
}),
);
Expand Down
2 changes: 1 addition & 1 deletion dev/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dev:
'(\s*"@typegraph\/sdk"\s*:\s*"npm:@typegraph\/sdk@).+(",?)': METATYPE_VERSION
'(\s*"@typegraph\/sdk\/"\s*:\s*"npm:/@typegraph\/sdk@).+(\/",?)': METATYPE_VERSION
lock:
GHJK_VERSION: 5bb0d24
GHJK_VERSION: fbd977d
GHJK_ACTION_VERSION: 318209a9d215f70716a4ac89dbeb9653a2deb8bc
RUST_VERSION: 1.77.1
DENO_VERSION: 1.43.6
Expand Down
4 changes: 1 addition & 3 deletions dev/tasks-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ const tasks: Record<string, DenoTaskDefArgs> = {
dependsOn: "build-tgraph-core",
inherit: ["build-tgraph-core", "_python"],
async fn($) {
await $.workingDir.join("typegraph/python/typegraph/gen").remove({
recursive: true,
});
await $.removeIfExists($.workingDir.join("typegraph/python/typegraph/gen"));
await $`poetry run python -m wasmtime.bindgen $WASM_FILE --out-dir typegraph/python/typegraph/gen`;
await $`poetry run ruff check typegraph/python/typegraph`;
},
Expand Down
25 changes: 16 additions & 9 deletions dev/tasks-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const tasks: Record<string, DenoTaskDefArgs> = {
if (/(Ubuntu|Debian)/.test(uname)) {
console.log(
`sudo apt update && ` +
`sudo apt install -y --no-install-recommends ` +
`gcc-multilib pkg-config libssl-dev libclang-dev perl make`,
`sudo apt install -y --no-install-recommends ` +
`gcc-multilib pkg-config libssl-dev libclang-dev perl make`,
);
} else {
$.logger.error("unable to determine platform");
Expand All @@ -26,19 +26,26 @@ const tasks: Record<string, DenoTaskDefArgs> = {
},

"install-py": {
inherit: ["_python"],
inherit: "_python",
async fn($) {
if (!await $.workingDir.join(".venv").exists()) {
await $`python3 -m venv .venv`;
await $.raw`${$.env.REAL_PYTHON_EXEC_PATH} -m venv .venv`;
$.logger.info("virtual env created");
}
await $`poetry install --sync --no-root`;
await $`poetry install --sync --no-root`.cwd("./typegraph/python");
console.log($.env);
await $`bash -s`.stdinText(
[
`. .venv/bin/activate`,
`poetry install --no-root`,
`cd typegraph/python`,
`poetry install --no-root`,
].join("\n")
)
},
},

"install-ts": {
inherit: ["_ecma"],
inherit: "_ecma",
fn: ($) =>
$`pnpm install --recursive
--filter ./examples/typegraphs/...
Expand All @@ -49,12 +56,12 @@ const tasks: Record<string, DenoTaskDefArgs> = {
},

"install-website": {
inherit: ["_ecma"],
inherit: "_ecma",
fn: ($) => $`pnpm install -C ./website/`,
},

"install-lsp": {
inherit: ["_ecma"],
inherit: "_ecma",
fn: ($) => $`pnpm install -C ./meta-lsp/ --frozen-lockfile --recursive`,
},

Expand Down
17 changes: 10 additions & 7 deletions dev/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ export async function testE2e(
await $.co(
args.files.map(
async (inPath) => {
const path = wd.resolve("typegate/tests", inPath);
let path = wd.resolve(inPath);
let stat = await path.stat();
if (!stat) {
stat = await wd.resolve(inPath).stat();
path = wd.resolve("typegate/tests", inPath)
stat = await path.stat();
if (!stat) {
throw new Error(`unable to resolve test files under "${inPath}"`);
}
Expand Down Expand Up @@ -93,6 +94,10 @@ export async function testE2e(
const filteredTestFiles = filtered?.map((res) => testFiles[res.refIndex]) ??
testFiles;

if (filteredTestFiles.length == 0) {
throw new Error("No tests found to run");
}

const tmpDir = wd.join("tmp");
const env: Record<string, string> = {
"CLICOLOR_FORCE": "1",
Expand Down Expand Up @@ -181,7 +186,7 @@ export async function testE2e(
$.logStep(`${prefix} Building xtask and meta-cli...`);
await $`cargo build -p xtask -p meta-cli`.cwd(wd);

// launch a task
// launch a promise that doesnt get awaited
(async () => {
while (queues.length > 0) {
const current = Object
Expand Down Expand Up @@ -227,15 +232,13 @@ export async function testE2e(

$.log();
$.log(
`Tests completed in ${Math.floor(globalDuration / 60_000)}m${
Math.floor(globalDuration / 1_000) % 60
`Tests completed in ${Math.floor(globalDuration / 60_000)}m${Math.floor(globalDuration / 1_000) % 60
}s:`,
);

for (const run of finished.sort((a, b) => a.duration - b.duration)) {
$.log(
` - ${Math.floor(run.duration / 60_000)}m${
Math.floor(run.duration / 1_000) % 60
` - ${Math.floor(run.duration / 60_000)}m${Math.floor(run.duration / 1_000) % 60
}s -- ${run.success ? "" : "FAILED -"}${relPath(run.testFile)}`,
);
}
Expand Down
3 changes: 2 additions & 1 deletion ghjk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ if (Deno.build.os == "linux" && !Deno.env.has("NO_MOLD")) {
.install(
ports.mold({
version: "v2.4.0",
replaceLd: Deno.env.has("CI") || Deno.env.has("OCI"),
// NOTE: mold replaces ld on linux
replaceLd: true,
}),
);
}
Expand Down
12 changes: 3 additions & 9 deletions libs/xtask/src/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Test {
allow_run: Some(
[
"cargo", "hostname", "meta", "git", "python3", "rm", "mkdir", "bash", "npm",
"pnpm", "setsid", "temporal", "deno",
"pnpm", "setsid", "temporal", "deno", "poetry",
]
.into_iter()
.map(str::to_owned)
Expand Down Expand Up @@ -116,14 +116,8 @@ impl Bench {
let permissions = mt_deno::deno::deno_runtime::permissions::PermissionsOptions {
allow_run: Some(
[
"cargo",
"hostname",
"target/debug/meta",
"git",
"python3",
"rm",
"mkdir",
"bash",
"cargo", "hostname", "meta", "git", "python3", "rm", "mkdir", "bash", "npm",
"pnpm", "setsid", "temporal", "deno", "poetry",
]
.into_iter()
.map(str::to_owned)
Expand Down
9 changes: 8 additions & 1 deletion typegate/deno.lock

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

2 changes: 2 additions & 0 deletions typegate/tests/e2e/website/website_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ async function testSerializeAllPairs(t: MetaTest, dirPath: string) {

const [{ stdout: pyVersion }, { stdout: tsVersion }] = await Promise.all([
Meta.cli(
{ env: { RUST_LOG: "trace" } },
"serialize",
"--pretty",
"-f",
pyPath,
),
Meta.cli(
{ env: { RUST_LOG: "trace" } },
"serialize",
"--pretty",
"-f",
Expand Down
Loading

0 comments on commit 28637dc

Please sign in to comment.