ci: move CI tasks into Nushell scripts and update dependencies weekly
Replace the shell scripts in flake.nix with Nushell scripts in ci/, exposed as flake apps in nix/ci-tasks.nix, so every workflow command is a plain nix call. Build the workspace dependencies in a step of their own, upload to Cachix only after the builds, and run the formatting check through the pre-commit hooks. Automated pushes, tags and pull requests now use the wvhulle-bot account. A weekly cron updates Cargo.lock and flake.lock and opens or updates one pull request from bot/dependency-updates. Claude-Session: https://claude.ai/code/session_01D8dLLgYd8cfR2aQfA5eZXa
This commit is contained in:
11 files changed
+519
-173
No files matched your search
@@ -61,6 +61,7 @@
|
||||
{
|
||||
default = builds.bootvine;
|
||||
inherit (builds) bootvine scripted-demos repo-tasks;
|
||||
workspace-dependencies = builds.cargoArtifacts;
|
||||
sample-unit-files = pkgs.callPackage ./vm-tests/slow-services/sample-unit-files.nix {
|
||||
inherit (vmTests) sampleUnits;
|
||||
};
|
||||
@@ -86,12 +87,29 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellScriptApp = name: description: scriptArgs: {
|
||||
mkApp = drv: {
|
||||
type = "app";
|
||||
meta.description = description;
|
||||
program = lib.getExe (pkgs.writeShellApplication ({ inherit name; } // scriptArgs));
|
||||
program = lib.getExe drv;
|
||||
};
|
||||
|
||||
repoTaskApp =
|
||||
name: description: xtaskArguments: runtimeInputs:
|
||||
mkApp (
|
||||
pkgs.runCommand name
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
|
||||
meta.mainProgram = name;
|
||||
}
|
||||
''
|
||||
makeWrapper ${lib.getExe builds.repo-tasks} $out/bin/${name} \
|
||||
--add-flags ${lib.escapeShellArg xtaskArguments} \
|
||||
--prefix PATH : ${lib.makeBinPath runtimeInputs}
|
||||
''
|
||||
)
|
||||
// {
|
||||
meta.description = description;
|
||||
};
|
||||
|
||||
sampleMachineApps = lib.mapAttrs' (
|
||||
machineName: machineDescription:
|
||||
lib.nameValuePair "sample-vm-${machineName}" {
|
||||
@@ -101,80 +119,50 @@
|
||||
}
|
||||
) vmTests.machineDescriptions;
|
||||
|
||||
releasePlzOnCodeberg =
|
||||
subcommand: description:
|
||||
shellScriptApp "release-plz-${subcommand}" description {
|
||||
runtimeInputs = [
|
||||
pkgs.release-plz
|
||||
pkgs.gitMinimal
|
||||
pkgs.pkg-config
|
||||
pkgs.stdenv.cc
|
||||
rustToolchain
|
||||
];
|
||||
runtimeEnv.PKG_CONFIG_PATH =
|
||||
lib.makeSearchPathOutput "dev" "lib/pkgconfig"
|
||||
builds.bootvine.buildInputs;
|
||||
text = ''exec release-plz ${subcommand} --forge gitea --git-token "$CODEBERG_TOKEN"'';
|
||||
};
|
||||
ciTaskApps = import ./nix/ci-tasks.nix {
|
||||
inherit pkgs mkApp;
|
||||
cargoToolchain = rustToolchain;
|
||||
preCommitInputs = [ rustToolchain ];
|
||||
extraReleaseInputs = [
|
||||
pkgs.pkg-config
|
||||
pkgs.stdenv.cc
|
||||
];
|
||||
releaseWrapperArgs = [
|
||||
"--set"
|
||||
"PKG_CONFIG_PATH"
|
||||
(lib.makeSearchPathOutput "dev" "lib/pkgconfig" builds.bootvine.buildInputs)
|
||||
];
|
||||
};
|
||||
in
|
||||
sampleMachineApps
|
||||
// ciTaskApps
|
||||
// {
|
||||
release-plz-release = releasePlzOnCodeberg "release" "Publish unpublished versions to crates.io and tag them with a Codeberg release";
|
||||
release-plz-release-pr = releasePlzOnCodeberg "release-pr" "Open or update the Codeberg pull request that bumps the version and changelog";
|
||||
|
||||
record-screencasts =
|
||||
shellScriptApp "record-screencasts"
|
||||
repoTaskApp "record-screencasts"
|
||||
"Re-record the scripted demo animations and the sample machine recordings into recordings/; publish them with publish-recordings"
|
||||
{
|
||||
runtimeInputs = [
|
||||
pkgs.vhs
|
||||
pkgs.libwebp
|
||||
builds.scripted-demos
|
||||
builds.repo-tasks
|
||||
];
|
||||
text = "exec xtask record-screencasts --vm-check-outputs ${
|
||||
pkgs.linkFarm "vm-check-outputs" (
|
||||
lib.mapAttrs (machineName: _: self.checks.${system}."vm-${machineName}") vmTests.machines
|
||||
)
|
||||
}";
|
||||
};
|
||||
"record-screencasts --vm-check-outputs ${
|
||||
pkgs.linkFarm "vm-check-outputs" (
|
||||
lib.mapAttrs (machineName: _: self.checks.${system}."vm-${machineName}") vmTests.machines
|
||||
)
|
||||
}"
|
||||
[
|
||||
pkgs.vhs
|
||||
pkgs.libwebp
|
||||
builds.scripted-demos
|
||||
];
|
||||
|
||||
publish-recordings =
|
||||
shellScriptApp "publish-recordings"
|
||||
repoTaskApp "publish-recordings"
|
||||
"Replace the recordings branch on origin with a single commit holding recordings/"
|
||||
{
|
||||
runtimeInputs = [
|
||||
pkgs.gitMinimal
|
||||
builds.repo-tasks
|
||||
];
|
||||
text = "exec xtask publish-recordings";
|
||||
};
|
||||
|
||||
build-and-push-to-cachix =
|
||||
shellScriptApp "build-and-push-to-cachix"
|
||||
"Build flake outputs and push everything built to the wvhulle Cachix cache"
|
||||
{
|
||||
runtimeInputs = [ pkgs.cachix ];
|
||||
text = ''exec cachix watch-exec wvhulle -- nix build --print-build-logs "$@"'';
|
||||
};
|
||||
|
||||
check-conventional-commits =
|
||||
shellScriptApp "check-conventional-commits"
|
||||
"Check that the commit messages in a git revision range are conventional commits"
|
||||
{
|
||||
runtimeInputs = [
|
||||
pkgs.convco
|
||||
pkgs.gitMinimal
|
||||
];
|
||||
text = ''exec convco check "$@"'';
|
||||
};
|
||||
"publish-recordings"
|
||||
[ pkgs.gitMinimal ];
|
||||
}
|
||||
);
|
||||
|
||||
checks = forEachSystem (
|
||||
{ pkgs, builds, ... }:
|
||||
{
|
||||
inherit (builds) rustfmt-formatting clippy-lints;
|
||||
inherit (builds) clippy-lints;
|
||||
bootvine-build = builds.bootvine;
|
||||
repo-tasks-build = builds.repo-tasks;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user