fix(action): re-enable extra logs

Some logs where hidden, we can now put them into groups instead (and
figure out why this is failing T-T.
This commit is contained in:
Jalil David Salamé Messina 2024-12-18 23:34:30 +01:00
parent fd5476dc11
commit bff5365c60
Signed by: jalil
GPG key ID: F016B9E770737A0B

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
set -eu
@ -7,32 +7,36 @@ util_path="${GITHUB_ACTION_PATH-.}/utils.sh"
# shellcheck source=utils.sh
. "${util_path}"
log 'Retrieving Flake information'
flake_info=$(nix flake show --json 2>/dev/null)
group 'Retrieving Flake information'
flake_info=$(nix flake show --json)
endgroup
group 'Show Packages'
packages=$(
jq --raw-output '.packages."x86_64-linux" | select(. != null) | keys[]' <<-EOF
$flake_info
EOF
)
group 'Show Packages'
log "$packages"
endgroup
group 'Show NixOS Configurations'
configurations=$(
jq --raw-output '.nixosConfigurations | select(. != null) | keys[]' <<-EOF
$flake_info
EOF
)
group 'Show NixOS Configurations'
log "$configurations"
endgroup
pkgs_json() {
group 'Building packages'
trap endgroup RETURN
for package in $packages; do
log "Building $package"
path=$(nix build --print-out-paths ".#$package" 2>/dev/null)
path=$(nix build --print-out-paths ".#$package")
log "Calculating size of $package"
nix path-info --closure-size --json "$path" 2>/dev/null |
nix path-info --closure-size --json "$path" |
jq --compact-output --arg pkg "$package" '.[] | {"name": $pkg, "size": .closureSize, "narSize": .narSize}'
done
endgroup
@ -40,14 +44,14 @@ pkgs_json() {
configs_json() {
group 'Building NixOS configurations'
trap endgroup RETURN
for config in $configurations; do
log "Building $config"
path=$(nix build --print-out-paths ".#nixosConfigurations.$config.config.system.build.toplevel" 2>/dev/null)
path=$(nix build --print-out-paths ".#nixosConfigurations.$config.config.system.build.toplevel")
log "Calculating size of $config"
nix path-info --closure-size --json "$path" 2>/dev/null |
nix path-info --closure-size --json "$path" |
jq --compact-output --arg pkg "$config" '.[] | {"name": $pkg, "size": .closureSize, "narSize": .narSize}'
done
endgroup
}
pkgs=$(pkgs_json | jq --slurp '.')