Skip to content

Commit

Permalink
respect whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Mar 25, 2024
1 parent 0bb4df4 commit 24ae0a3
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/github/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use itertools::iproduct;
use nix_rs::flake::system::System;
use serde::{Deserialize, Serialize};

use crate::config::Config;
use crate::config::{Config, SubFlakish};

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct GitHubMatrixRow {
Expand All @@ -29,9 +29,25 @@ pub(crate) async fn dump_github_actions_matrix(
cfg: &Config,
systems: Vec<System>,
) -> anyhow::Result<()> {
// TODO: Should take into account systems whitelist
// Ref: https://github.com/srid/nixci/blob/efc77c8794e5972617874edd96afa8dd4f1a75b2/src/config.rs#L104-L105
let matrix = GitHubMatrix::new(systems, cfg.subflakes.0.keys().cloned().collect());
let include = iproduct!(
systems,
cfg.subflakes
.0
.iter()
.collect::<Vec<(&String, &SubFlakish)>>()
)
.flat_map(|(system, (k, v))| {
if v.can_build_on(&vec![system.clone()]) {
Some(GitHubMatrixRow {
system,
subflake: k.to_string(),
})
} else {
None
}
})
.collect();
let matrix = GitHubMatrix { include };
println!("{}", serde_json::to_string(&matrix)?);
Ok(())
}

0 comments on commit 24ae0a3

Please sign in to comment.