diff --git a/.github/workflows/eval.yml b/.github/workflows/eval.yml index 3a7509622b78..b037b29c9558 100644 --- a/.github/workflows/eval.yml +++ b/.github/workflows/eval.yml @@ -194,6 +194,12 @@ jobs: --arg diffDir ./diff \ --out-link combined + - name: Upload the maintainer list + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: ${{ inputs.artifact-prefix }}maintainers + path: combined/maintainers.json + - name: Compare against the target branch env: AUTHOR_ID: ${{ github.event.pull_request.user.id }} diff --git a/ci/eval/default.nix b/ci/eval/default.nix index 9cc5ad6857b7..75b2eb9cba5d 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -111,6 +111,7 @@ let --option allow-import-from-derivation false \ --query --available \ --out-path --json \ + --meta \ --show-trace \ --arg chunkSize "$chunkSize" \ --arg myChunk "$myChunk" \ @@ -204,6 +205,7 @@ let fi cat "$chunkOutputDir"/result/* | jq -s 'add | map_values(.outputs)' > $out/${evalSystem}/paths.json + cat "$chunkOutputDir"/result/* | jq -s 'add | map_values(.meta)' > $out/${evalSystem}/meta.json ''; diff = callPackage ./diff.nix { }; @@ -232,6 +234,14 @@ let }) ' > $out/combined-diff.json + # Combine maintainers from all systems + cat ${diffDir}/*/maintainers.json | jq -s ' + add | group_by(.package) | map({ + key: .[0].package, + value: map(.maintainers) | flatten | unique + }) | from_entries + ' > $out/maintainers.json + mkdir -p $out/before/stats for d in ${diffDir}/before/*; do cp -r "$d"/stats-by-chunk $out/before/stats/$(basename "$d") diff --git a/ci/eval/diff.nix b/ci/eval/diff.nix index 0f757ce3dd12..bb8ba8088c7f 100644 --- a/ci/eval/diff.nix +++ b/ci/eval/diff.nix @@ -76,6 +76,27 @@ let afterAttrs = getAttrs after; diffAttrs = diff beforeAttrs afterAttrs; diffJson = writeText "diff.json" (builtins.toJSON diffAttrs); + + # The maintainer list is not diffed, but just taken as is, to provide a map + # of maintainers on the target branch. A list of GitHub IDs is sufficient for + # all our purposes and reduces size massively. + meta = lib.importJSON "${after}/${evalSystem}/meta.json"; + maintainers = lib.pipe meta [ + (lib.mapAttrsToList ( + k: v: { + # splits off the platform suffix + package = lib.pipe k [ + (lib.splitString ".") + lib.init + (lib.concatStringsSep ".") + ]; + maintainers = map (m: m.githubId) v.maintainers or [ ]; + } + )) + # Some paths don't have a platform suffix, those will appear with an empty package here. + (lib.filter ({ package, maintainers }: package != "" && maintainers != [ ])) + ]; + maintainersJson = writeText "maintainers.json" (builtins.toJSON maintainers); in runCommand "diff" { } '' mkdir -p $out/${evalSystem} @@ -86,4 +107,5 @@ runCommand "diff" { } '' # the source files to keep the artifacts smaller. find $out/before $out/after -iname '*.json' -delete cp ${diffJson} $out/${evalSystem}/diff.json + cp ${maintainersJson} $out/${evalSystem}/maintainers.json ''