diff --git a/packages/sqlx_cli/brioche.lock b/packages/sqlx_cli/brioche.lock new file mode 100644 index 00000000..ee1313d9 --- /dev/null +++ b/packages/sqlx_cli/brioche.lock @@ -0,0 +1,8 @@ +{ + "dependencies": {}, + "git_refs": { + "https://github.com/launchbadge/sqlx": { + "v0.8.6": "bab1b022bd56a64f9a08b46b36b97c5cff19d77e" + } + } +} diff --git a/packages/sqlx_cli/project.bri b/packages/sqlx_cli/project.bri new file mode 100644 index 00000000..d67a45ef --- /dev/null +++ b/packages/sqlx_cli/project.bri @@ -0,0 +1,67 @@ +import * as std from "std"; +import { cargoBuild } from "rust"; +import nushell from "nushell"; +import openssl from "openssl"; + +export const project = { + name: "sqlx_cli", + version: "0.8.6", + repository: "https://github.com/launchbadge/sqlx", +}; + +const source = Brioche.gitCheckout({ + repository: project.repository, + ref: `v${project.version}`, +}); + +export default function sqlxCli(): std.Recipe { + return cargoBuild({ + source, + dependencies: [openssl], + path: "sqlx-cli", + runnable: "bin/sqlx", + }); +} + +export async function test(): Promise> { + const script = std.runBash` + sqlx --version | tee "$BRIOCHE_OUTPUT" + ` + .dependencies(sqlxCli) + .toFile(); + + const result = (await script.read()).trim(); + + // Check that the result contains the expected version + const expected = `sqlx-cli ${project.version}`; + std.assert(result === expected, `expected '${expected}', got '${result}'`); + + return script; +} + +export function liveUpdate(): std.WithRunnable { + const src = std.file(std.indoc` + let version = http get https://api.github.com/repos/launchbadge/sqlx/git/matching-refs/tags + | get ref + | each {|ref| + $ref + | parse --regex '^refs/tags/(?Pv(?P[\\d]+)\\.(?P[\\d]+)\\.(?P[\\d]+)(?P