Compare commits
2
Commits
v0.1.2
...
ci-log-steps
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8230de065f | ||
|
|
d0833ad563 |
No files matched your search
@@ -36,10 +36,10 @@ steps:
|
||||
commands:
|
||||
- git remote set-url origin "https://wvhulle:$${CODEBERG_TOKEN}@codeberg.org/$${CI_REPO}.git"
|
||||
- git checkout -B main "$${CI_COMMIT_SHA}"
|
||||
- nix run .#release-plz-release
|
||||
- nix run --quiet .#release-plz-release
|
||||
|
||||
- name: update-release-pr
|
||||
image: nixos/nix:latest
|
||||
environment: *release_env
|
||||
commands:
|
||||
- nix run .#release-plz-release-pr
|
||||
- nix run --quiet .#release-plz-release-pr
|
||||
@@ -8,74 +8,69 @@ variables:
|
||||
experimental-features = nix-command flakes
|
||||
build-users-group =
|
||||
accept-flake-config = true
|
||||
- &cache_writing_env
|
||||
<<: *nix_config
|
||||
CACHIX_AUTH_TOKEN:
|
||||
from_secret: cachix_auth_token
|
||||
- &on_main_branch
|
||||
- event: [push, manual]
|
||||
branch: main
|
||||
- &off_main_branch
|
||||
- event: pull_request
|
||||
- event: [push, manual]
|
||||
branch:
|
||||
exclude: main
|
||||
- &on_pull_requests
|
||||
- event: pull_request
|
||||
|
||||
steps:
|
||||
- name: build-test-and-cache-bootvine
|
||||
- name: build-workspace-dependencies
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *on_main_branch
|
||||
environment: *cache_writing_env
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix run .#build-and-push-to-cachix -- .#checks.x86_64-linux.bootvine-build
|
||||
- nix run --quiet .#build-unless-cached -- .#packages.x86_64-linux.workspace-dependencies
|
||||
|
||||
- name: build-and-test-bootvine
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *off_main_branch
|
||||
depends_on: [build-workspace-dependencies]
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.bootvine-build
|
||||
|
||||
- name: build-and-cache-repo-tasks
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *on_main_branch
|
||||
environment: *cache_writing_env
|
||||
commands:
|
||||
- nix run .#build-and-push-to-cachix -- .#checks.x86_64-linux.repo-tasks-build
|
||||
- nix run --quiet .#import-exported-paths
|
||||
- nix run --quiet .#build-and-export-paths -- .#checks.x86_64-linux.bootvine-build
|
||||
|
||||
- name: build-repo-tasks
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *off_main_branch
|
||||
depends_on: [build-workspace-dependencies]
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.repo-tasks-build
|
||||
- nix run --quiet .#import-exported-paths
|
||||
- nix run --quiet .#build-and-export-paths -- .#checks.x86_64-linux.repo-tasks-build
|
||||
|
||||
- name: upload-build-cache
|
||||
image: nixos/nix:latest
|
||||
depends_on: [build-and-test-bootvine, build-repo-tasks]
|
||||
when:
|
||||
- event: [push, manual]
|
||||
branch: main
|
||||
status: [success, failure]
|
||||
environment:
|
||||
<<: *nix_config
|
||||
CACHIX_AUTH_TOKEN:
|
||||
from_secret: cachix_auth_token
|
||||
commands:
|
||||
- nix run --quiet .#upload-exported-paths
|
||||
|
||||
- name: lint-rust-with-clippy
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
depends_on: [build-workspace-dependencies]
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.clippy-lints
|
||||
- nix run --quiet .#import-exported-paths
|
||||
- nix build --quiet --print-build-logs .#checks.x86_64-linux.clippy-lints
|
||||
|
||||
- name: check-rust-formatting
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
depends_on: [build-workspace-dependencies]
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.rustfmt-formatting
|
||||
- nix run --quiet .#import-exported-paths
|
||||
- nix build --quiet --print-build-logs .#checks.x86_64-linux.rustfmt-formatting
|
||||
|
||||
- name: evaluate-flake-outputs
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix flake check --no-build
|
||||
- nix flake check --quiet --no-build
|
||||
|
||||
- name: check-conventional-commit-messages
|
||||
image: nixos/nix:latest
|
||||
@@ -84,4 +79,4 @@ steps:
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- git fetch --quiet origin "$${CI_COMMIT_TARGET_BRANCH}"
|
||||
- nix run .#check-conventional-commits -- FETCH_HEAD..HEAD
|
||||
- nix run --quiet .#check-conventional-commits -- FETCH_HEAD..HEAD
|
||||
@@ -194,7 +194,7 @@ impl BootState {
|
||||
};
|
||||
let outcome = match result {
|
||||
JobResult::Done => Outcome::Succeeded { at },
|
||||
JobResult::Skipped | JobResult::Canceled => Outcome::Abandoned,
|
||||
JobResult::Skipped | JobResult::Canceled | JobResult::Collected => Outcome::Abandoned,
|
||||
JobResult::Failed => Outcome::Failed(FailureKind::Broke),
|
||||
JobResult::Timeout => Outcome::Failed(FailureKind::TimedOut),
|
||||
JobResult::Dependency => Outcome::Failed(FailureKind::DependencyFailed),
|
||||
@@ -337,6 +337,20 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_collected_job_on_a_multi_device_mount_source_is_not_a_failure() {
|
||||
let mut state = BootState::new(Phase::Initrd);
|
||||
queue_unit(
|
||||
&mut state,
|
||||
1,
|
||||
waiting("dev-nvme0n1p1:-dev-nvme1n1p3.device", &[]),
|
||||
500 * MS,
|
||||
);
|
||||
state.finish_job(1, JobResult::Collected, 2000 * MS);
|
||||
assert!(state.failed.is_empty());
|
||||
assert_eq!(state.tally().failed, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_unit_entering_the_failed_state_counts_without_a_failed_job() {
|
||||
let mut state = sample();
|
||||
|
||||
@@ -20,6 +20,7 @@ pub enum JobResult {
|
||||
Done,
|
||||
Skipped,
|
||||
Canceled,
|
||||
Collected,
|
||||
Timeout,
|
||||
Dependency,
|
||||
#[serde(other)]
|
||||
@@ -162,6 +163,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(from_str("maintenance").ok(), Some(ActiveState::Inactive));
|
||||
assert_eq!(from_str("dependency").ok(), Some(JobResult::Dependency));
|
||||
assert_eq!(from_str("collected").ok(), Some(JobResult::Collected));
|
||||
assert_eq!(from_str("frozen").ok(), Some(JobResult::Failed));
|
||||
assert_eq!(from_str("stop").ok(), Some(JobKind::TakesDown));
|
||||
assert_eq!(from_str("restart").ok(), Some(JobKind::BringsUp));
|
||||
|
||||
@@ -60,7 +60,12 @@
|
||||
{ pkgs, builds, ... }:
|
||||
{
|
||||
default = builds.bootvine;
|
||||
inherit (builds) bootvine scripted-demos repo-tasks;
|
||||
inherit (builds)
|
||||
bootvine
|
||||
scripted-demos
|
||||
repo-tasks
|
||||
workspace-dependencies
|
||||
;
|
||||
sample-unit-files = pkgs.callPackage ./vm-tests/slow-services/sample-unit-files.nix {
|
||||
inherit (vmTests) sampleUnits;
|
||||
};
|
||||
@@ -101,6 +106,39 @@
|
||||
}
|
||||
) vmTests.machineDescriptions;
|
||||
|
||||
exportBuiltPathsHook = pkgs.writeShellApplication {
|
||||
name = "export-built-paths-hook";
|
||||
text = ''
|
||||
exported_paths_dir="$CI_WORKSPACE/.nix-built-paths"
|
||||
mkdir -p "$exported_paths_dir"
|
||||
read -ra built_paths <<< "$OUT_PATHS"
|
||||
nix copy --quiet --to "file://$exported_paths_dir?compression=zstd" "''${built_paths[@]}"
|
||||
printf '%s\n' "''${built_paths[@]}" >> "$exported_paths_dir/paths.txt"
|
||||
'';
|
||||
};
|
||||
|
||||
buildAndExportPaths = pkgs.writeShellApplication {
|
||||
name = "build-and-export-paths";
|
||||
text = ''
|
||||
export NIX_CONFIG="''${NIX_CONFIG:-}
|
||||
post-build-hook = ${lib.getExe exportBuiltPathsHook}"
|
||||
nix build --quiet --print-build-logs "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
importExportedPaths = pkgs.writeShellApplication {
|
||||
name = "import-exported-paths";
|
||||
text = ''
|
||||
exported_paths_dir="$CI_WORKSPACE/.nix-built-paths"
|
||||
if [[ ! -s "$exported_paths_dir/paths.txt" ]]; then
|
||||
echo "No exported paths to import"
|
||||
exit 0
|
||||
fi
|
||||
mapfile -t built_paths < "$exported_paths_dir/paths.txt"
|
||||
nix copy --quiet --no-check-sigs --from "file://$exported_paths_dir" "''${built_paths[@]}"
|
||||
'';
|
||||
};
|
||||
|
||||
releasePlzOnCodeberg =
|
||||
subcommand: description:
|
||||
shellScriptApp "release-plz-${subcommand}" description {
|
||||
@@ -150,12 +188,47 @@
|
||||
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"
|
||||
build-and-export-paths = {
|
||||
type = "app";
|
||||
meta.description = "Build flake outputs and export newly built paths to the CI workspace";
|
||||
program = lib.getExe buildAndExportPaths;
|
||||
};
|
||||
|
||||
build-unless-cached =
|
||||
shellScriptApp "build-unless-cached"
|
||||
"Build a flake output and export it to the CI workspace unless it is already in Cachix"
|
||||
{
|
||||
text = ''
|
||||
built_output=$(nix eval --quiet --raw "$1.outPath")
|
||||
if nix path-info --quiet --store https://wvhulle.cachix.org "$built_output" > /dev/null 2>&1; then
|
||||
echo "$built_output is already in Cachix"
|
||||
exit 0
|
||||
fi
|
||||
${lib.getExe buildAndExportPaths} "$1"
|
||||
'';
|
||||
};
|
||||
|
||||
import-exported-paths = {
|
||||
type = "app";
|
||||
meta.description = "Import paths exported to the CI workspace by an earlier step";
|
||||
program = lib.getExe importExportedPaths;
|
||||
};
|
||||
|
||||
upload-exported-paths =
|
||||
shellScriptApp "upload-exported-paths"
|
||||
"Push paths exported to the CI workspace to the wvhulle Cachix cache"
|
||||
{
|
||||
runtimeInputs = [ pkgs.cachix ];
|
||||
text = ''exec cachix watch-exec wvhulle -- nix build --print-build-logs "$@"'';
|
||||
text = ''
|
||||
exported_paths_dir="$CI_WORKSPACE/.nix-built-paths"
|
||||
if [[ ! -s "$exported_paths_dir/paths.txt" ]]; then
|
||||
echo "No newly built paths to upload"
|
||||
exit 0
|
||||
fi
|
||||
${lib.getExe importExportedPaths}
|
||||
mapfile -t built_paths < "$exported_paths_dir/paths.txt"
|
||||
cachix push wvhulle "''${built_paths[@]}"
|
||||
'';
|
||||
};
|
||||
|
||||
check-conventional-commits =
|
||||
|
||||
@@ -30,6 +30,8 @@ let
|
||||
args: craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; } // args);
|
||||
in
|
||||
{
|
||||
workspace-dependencies = cargoArtifacts;
|
||||
|
||||
rustfmt-formatting = craneLib.cargoFmt {
|
||||
inherit (commonArgs) src pname version;
|
||||
cargoExtraArgs = "--all";
|
||||
|
||||
Reference in new issue
Block a user