refine CI further

- include default jobs
- clean up generator script
- fix wrong dependency estimation for release-package
This commit is contained in:
wucke13
2023-06-14 19:11:00 +02:00
parent 4314a0915a
commit be508b486a
2 changed files with 88 additions and 31 deletions

View File

@@ -2,8 +2,31 @@
use log *
# cd to git root
cd (git rev-parse --show-toplevel)
# check if a subject depends on a potential dependency
def depends [
subject:string # package to examine
maybe_dep:string # maybe a dependency of subject
] {
not ( nix why-depends --quiet --derivation $subject $maybe_dep | is-empty )
}
# get attribute names of the attribute set
def get-attr-names [
expr: # nix expression to get attrNames of
] {
nix eval --json $expr --apply builtins.attrNames | from json
}
def job-id [
system:string,
derivation:string,
] {
$"($system)---($derivation)"
}
# map from nixos system to github runner type
let systems_map = {
# aarch64-darwin
@@ -14,13 +37,8 @@ let systems_map = {
x86_64-linux: ubuntu-latest
}
let targets = (nix eval --json ".#packages" --apply builtins.attrNames
| from json
| par-each {|system| {
$system : (
nix eval --json $".#packages.($system)" --apply builtins.attrNames | from json
)
} }
let targets = (get-attr-names ".#packages"
| par-each {|system| { $system : (get-attr-names $".#packages.($system)") } }
| reduce {|it, acc| $acc | merge $it }
)
@@ -81,34 +99,24 @@ for system in ($targets | columns) {
continue
}
# skip the default derivation, its an alias of the rosenpass derivation
if ($derivation == "default") {
continue
}
# job_id for GH-Actions
let id = $"($system)---($derivation)"
let id = ( job-id $system $derivation )
# name displayed
let name = $"($system).($derivation)"
# collection of dependencies
mut needs = []
if ($derivation | str ends-with "oci-image") {
$needs = ($needs | append ( $derivation | str replace '(.+)-oci-image' "$1" ))
}
if ($derivation == "proof-proverif") {
$needs = ($needs | append "proverif-patched")
}
if ($derivation == "release-package") {
$needs = ($needs | append ($derivations | find "rosenpass"))
}
# prefix all needs with the system to get a full job_id
$needs = ($needs | each {|drv| $"($system)---($drv)"})
# TODO currently only considers dependencies on the same $system
let needs = ($derivations
| filter {|it| $it != $derivation and $it != "default" } # filter out self and default
| par-each {|it| {
name: $it, # the other derivation
# does self depend on $it?
needed: (depends $".#packages.($system).($derivation)" $".#packages.($system).($it)")
} }
| filter {|it| $it.needed}
| each {|it| job-id $system $it.name}
)
mut new_job = {
name: $"Build ($name)",