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 * use log *
# cd to git root
cd (git rev-parse --show-toplevel) 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 # map from nixos system to github runner type
let systems_map = { let systems_map = {
# aarch64-darwin # aarch64-darwin
@@ -14,13 +37,8 @@ let systems_map = {
x86_64-linux: ubuntu-latest x86_64-linux: ubuntu-latest
} }
let targets = (nix eval --json ".#packages" --apply builtins.attrNames let targets = (get-attr-names ".#packages"
| from json | par-each {|system| { $system : (get-attr-names $".#packages.($system)") } }
| par-each {|system| {
$system : (
nix eval --json $".#packages.($system)" --apply builtins.attrNames | from json
)
} }
| reduce {|it, acc| $acc | merge $it } | reduce {|it, acc| $acc | merge $it }
) )
@@ -81,34 +99,24 @@ for system in ($targets | columns) {
continue continue
} }
# skip the default derivation, its an alias of the rosenpass derivation
if ($derivation == "default") {
continue
}
# job_id for GH-Actions # job_id for GH-Actions
let id = $"($system)---($derivation)" let id = ( job-id $system $derivation )
# name displayed # name displayed
let name = $"($system).($derivation)" let name = $"($system).($derivation)"
# collection of dependencies # collection of dependencies
mut needs = [] # TODO currently only considers dependencies on the same $system
let needs = ($derivations
if ($derivation | str ends-with "oci-image") { | filter {|it| $it != $derivation and $it != "default" } # filter out self and default
$needs = ($needs | append ( $derivation | str replace '(.+)-oci-image' "$1" )) | par-each {|it| {
} name: $it, # the other derivation
# does self depend on $it?
if ($derivation == "proof-proverif") { needed: (depends $".#packages.($system).($derivation)" $".#packages.($system).($it)")
$needs = ($needs | append "proverif-patched") } }
} | filter {|it| $it.needed}
| each {|it| job-id $system $it.name}
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)"})
mut new_job = { mut new_job = {
name: $"Build ($name)", name: $"Build ($name)",

View File

@@ -7,6 +7,23 @@ on:
branches: branches:
- main - main
jobs: jobs:
i686-linux---default:
name: Build i686-linux.default
runs-on:
- ubuntu-latest
needs:
- i686-linux---rosenpass
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: rosenpass
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build
run: nix build .#packages.i686-linux.default --print-build-logs
i686-linux---rosenpass: i686-linux---rosenpass:
name: Build i686-linux.rosenpass name: Build i686-linux.rosenpass
runs-on: runs-on:
@@ -55,6 +72,23 @@ jobs:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Check - name: Check
run: nix flake check . --print-build-logs run: nix flake check . --print-build-logs
x86_64-darwin---default:
name: Build x86_64-darwin.default
runs-on:
- macos-latest
needs:
- x86_64-darwin---rosenpass
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: rosenpass
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build
run: nix build .#packages.x86_64-darwin.default --print-build-logs
x86_64-darwin---release-package: x86_64-darwin---release-package:
name: Build x86_64-darwin.release-package name: Build x86_64-darwin.release-package
runs-on: runs-on:
@@ -121,6 +155,23 @@ jobs:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Check - name: Check
run: nix flake check . --print-build-logs run: nix flake check . --print-build-logs
x86_64-linux---default:
name: Build x86_64-linux.default
runs-on:
- ubuntu-latest
needs:
- x86_64-linux---rosenpass
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: rosenpass
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build
run: nix build .#packages.x86_64-linux.default --print-build-logs
x86_64-linux---proof-proverif: x86_64-linux---proof-proverif:
name: Build x86_64-linux.proof-proverif name: Build x86_64-linux.proof-proverif
runs-on: runs-on:
@@ -159,8 +210,6 @@ jobs:
runs-on: runs-on:
- ubuntu-latest - ubuntu-latest
needs: needs:
- x86_64-linux---rosenpass
- x86_64-linux---rosenpass-oci-image
- x86_64-linux---rosenpass-static - x86_64-linux---rosenpass-static
- x86_64-linux---rosenpass-static-oci-image - x86_64-linux---rosenpass-static-oci-image
steps: steps: