Loading .github/workflows/eval.yml +15 −1 Original line number Diff line number Diff line Loading @@ -312,6 +312,12 @@ jobs: script: | const { readFile } = require('node:fs/promises') const changed = JSON.parse(await readFile('comparison/changed-paths.json', 'utf-8')) const removedByKernel = Object.fromEntries( Object.entries(changed.attrdiffByKernel ?? {}).map(([kernel, diff]) => [ kernel, diff.removed.length, ]), ) const description = 'Package: ' + [ `added ${changed.attrdiff.added.length}`, Loading @@ -321,7 +327,15 @@ jobs: ' — Rebuild: ' + [ `linux ${changed.rebuildCountByKernel.linux}`, `darwin ${changed.rebuildCountByKernel.darwin}` ].join(', ') + ( Object.values(removedByKernel).some((count) => count > 0) ? ' — Removed: ' + [ `linux ${removedByKernel.linux ?? 0}`, `darwin ${removedByKernel.darwin ?? 0}` ].join(', ') : '' ) const { serverUrl, repo, runId, payload } = context const target_url = Loading ci/eval/compare/default.nix +42 −2 Original line number Diff line number Diff line Loading @@ -74,9 +74,38 @@ let { attrdiff: { added: ["package1"], changed: ["package2", "package3"], changed: ["package2", "package3", "package4"], removed: ["package4"], }, attrdiffByKernel: { darwin: { added: [], changed: ["package2", "package4"], removed: ["package4"], }, linux: { added: ["package1"], changed: ["package3", "package4"], removed: [], }, }, attrdiffByPlatform: { aarch64-darwin: { added: [], changed: ["package2"], removed: ["package4"], }, aarch64-linux: { added: ["package1"], changed: ["package3"], removed: [], }, x86_64-linux: { added: [], changed: ["package4"], removed: [], }, }, labels: { "10.rebuild-darwin: 1-10": true, "10.rebuild-linux: 1-10": true Loading Loading @@ -113,6 +142,8 @@ let inherit (import ./utils.nix { inherit lib; }) groupByKernel convertToPackagePlatformAttrs groupAttrdiffByKernel groupAttrdiffByPlatform groupByPlatform extractPackageNames getLabels Loading @@ -127,6 +158,15 @@ let changed-paths = let attrdiff = lib.mapAttrs (_: extractPackageNames) { inherit (diffAttrs) added changed removed; }; attrdiffByPlatform = groupAttrdiffByPlatform { inherit (diffAttrs) added changed removed; }; attrdiffByKernel = groupAttrdiffByKernel { inherit (diffAttrs) added changed removed; }; rebuildsByPlatform = groupByPlatform rebuildsPackagePlatformAttrs; rebuildsByKernel = groupByKernel rebuildsPackagePlatformAttrs; rebuildCountByKernel = lib.mapAttrs ( Loading @@ -135,7 +175,7 @@ let in writeText "changed-paths.json" ( builtins.toJSON { attrdiff = lib.mapAttrs (_: extractPackageNames) { inherit (diffAttrs) added changed removed; }; inherit attrdiff attrdiffByKernel attrdiffByPlatform; inherit rebuildsByPlatform rebuildsByKernel Loading ci/eval/compare/test.nix +78 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ }: let fun = import ./maintainers.nix { inherit lib; }; utils = import ./utils.nix { inherit lib; }; mockPkgs = { Loading Loading @@ -226,6 +227,83 @@ let ]; }; }; testGroupAttrdiffByPlatform = { expr = utils.groupAttrdiffByPlatform { added = [ "new-tool.aarch64-linux" "new-tool.x86_64-darwin" ]; changed = [ "updated-tool.x86_64-darwin" "shared-tool.x86_64-darwin" ]; removed = [ "removed-tool.aarch64-darwin" "shared-tool.aarch64-darwin" ]; }; expected = { aarch64-darwin = { added = [ ]; changed = [ ]; removed = [ "removed-tool" "shared-tool" ]; }; aarch64-linux = { added = [ "new-tool" ]; changed = [ ]; removed = [ ]; }; x86_64-darwin = { added = [ "new-tool" ]; changed = [ "shared-tool" "updated-tool" ]; removed = [ ]; }; }; }; testGroupAttrdiffByKernel = { expr = let grouped = utils.groupAttrdiffByKernel { added = [ "new-tool.aarch64-linux" "new-tool.x86_64-darwin" ]; changed = [ "updated-tool.x86_64-darwin" "shared-tool.x86_64-darwin" ]; removed = [ "removed-tool.aarch64-darwin" "shared-tool.aarch64-darwin" ]; }; in lib.mapAttrs (_: diff: lib.mapAttrs (_: lib.sort lib.lessThan) diff) grouped; expected = { darwin = { added = [ "new-tool" ]; changed = [ "shared-tool" "updated-tool" ]; removed = [ "removed-tool" "shared-tool" ]; }; linux = { added = [ "new-tool" ]; changed = [ ]; removed = [ ]; }; }; }; }; in { Loading ci/eval/compare/utils.nix +44 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,50 @@ rec { in lib.genAttrs [ "linux" "darwin" ] filterKernel; /* Group an attrdiff-style mapping by a derived key such as platform or kernel. Turns { added = [ "new-tool.aarch64-linux" "new-tool.x86_64-darwin" ]; changed = [ "updated-tool.x86_64-darwin" "shared-tool.x86_64-darwin" ]; removed = [ "removed-tool.aarch64-darwin" "shared-tool.aarch64-darwin" ]; } into { aarch64-darwin = { added = [ ]; changed = [ ]; removed = [ "removed-tool" "shared-tool" ]; }; aarch64-linux = { added = [ "new-tool" ]; changed = [ ]; removed = [ ]; }; x86_64-darwin = { added = [ "new-tool" ]; changed = [ "shared-tool" "updated-tool" ]; removed = [ ]; }; } when used with `groupByPlatform`. */ groupAttrdiffBy = grouper: attrdiff: let groupedByKind = lib.mapAttrs ( _: packagePlatformPaths: grouper (convertToPackagePlatformAttrs (uniqueStrings packagePlatformPaths)) ) attrdiff; groups = uniqueStrings (lib.flatten (map builtins.attrNames (lib.attrValues groupedByKind))); in lib.genAttrs groups (group: lib.mapAttrs (_: byGroup: byGroup.${group} or [ ]) groupedByKind); groupAttrdiffByPlatform = groupAttrdiffBy groupByPlatform; groupAttrdiffByKernel = groupAttrdiffBy groupByKernel; /* Maps an attrs of `kernel - rebuild counts` mappings to an attrs of labels Loading ci/github-script/check-target-branch.js +10 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,16 @@ async function checkTargetBranch({ github, context, core, dry }) { * changed: string[], * removed: string[], * }, * attrdiffByKernel: Record<string, { * added: string[], * changed: string[], * removed: string[], * }>, * attrdiffByPlatform: Record<string, { * added: string[], * changed: string[], * removed: string[], * }>, * labels: Record<string, boolean>, * rebuildCountByKernel: Record<string, number>, * rebuildsByKernel: Record<string, string[]>, Loading Loading
.github/workflows/eval.yml +15 −1 Original line number Diff line number Diff line Loading @@ -312,6 +312,12 @@ jobs: script: | const { readFile } = require('node:fs/promises') const changed = JSON.parse(await readFile('comparison/changed-paths.json', 'utf-8')) const removedByKernel = Object.fromEntries( Object.entries(changed.attrdiffByKernel ?? {}).map(([kernel, diff]) => [ kernel, diff.removed.length, ]), ) const description = 'Package: ' + [ `added ${changed.attrdiff.added.length}`, Loading @@ -321,7 +327,15 @@ jobs: ' — Rebuild: ' + [ `linux ${changed.rebuildCountByKernel.linux}`, `darwin ${changed.rebuildCountByKernel.darwin}` ].join(', ') + ( Object.values(removedByKernel).some((count) => count > 0) ? ' — Removed: ' + [ `linux ${removedByKernel.linux ?? 0}`, `darwin ${removedByKernel.darwin ?? 0}` ].join(', ') : '' ) const { serverUrl, repo, runId, payload } = context const target_url = Loading
ci/eval/compare/default.nix +42 −2 Original line number Diff line number Diff line Loading @@ -74,9 +74,38 @@ let { attrdiff: { added: ["package1"], changed: ["package2", "package3"], changed: ["package2", "package3", "package4"], removed: ["package4"], }, attrdiffByKernel: { darwin: { added: [], changed: ["package2", "package4"], removed: ["package4"], }, linux: { added: ["package1"], changed: ["package3", "package4"], removed: [], }, }, attrdiffByPlatform: { aarch64-darwin: { added: [], changed: ["package2"], removed: ["package4"], }, aarch64-linux: { added: ["package1"], changed: ["package3"], removed: [], }, x86_64-linux: { added: [], changed: ["package4"], removed: [], }, }, labels: { "10.rebuild-darwin: 1-10": true, "10.rebuild-linux: 1-10": true Loading Loading @@ -113,6 +142,8 @@ let inherit (import ./utils.nix { inherit lib; }) groupByKernel convertToPackagePlatformAttrs groupAttrdiffByKernel groupAttrdiffByPlatform groupByPlatform extractPackageNames getLabels Loading @@ -127,6 +158,15 @@ let changed-paths = let attrdiff = lib.mapAttrs (_: extractPackageNames) { inherit (diffAttrs) added changed removed; }; attrdiffByPlatform = groupAttrdiffByPlatform { inherit (diffAttrs) added changed removed; }; attrdiffByKernel = groupAttrdiffByKernel { inherit (diffAttrs) added changed removed; }; rebuildsByPlatform = groupByPlatform rebuildsPackagePlatformAttrs; rebuildsByKernel = groupByKernel rebuildsPackagePlatformAttrs; rebuildCountByKernel = lib.mapAttrs ( Loading @@ -135,7 +175,7 @@ let in writeText "changed-paths.json" ( builtins.toJSON { attrdiff = lib.mapAttrs (_: extractPackageNames) { inherit (diffAttrs) added changed removed; }; inherit attrdiff attrdiffByKernel attrdiffByPlatform; inherit rebuildsByPlatform rebuildsByKernel Loading
ci/eval/compare/test.nix +78 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ }: let fun = import ./maintainers.nix { inherit lib; }; utils = import ./utils.nix { inherit lib; }; mockPkgs = { Loading Loading @@ -226,6 +227,83 @@ let ]; }; }; testGroupAttrdiffByPlatform = { expr = utils.groupAttrdiffByPlatform { added = [ "new-tool.aarch64-linux" "new-tool.x86_64-darwin" ]; changed = [ "updated-tool.x86_64-darwin" "shared-tool.x86_64-darwin" ]; removed = [ "removed-tool.aarch64-darwin" "shared-tool.aarch64-darwin" ]; }; expected = { aarch64-darwin = { added = [ ]; changed = [ ]; removed = [ "removed-tool" "shared-tool" ]; }; aarch64-linux = { added = [ "new-tool" ]; changed = [ ]; removed = [ ]; }; x86_64-darwin = { added = [ "new-tool" ]; changed = [ "shared-tool" "updated-tool" ]; removed = [ ]; }; }; }; testGroupAttrdiffByKernel = { expr = let grouped = utils.groupAttrdiffByKernel { added = [ "new-tool.aarch64-linux" "new-tool.x86_64-darwin" ]; changed = [ "updated-tool.x86_64-darwin" "shared-tool.x86_64-darwin" ]; removed = [ "removed-tool.aarch64-darwin" "shared-tool.aarch64-darwin" ]; }; in lib.mapAttrs (_: diff: lib.mapAttrs (_: lib.sort lib.lessThan) diff) grouped; expected = { darwin = { added = [ "new-tool" ]; changed = [ "shared-tool" "updated-tool" ]; removed = [ "removed-tool" "shared-tool" ]; }; linux = { added = [ "new-tool" ]; changed = [ ]; removed = [ ]; }; }; }; }; in { Loading
ci/eval/compare/utils.nix +44 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,50 @@ rec { in lib.genAttrs [ "linux" "darwin" ] filterKernel; /* Group an attrdiff-style mapping by a derived key such as platform or kernel. Turns { added = [ "new-tool.aarch64-linux" "new-tool.x86_64-darwin" ]; changed = [ "updated-tool.x86_64-darwin" "shared-tool.x86_64-darwin" ]; removed = [ "removed-tool.aarch64-darwin" "shared-tool.aarch64-darwin" ]; } into { aarch64-darwin = { added = [ ]; changed = [ ]; removed = [ "removed-tool" "shared-tool" ]; }; aarch64-linux = { added = [ "new-tool" ]; changed = [ ]; removed = [ ]; }; x86_64-darwin = { added = [ "new-tool" ]; changed = [ "shared-tool" "updated-tool" ]; removed = [ ]; }; } when used with `groupByPlatform`. */ groupAttrdiffBy = grouper: attrdiff: let groupedByKind = lib.mapAttrs ( _: packagePlatformPaths: grouper (convertToPackagePlatformAttrs (uniqueStrings packagePlatformPaths)) ) attrdiff; groups = uniqueStrings (lib.flatten (map builtins.attrNames (lib.attrValues groupedByKind))); in lib.genAttrs groups (group: lib.mapAttrs (_: byGroup: byGroup.${group} or [ ]) groupedByKind); groupAttrdiffByPlatform = groupAttrdiffBy groupByPlatform; groupAttrdiffByKernel = groupAttrdiffBy groupByKernel; /* Maps an attrs of `kernel - rebuild counts` mappings to an attrs of labels Loading
ci/github-script/check-target-branch.js +10 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,16 @@ async function checkTargetBranch({ github, context, core, dry }) { * changed: string[], * removed: string[], * }, * attrdiffByKernel: Record<string, { * added: string[], * changed: string[], * removed: string[], * }>, * attrdiffByPlatform: Record<string, { * added: string[], * changed: string[], * removed: string[], * }>, * labels: Record<string, boolean>, * rebuildCountByKernel: Record<string, number>, * rebuildsByKernel: Record<string, string[]>, Loading