ci: use libsqld server in CI instead of Turso CLI
This commit is contained in:
@@ -1,6 +1,29 @@
|
||||
import yargs from "yargs";
|
||||
import { $ } from "zx";
|
||||
|
||||
const tursoProcess = $`turso dev --port 3000`.nothrow();
|
||||
const args = await yargs(process.argv).option("dbCommand", {
|
||||
alias: "db",
|
||||
type: "string",
|
||||
description: "Command to spin up the database",
|
||||
demandOption: true,
|
||||
}).argv;
|
||||
|
||||
const filteredKeys = new Set(["_", "dbCommand", "db", "$0", "db-command"]);
|
||||
const positionalArgs = Object.entries(args)
|
||||
.filter(([key]) => !filteredKeys.has(key))
|
||||
.map(([key, value]) => {
|
||||
if (typeof value === "boolean") {
|
||||
return `--${key}`;
|
||||
}
|
||||
|
||||
return `--${key}=${value}`;
|
||||
})
|
||||
.concat(args._.slice(2).map((arg) => `${arg}`));
|
||||
|
||||
const dbProcess = $({
|
||||
quote: (arg) => arg,
|
||||
verbose: true,
|
||||
})`${args.dbCommand}`.nothrow();
|
||||
|
||||
process.env.TURSO_URL = "http://127.0.0.1:3000";
|
||||
process.env.TURSO_AUTH_TOKEN = "asd";
|
||||
@@ -8,6 +31,6 @@ await $`bun db:migrate`.nothrow();
|
||||
await $({
|
||||
verbose: true,
|
||||
quote: (arg) => arg,
|
||||
})`FORCE_COLOR=1 bun test ${process.argv.slice(2).join(" ")}`.nothrow();
|
||||
})`FORCE_COLOR=1 bun test ${positionalArgs.join(" ")}`.nothrow();
|
||||
|
||||
await tursoProcess.kill("SIGINT");
|
||||
await dbProcess.kill("SIGINT");
|
||||
|
||||
Reference in New Issue
Block a user