ci/eval/compare: show performance comparison even when package sets differ (#523919)

This commit is contained in:
Michael Daniels 2026-06-07 14:45:06 +00:00 committed by GitHub
commit 7ed15fdeb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -238,34 +238,33 @@ runCommand "compare"
jq -r -f ${./generate-step-summary.jq} < ${changed-paths} jq -r -f ${./generate-step-summary.jq} < ${changed-paths}
} >> $out/step-summary.md } >> $out/step-summary.md
if jq -e '(.attrdiff.added | length == 0) and (.attrdiff.removed | length == 0)' "${changed-paths}" > /dev/null; then {
# Chunks have changed between revisions echo
# We cannot generate a performance comparison echo "# Performance comparison"
{ echo
echo echo "This compares the performance of this branch against its pull request base branch (e.g., 'master')"
echo "# Performance comparison" echo
echo } >> $out/step-summary.md
echo "This compares the performance of this branch against its pull request base branch (e.g., 'master')"
echo
echo "For further help please refer to: [ci/README.md](https://github.com/NixOS/nixpkgs/blob/master/ci/README.md)"
echo
} >> $out/step-summary.md
cmp-stats --explain ${combined}/before/stats ${combined}/after/stats >> $out/step-summary.md # cmp-stats only compares the stats chunks present in both revisions, so the
# comparison is still produced when packages were added/removed. The paired
else # chunks may cover different attrs in that case, so caveat the figures.
# Package chunks are the same in both revisions if ! jq -e '(.attrdiff.added | length == 0) and (.attrdiff.removed | length == 0)' "${changed-paths}" > /dev/null; then
# We can use the to generate a performance comparison
{ {
echo "> [!NOTE]"
echo "> The package sets differ between the two revisions. This comparison only"
echo "> covers packages evaluated in both, so treat the figures as approximate."
echo echo
echo "# Performance Comparison"
echo
echo "Performance stats were skipped because the package sets differ between the two revisions."
echo
echo "For further help please refer to: [ci/README.md](https://github.com/NixOS/nixpkgs/blob/master/ci/README.md)"
} >> $out/step-summary.md } >> $out/step-summary.md
fi fi
{
echo "For further help please refer to: [ci/README.md](https://github.com/NixOS/nixpkgs/blob/master/ci/README.md)"
echo
} >> $out/step-summary.md
cmp-stats --explain ${combined}/before/stats ${combined}/after/stats >> $out/step-summary.md
jq -r '.[]' "${touchedFilesJson}" > ./touched-files jq -r '.[]' "${touchedFilesJson}" > ./touched-files
readarray -t touchedFiles < ./touched-files readarray -t touchedFiles < ./touched-files
echo "This PR touches ''${#touchedFiles[@]} files" echo "This PR touches ''${#touchedFiles[@]} files"