wip: report package sizes
Some checks failed
/ check (push) Successful in 50s
/ build (audiomenu) (push) Successful in 1s
/ build (docs) (push) Successful in 2s
/ build (jpassmenu) (push) Successful in 1s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Successful in 19s
/ build (nvim) (push) Successful in 9s
/ report-size (pull_request) Failing after 24s
Some checks failed
/ check (push) Successful in 50s
/ build (audiomenu) (push) Successful in 1s
/ build (docs) (push) Successful in 2s
/ build (jpassmenu) (push) Successful in 1s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Successful in 19s
/ build (nvim) (push) Successful in 9s
/ report-size (pull_request) Failing after 24s
Added as a comment to the current pull request
This commit is contained in:
parent
6bde92bd91
commit
44a53b78e0
3 changed files with 52 additions and 0 deletions
10
.forgejo/workflows/size-report.yml
Normal file
10
.forgejo/workflows/size-report.yml
Normal file
|
@ -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
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
result
|
result
|
||||||
|
result-*
|
||||||
.direnv/
|
.direnv/
|
||||||
.pre-commit-config.yaml
|
.pre-commit-config.yaml
|
||||||
# ignore vm images
|
# ignore vm images
|
||||||
|
|
41
ci-scripts/report-size.sh
Executable file
41
ci-scripts/report-size.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
package_size_table() {
|
||||||
|
packages=$(nix flake show --json 2>/dev/null | jq --raw-output '.packages."x86_64-linux" | ".#" + keys[]')
|
||||||
|
# we want to split the words as each of them is a different installable
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
nix build $packages
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
table=$(nix path-info --size --closure-size --human-readable \
|
||||||
|
$packages |
|
||||||
|
sed 's/^\(\S\+\)\(\s\+\)\(\S\+\)\(\s\+\)\(\S\+\)$/| \1\2| \3 | \4\5 |/')
|
||||||
|
|
||||||
|
cat <<-EOF
|
||||||
|
| Nix Store Path | NAR Size | Closure Size |
|
||||||
|
|----------------|---------:|-------------:|
|
||||||
|
$table
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$CI" = "true" ]; then
|
||||||
|
echo "Logging in to $GITHUB_SERVER_URL with default token"
|
||||||
|
tea login add --url "$GITHUB_SERVER_URL" --token "$GITHUB_TOKEN"
|
||||||
|
echo "Retrieving PR index for $GITHUB_HEAD_REF"
|
||||||
|
tea pulls -f index,head -o simple
|
||||||
|
pr_index=$(tea pulls -f index,head -o simple | grep "$GITHUB_HEAD_REF" | head -n1 | cut -d' ' -f 1)
|
||||||
|
echo "Retrieved index: $pr_index"
|
||||||
|
echo "Expected PR URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pulls/$pr_index"
|
||||||
|
tea comment "$pr_index" "$(
|
||||||
|
cat <<-EOF
|
||||||
|
### NixOS Configurations sizes
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
### Package sizes
|
||||||
|
|
||||||
|
$(package_size_table)
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
else
|
||||||
|
package_size_table
|
||||||
|
fi
|
Loading…
Reference in a new issue