From e256fef10588ac02ccdfa91d510733458eea8568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 14 Dec 2024 23:49:23 +0100 Subject: [PATCH] wip: report package sizes Added as a comment to the current pull request --- .forgejo/workflows/size-report.yml | 10 ++++++++++ ci-scripts/report-size.sh | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .forgejo/workflows/size-report.yml create mode 100755 ci-scripts/report-size.sh diff --git a/.forgejo/workflows/size-report.yml b/.forgejo/workflows/size-report.yml new file mode 100644 index 0000000..1bf2a41 --- /dev/null +++ b/.forgejo/workflows/size-report.yml @@ -0,0 +1,10 @@ +on: + pull_request: +jobs: + report-size: + runs-on: nixos + steps: + - uses: "https://git.salame.cl/actions/checkout@v4" + - run: nix --version + - name: Report Size + run: ci-scripts/report-size.sh diff --git a/ci-scripts/report-size.sh b/ci-scripts/report-size.sh new file mode 100755 index 0000000..fc53af0 --- /dev/null +++ b/ci-scripts/report-size.sh @@ -0,0 +1,18 @@ +create_table() { + # we want to split the words as each of them is a different installable + # shellcheck disable=SC2046 + table=$(nix path-info --size --closure-size --human-readable \ + $(nix flake show --json 2>/dev/null | jq --raw-output '.packages."x86_64-linux" | ".#" + keys[]') | + sed 's/^\(\S\+\)\(\s\+\)\(\S\+\)\(\s\+\)\(\S\+\)$/| \1\2| \3 | \4\5 |/') + + cat <<-EOF + | Nix Store Path | NAR Size | Closure Size | + |----------------|---------:|-------------:| + $table + EOF +} + +tea login add --url "$GITHUB_SERVER_URL" --token "$GITHUB_TOKEN" +tea pulls list + +create_table