From bff5365c60a7d67617c030dd616312ba13e5429c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Wed, 18 Dec 2024 23:34:30 +0100 Subject: [PATCH] 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. --- create-report.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/create-report.sh b/create-report.sh index abee680..0452793 100755 --- a/create-report.sh +++ b/create-report.sh @@ -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 '.')