Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions packages/sqlx_cli/brioche.lock

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

67 changes: 67 additions & 0 deletions packages/sqlx_cli/project.bri
Original file line number Diff line number Diff line change
@@ -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<std.Directory> {
return cargoBuild({
source,
dependencies: [openssl],
path: "sqlx-cli",
runnable: "bin/sqlx",
});
}

export async function test(): Promise<std.Recipe<std.File>> {
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/(?P<tag>v(?P<major>[\\d]+)\\.(?P<minor>[\\d]+)\\.(?P<patch>[\\d]+)(?P<label>-.+)?)'
| get -i 0
}
| sort-by -n major minor patch
| last
| get tag

$env.project
| from json
| update version $version
| to json
`);

return std.withRunnable(std.directory(), {
command: "nu",
args: [src],
env: { project: JSON.stringify(project) },
dependencies: [nushell],
});
}