Skip to content

Commit

Permalink
om ci: Include systems (and flake) in result JSON
Browse files Browse the repository at this point in the history
This breaks backwards compatibility.
  • Loading branch information
srid committed Nov 4, 2024
1 parent efeb067 commit 68db254
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
# Retrieve the store path for the given package out of the given subflake.
get_output() {
subflake=$1 name=$2 \
jq -r '.[$ENV.subflake].build.byName.[$ENV.name]' < $HOME/omci.json
jq -r '.result.[$ENV.subflake].build.byName.[$ENV.name]' < $HOME/omci.json
}
echo "OMCIJSON_PATH=$HOME/omci.json" >> "$GITHUB_OUTPUT"
Expand Down
20 changes: 18 additions & 2 deletions crates/omnix-ci/src/command/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use nix_rs::{
};
use omnix_common::config::OmConfig;
use omnix_health::{traits::Checkable, NixHealth};
use serde::Serialize;

use crate::{config::subflakes::SubflakesConfig, flake_ref::FlakeRef, step::core::StepsResult};

Expand Down Expand Up @@ -170,7 +171,7 @@ pub async fn ci_run(
run_cmd: &RunCommand,
cfg: &OmConfig<SubflakesConfig>,
nix_config: &NixConfig,
) -> anyhow::Result<HashMap<String, StepsResult>> {
) -> anyhow::Result<RunResult> {
let mut res = HashMap::new();
let systems = run_cmd.get_systems(cmd, nix_config).await?;

Expand Down Expand Up @@ -208,5 +209,20 @@ pub async fn ci_run(

tracing::info!("\n🥳 Success!");

Ok(res)
Ok(RunResult {
systems,
flake: cfg.flake_url.clone(),
result: res,
})
}

/// Results of the 'ci run' command
#[derive(Debug, Serialize, Clone)]
pub struct RunResult {
/// The systems we are building for
systems: Vec<System>,
/// The flake being built
flake: FlakeUrl,
/// CI result for each subflake
result: HashMap<String, StepsResult>,
}

0 comments on commit 68db254

Please sign in to comment.