diff --git a/ci/eval/compare/default.nix b/ci/eval/compare/default.nix index 9b71c6656914c..c6711687ae9c3 100644 --- a/ci/eval/compare/default.nix +++ b/ci/eval/compare/default.nix @@ -3,6 +3,7 @@ jq, runCommand, writeText, + python3, ... }: { @@ -123,18 +124,59 @@ let in runCommand "compare" { - nativeBuildInputs = [ jq ]; + nativeBuildInputs = [ + jq + (python3.withPackages ( + ps: with ps; [ + numpy + pandas + scipy + ] + )) + + ]; maintainers = builtins.toJSON maintainers; passAsFile = [ "maintainers" ]; + env = { + BEFORE_DIR = "${beforeResultDir}"; + AFTER_DIR = "${afterResultDir}"; + }; } '' mkdir $out cp ${changed-paths} $out/changed-paths.json - jq -r -f ${./generate-step-summary.jq} < ${changed-paths} > $out/step-summary.md - cp "$maintainersPath" "$out/maintainers.json" + if jq -e '(.attrdiff.added | length == 0) and (.attrdiff.removed | length == 0)' "${changed-paths}" > /dev/null; then + # Chunks have changed between revisions + # We cannot generate a performance comparison + { + echo + echo "# Performance comparison" + echo + 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 + + python3 ${./cmp-stats.py} >> $out/step-summary.md - # TODO: Compare eval stats + else + # Package chunks are the same in both revisions + # We can use the to generate a performance comparison + { + 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 + fi + + jq -r -f ${./generate-step-summary.jq} < ${changed-paths} >> $out/step-summary.md + + cp "$maintainersPath" "$out/maintainers.json" '' diff --git a/ci/eval/default.nix b/ci/eval/default.nix index 8537084b1bd5e..639e75ec4211f 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -9,6 +9,7 @@ nixVersions, jq, sta, + python3, }: let @@ -270,6 +271,7 @@ let runCommand writeText supportedSystems + python3 ; };