diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 36db5d7cf0aca..1e5a1a229d548 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -18,7 +18,7 @@ jobs: steps: # Use a GitHub App to create the PR so that CI gets triggered # The App is scoped to Repository > Contents and Pull Requests: write for Nixpkgs - - uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 + - uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1 id: app-token with: app-id: ${{ vars.BACKPORT_APP_ID }} @@ -28,7 +28,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} token: ${{ steps.app-token.outputs.token }} - name: Create backport PRs - uses: korthout/backport-action@bd410d37cdcae80be6d969823ff5a225fe5c833f # v3.0.2 + uses: korthout/backport-action@be567af183754f6a5d831ae90f648954763f17f5 # v3.1.0 with: # Config README: https://github.com/korthout/backport-action#backport-action copy_labels_pattern: 'severity:\ssecurity' diff --git a/.github/workflows/check-nix-format.yml b/.github/workflows/check-nix-format.yml index 501f1823b3a86..19f80085c5cc5 100644 --- a/.github/workflows/check-nix-format.yml +++ b/.github/workflows/check-nix-format.yml @@ -87,7 +87,7 @@ jobs: if (( "${#unformattedFiles[@]}" > 0 )); then echo "Some new/changed Nix files are not properly formatted" - echo "Please go to the Nixpkgs root directory, run \`nix-shell\`, then:" + echo "Please format them using the Nixpkgs-specific \`nixfmt\` by going to the Nixpkgs root directory, running \`nix-shell\`, then:" echo "nixfmt ${unformattedFiles[*]@Q}" echo "Make sure your branch is up to date with master, rebase if not." echo "If you're having trouble, please ping @NixOS/nix-formatting" diff --git a/.github/workflows/check-nixf-tidy.yml b/.github/workflows/check-nixf-tidy.yml index de74ae8b5372a..481ae2df4c31f 100644 --- a/.github/workflows/check-nixf-tidy.yml +++ b/.github/workflows/check-nixf-tidy.yml @@ -107,7 +107,7 @@ jobs: echo "$errors" else # just print in plain text - echo "$errors" | sed 's/^:://' + echo "${errors/::/}" echo # add one empty line fi failedFiles+=("$dest") diff --git a/.github/workflows/check-shell.yml b/.github/workflows/check-shell.yml index 82bc43fb92941..316813879e81c 100644 --- a/.github/workflows/check-shell.yml +++ b/.github/workflows/check-shell.yml @@ -2,6 +2,9 @@ name: "Check shell" on: pull_request_target: + paths: + - 'shell.nix' + - 'ci/**' permissions: {} diff --git a/.github/workflows/codeowners-v2.yml b/.github/workflows/codeowners-v2.yml index 5cfeafa8489e2..6329e1d9ea110 100644 --- a/.github/workflows/codeowners-v2.yml +++ b/.github/workflows/codeowners-v2.yml @@ -62,7 +62,7 @@ jobs: - name: Build codeowners validator run: nix-build base/ci -A codeownersValidator - - uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 + - uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1 id: app-token with: app-id: ${{ vars.OWNER_RO_APP_ID }} @@ -94,7 +94,7 @@ jobs: # This is intentional, because we need to request the review of owners as declared in the base branch. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 + - uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1 id: app-token with: app-id: ${{ vars.OWNER_APP_ID }} diff --git a/.github/workflows/editorconfig-v2.yml b/.github/workflows/editorconfig-v2.yml index 99bee8b301228..07afb60bc3ae0 100644 --- a/.github/workflows/editorconfig-v2.yml +++ b/.github/workflows/editorconfig-v2.yml @@ -42,7 +42,7 @@ jobs: nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz - name: Checking EditorConfig run: | - cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size' + < "$HOME/changed_files" nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size' - if: ${{ failure() }} run: | echo "::error :: Hey! It looks like your changes don't follow our editorconfig settings. Read https://editorconfig.org/#download to configure your editor so you never see this error again." diff --git a/.github/workflows/eval.yml b/.github/workflows/eval.yml index 0e857e185e379..06cff2b878d3e 100644 --- a/.github/workflows/eval.yml +++ b/.github/workflows/eval.yml @@ -53,7 +53,7 @@ jobs: echo "systems=$(> "$GITHUB_OUTPUT" - name: Upload the list of all attributes - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: paths path: result/* @@ -81,6 +81,7 @@ jobs: runs-on: ubuntu-latest needs: [ attrs, get-merge-commit ] strategy: + fail-fast: false matrix: system: ${{ fromJSON(needs.attrs.outputs.systems) }} steps: @@ -110,7 +111,7 @@ jobs: # If it uses too much memory, slightly decrease chunkSize - name: Upload the output paths and eval stats - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: intermediate-${{ matrix.system }} path: result/* @@ -144,7 +145,7 @@ jobs: -o prResult - name: Upload the combined results - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: result path: prResult/* @@ -165,14 +166,14 @@ jobs: runId=$(jq .id <<< "$run") conclusion=$(jq -r .conclusion <<< "$run") - while [[ "$conclusion" == null ]]; do + while [[ "$conclusion" == null || "$conclusion" == "" ]]; do echo "Workflow not done, waiting 10 seconds before checking again" sleep 10 conclusion=$(gh api /repos/"$REPOSITORY"/actions/runs/"$runId" --jq '.conclusion') done if [[ "$conclusion" != "success" ]]; then - echo "Workflow was not successful, cannot make comparison" + echo "Workflow was not successful (conclusion: $conclusion), cannot make comparison" exit 0 fi @@ -202,7 +203,7 @@ jobs: - name: Upload the combined results if: steps.baseRunId.outputs.baseRunId - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: comparison path: comparison/* diff --git a/.github/workflows/lint-actions.sh b/.github/workflows/lint-actions.sh new file mode 100755 index 0000000000000..43d6e801caf68 --- /dev/null +++ b/.github/workflows/lint-actions.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash actionlint shellcheck -I nixpkgs=../.. +set -euo pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "$SCRIPT_DIR/../.." +actionlint diff --git a/ci/eval/README.md b/ci/eval/README.md index 020e7127f51a9..0436a028ed69e 100644 --- a/ci/eval/README.md +++ b/ci/eval/README.md @@ -5,14 +5,16 @@ The code in this directory is used by the [eval.yml](../../.github/workflows/eva Furthermore it also allows local evaluation using ``` nix-build ci -A eval.full \ - --max-jobs 4 - --cores 2 - --arg chunkSize 10000 + --max-jobs 4 \ + --cores 2 \ + --arg chunkSize 10000 \ + --arg evalSystems '["x86_64-linux" "aarch64-darwin"]' ``` - `--max-jobs`: The maximum number of derivations to run at the same time. Only each [supported system](../supportedSystems.nix) gets a separate derivation, so it doesn't make sense to set this higher than that number. - `--cores`: The number of cores to use for each job. Recommended to set this to the amount of cores on your system divided by `--max-jobs`. - `chunkSize`: The number of attributes that are evaluated simultaneously on a single core. Lowering this decreases memory usage at the cost of increased evaluation time. If this is too high, there won't be enough chunks to process them in parallel, and will also increase evaluation time. +- `evalSystems`: The set of systems for which `nixpkgs` should be evaluated. Defaults to the four official platforms (`x86_64-linux`, `aarch64-linux`, `x86_64-darwin` and `aarch64-darwin`). A good default is to set `chunkSize` to 10000, which leads to about 3.6GB max memory usage per core, so suitable for fully utilising machines with 4 cores and 16GB memory, 8 cores and 32GB memory or 16 cores and 64GB memory. diff --git a/ci/eval/compare.jq b/ci/eval/compare.jq deleted file mode 100644 index 9f3a032d13841..0000000000000 --- a/ci/eval/compare.jq +++ /dev/null @@ -1,164 +0,0 @@ -# Turns -# -# { -# "hello.aarch64-linux": "a", -# "hello.x86_64-linux": "b", -# "hello.aarch64-darwin": "c", -# "hello.x86_64-darwin": "d" -# } -# -# into -# -# { -# "hello": { -# "linux": { -# "aarch64": "a", -# "x86_64": "b" -# }, -# "darwin": { -# "aarch64": "c", -# "x86_64": "d" -# } -# } -# } -# -# while filtering out any attribute paths that don't match this pattern -def expand_system: - to_entries - | map( - .key |= split(".") - | select(.key | length > 1) - | .double = (.key[-1] | split("-")) - | select(.double | length == 2) - ) - | group_by(.key[0:-1]) - | map( - { - key: .[0].key[0:-1] | join("."), - value: - group_by(.double[1]) - | map( - { - key: .[0].double[1], - value: map(.key = .double[0]) | from_entries - } - ) - | from_entries - }) - | from_entries - ; - -# Transposes -# -# { -# "a": [ "x", "y" ], -# "b": [ "x" ], -# } -# -# into -# -# { -# "x": [ "a", "b" ], -# "y": [ "a" ] -# } -def transpose: - [ - to_entries[] - | { - key: .key, - value: .value[] - } - ] - | group_by(.value) - | map({ - key: .[0].value, - value: map(.key) - }) - | from_entries - ; - -# Computes the key difference for two objects: -# { -# added: [ ], -# removed: [ ], -# changed: [ ], -# } -# -def diff($before; $after): - { - added: $after | delpaths($before | keys | map([.])) | keys, - removed: $before | delpaths($after | keys | map([.])) | keys, - changed: - $before - | to_entries - | map( - $after."\(.key)" as $after2 - | select( - # Filter out attributes that don't exist anymore - ($after2 != null) - and - # Filter out attributes that are the same as the new value - (.value != $after2) - ) - | .key - ) - } - ; - -($before[0] | expand_system) as $before -| ($after[0] | expand_system) as $after -| .attrdiff = diff($before; $after) -| .rebuildsByKernel = ( - [ - ( - .attrdiff.changed[] - | { - key: ., - value: diff($before."\(.)"; $after."\(.)").changed - } - ) - , - ( - .attrdiff.added[] - | { - key: ., - value: ($after."\(.)" | keys) - } - ) - ] - | from_entries - | transpose -) -| .rebuildCountByKernel = ( - .rebuildsByKernel - | with_entries(.value |= length) - | pick(.linux, .darwin) - | { - linux: (.linux // 0), - darwin: (.darwin // 0), - } -) -| .labels = ( - .rebuildCountByKernel - | to_entries - | map( - "10.rebuild-\(.key): " + - if .value == 0 then - "0" - elif .value <= 10 then - "1-10" - elif .value <= 100 then - "11-100" - elif .value <= 500 then - "101-500" - elif .value <= 1000 then - "501-1000" - elif .value <= 2500 then - "1001-2500" - elif .value <= 5000 then - "2501-5000" - else - "5001+" - end - ) -) diff --git a/ci/eval/compare/default.nix b/ci/eval/compare/default.nix new file mode 100644 index 0000000000000..cfcdd3c1a217c --- /dev/null +++ b/ci/eval/compare/default.nix @@ -0,0 +1,119 @@ +{ + lib, + jq, + runCommand, + writeText, + ... +}: +{ beforeResultDir, afterResultDir }: +let + /* + Derivation that computes which packages are affected (added, changed or removed) between two revisions of nixpkgs. + Note: "platforms" are "x86_64-linux", "aarch64-darwin", ... + + --- + Inputs: + - beforeResultDir, afterResultDir: The evaluation result from before and after the change. + They can be obtained by running `nix-build -A ci.eval.full` on both revisions. + + --- + Outputs: + - changed-paths.json: Various information about the changes: + { + attrdiff: { + added: ["package1"], + changed: ["package2", "package3"], + removed: ["package4"], + }, + labels: [ + "10.rebuild-darwin: 1-10", + "10.rebuild-linux: 1-10" + ], + rebuildsByKernel: { + darwin: ["package1", "package2"], + linux: ["package1", "package2", "package3"] + }, + rebuildCountByKernel: { + darwin: 2, + linux: 3, + }, + rebuildsByPlatform: { + aarch64-darwin: ["package1", "package2"], + aarch64-linux: ["package1", "package2"], + x86_64-linux: ["package1", "package2", "package3"], + x86_64-darwin: ["package1"], + }, + } + - step-summary.md: A markdown render of the changes + + --- + Implementation details: + + Helper functions can be found in ./utils.nix. + Two main "types" are important: + + - `packagePlatformPath`: A string of the form "." + Example: "python312Packages.numpy.x86_64-linux" + + - `packagePlatformAttr`: An attrs representation of a packagePlatformPath: + Example: { name = "python312Packages.numpy"; platform = "x86_64-linux"; } + */ + inherit (import ./utils.nix { inherit lib; }) + diff + groupByKernel + convertToPackagePlatformAttrs + groupByPlatform + extractPackageNames + getLabels + uniqueStrings + ; + + getAttrs = dir: builtins.fromJSON (builtins.readFile "${dir}/outpaths.json"); + beforeAttrs = getAttrs beforeResultDir; + afterAttrs = getAttrs afterResultDir; + + # Attrs + # - keys: "added", "changed" and "removed" + # - values: lists of `packagePlatformPath`s + diffAttrs = diff beforeAttrs afterAttrs; + + changed-paths = + let + rebuilds = uniqueStrings (diffAttrs.added ++ diffAttrs.changed); + rebuildsPackagePlatformAttrs = convertToPackagePlatformAttrs rebuilds; + + rebuildsByPlatform = groupByPlatform rebuildsPackagePlatformAttrs; + rebuildsByKernel = groupByKernel rebuildsPackagePlatformAttrs; + rebuildCountByKernel = lib.mapAttrs ( + kernel: kernelRebuilds: lib.length kernelRebuilds + ) rebuildsByKernel; + in + writeText "changed-paths.json" ( + builtins.toJSON { + attrdiff = lib.mapAttrs (_: extractPackageNames) diffAttrs; + inherit + rebuildsByPlatform + rebuildsByKernel + rebuildCountByKernel + ; + labels = + (getLabels rebuildCountByKernel) + # Adds "10.rebuild-*-stdenv" label if the "stdenv" attribute was changed + ++ lib.mapAttrsToList (kernel: _: "10.rebuild-${kernel}-stdenv") ( + lib.filterAttrs (_: kernelRebuilds: kernelRebuilds ? "stdenv") rebuildsByKernel + ); + } + ); +in +runCommand "compare" + { + nativeBuildInputs = [ jq ]; + } + '' + mkdir $out + + cp ${changed-paths} $out/changed-paths.json + + jq -r -f ${./generate-step-summary.jq} < ${changed-paths} > $out/step-summary.md + # TODO: Compare eval stats + '' diff --git a/ci/eval/compare/generate-step-summary.jq b/ci/eval/compare/generate-step-summary.jq new file mode 100644 index 0000000000000..961877cd27974 --- /dev/null +++ b/ci/eval/compare/generate-step-summary.jq @@ -0,0 +1,30 @@ +def truncate(xs; n): + if xs | length > n then xs[:n] + ["..."] + else xs + end; + +def itemize_packages(xs): + truncate(xs; 2000) | + map("- [\(.)](https://search.nixos.org/packages?channel=unstable&show=\(.)&from=0&size=50&sort=relevance&type=packages&query=\(.))") | + join("\n"); + +def get_title(s; xs): + s + " (" + (xs | length | tostring) + ")"; + +def section(title; xs): + "
" + get_title(title; xs) + "\n\n" + itemize_packages(xs) + "
"; + +def fallback_document(content; n): + if content | utf8bytelength > n then + get_title("Added packages"; .attrdiff.added) + "\n\n" + + get_title("Removed packages"; .attrdiff.removed) + "\n\n" + + get_title("Changed packages"; .attrdiff.changed) + else content + end; + +# we truncate the list to stay below the GitHub limit of 1MB per step summary. +fallback_document( + section("Added packages"; .attrdiff.added) + "\n\n" + + section("Removed packages"; .attrdiff.removed) + "\n\n" + + section("Changed packages"; .attrdiff.changed); 1000 * 1000 +) diff --git a/ci/eval/compare/utils.nix b/ci/eval/compare/utils.nix new file mode 100644 index 0000000000000..82ba64e06a173 --- /dev/null +++ b/ci/eval/compare/utils.nix @@ -0,0 +1,213 @@ +{ lib, ... }: +rec { + # Borrowed from https://github.com/NixOS/nixpkgs/pull/355616 + uniqueStrings = list: builtins.attrNames (builtins.groupBy lib.id list); + + /* + Converts a `packagePlatformPath` into a `packagePlatformAttr` + + Turns + "hello.aarch64-linux" + into + { + name = "hello"; + platform = "aarch64-linux"; + } + */ + convertToPackagePlatformAttr = + packagePlatformPath: + let + # python312Packages.numpy.aarch64-linux -> ["python312Packages" "numpy" "aarch64-linux"] + splittedPath = lib.splitString "." packagePlatformPath; + + # ["python312Packages" "numpy" "aarch64-linux"] -> ["python312Packages" "numpy"] + packagePath = lib.sublist 0 (lib.length splittedPath - 1) splittedPath; + + # "python312Packages.numpy" + name = lib.concatStringsSep "." packagePath; + in + if name == "" then + null + else + { + # python312Packages.numpy + inherit name; + + # "aarch64-linux" + platform = lib.last splittedPath; + }; + + /* + Converts a list of `packagePlatformPath`s into a list of `packagePlatformAttr`s + + Turns + [ + "hello.aarch64-linux" + "hello.x86_64-linux" + "hello.aarch64-darwin" + "hello.x86_64-darwin" + "bye.x86_64-darwin" + "bye.aarch64-darwin" + "release-checks" <- Will be dropped + ] + into + [ + { name = "hello"; platform = "aarch64-linux"; } + { name = "hello"; platform = "x86_64-linux"; } + { name = "hello"; platform = "aarch64-darwin"; } + { name = "hello"; platform = "x86_64-darwin"; } + { name = "bye"; platform = "aarch64-darwin"; } + { name = "bye"; platform = "x86_64-darwin"; } + ] + */ + convertToPackagePlatformAttrs = + packagePlatformPaths: + builtins.filter (x: x != null) (builtins.map convertToPackagePlatformAttr packagePlatformPaths); + + /* + Converts a list of `packagePlatformPath`s directly to a list of (unique) package names + + Turns + [ + "hello.aarch64-linux" + "hello.x86_64-linux" + "hello.aarch64-darwin" + "hello.x86_64-darwin" + "bye.x86_64-darwin" + "bye.aarch64-darwin" + ] + into + [ + "hello" + "bye" + ] + */ + extractPackageNames = + packagePlatformPaths: + let + packagePlatformAttrs = convertToPackagePlatformAttrs (uniqueStrings packagePlatformPaths); + in + uniqueStrings (builtins.map (p: p.name) packagePlatformAttrs); + + /* + Computes the key difference between two attrs + + { + added: [ ], + removed: [ ], + changed: [ ], + } + */ + diff = + let + filterKeys = cond: attrs: lib.attrNames (lib.filterAttrs cond attrs); + in + old: new: { + added = filterKeys (n: _: !(old ? ${n})) new; + removed = filterKeys (n: _: !(new ? ${n})) old; + changed = filterKeys ( + n: v: + # Filter out attributes that don't exist anymore + (new ? ${n}) + + # Filter out attributes that are the same as the new value + && (v != (new.${n})) + ) old; + }; + + /* + Group a list of `packagePlatformAttr`s by platforms + + Turns + [ + { name = "hello"; platform = "aarch64-linux"; } + { name = "hello"; platform = "x86_64-linux"; } + { name = "hello"; platform = "aarch64-darwin"; } + { name = "hello"; platform = "x86_64-darwin"; } + { name = "bye"; platform = "aarch64-darwin"; } + { name = "bye"; platform = "x86_64-darwin"; } + ] + into + { + aarch64-linux = [ "hello" ]; + x86_64-linux = [ "hello" ]; + aarch64-darwin = [ "hello" "bye" ]; + x86_64-darwin = [ "hello" "bye" ]; + } + */ + groupByPlatform = + packagePlatformAttrs: + let + packagePlatformAttrsByPlatform = builtins.groupBy (p: p.platform) packagePlatformAttrs; + extractPackageNames = map (p: p.name); + in + lib.mapAttrs (_: extractPackageNames) packagePlatformAttrsByPlatform; + + # Turns + # [ + # { name = "hello"; platform = "aarch64-linux"; } + # { name = "hello"; platform = "x86_64-linux"; } + # { name = "hello"; platform = "aarch64-darwin"; } + # { name = "hello"; platform = "x86_64-darwin"; } + # { name = "bye"; platform = "aarch64-darwin"; } + # { name = "bye"; platform = "x86_64-darwin"; } + # ] + # + # into + # + # { + # linux = [ "hello" ]; + # darwin = [ "hello" "bye" ]; + # } + groupByKernel = + packagePlatformAttrs: + let + filterKernel = + kernel: + builtins.attrNames ( + builtins.groupBy (p: p.name) ( + builtins.filter (p: lib.hasSuffix kernel p.platform) packagePlatformAttrs + ) + ); + in + lib.genAttrs [ "linux" "darwin" ] filterKernel; + + /* + Maps an attrs of `kernel - rebuild counts` mappings to a list of labels + + Turns + { + linux = 56; + darwin = 8; + } + into + [ + "10.rebuild-darwin: 1-10" + "10.rebuild-linux: 11-100" + ] + */ + getLabels = lib.mapAttrsToList ( + kernel: rebuildCount: + let + number = + if rebuildCount == 0 then + "0" + else if rebuildCount <= 10 then + "1-10" + else if rebuildCount <= 100 then + "11-100" + else if rebuildCount <= 500 then + "101-500" + else if rebuildCount <= 1000 then + "501-1000" + else if rebuildCount <= 2500 then + "1001-2500" + else if rebuildCount <= 5000 then + "2501-5000" + else + "5001+"; + + in + "10.rebuild-${kernel}: ${number}" + ); +} diff --git a/ci/eval/default.nix b/ci/eval/default.nix index ef107d4ce517a..927dec5a908dc 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -2,6 +2,7 @@ lib, runCommand, writeShellScript, + writeText, linkFarm, time, procps, @@ -48,7 +49,7 @@ let export NIX_STATE_DIR=$(mktemp -d) mkdir $out export GC_INITIAL_HEAP_SIZE=4g - command time -v \ + command time -f "Attribute eval done [%MKB max resident, %Es elapsed] %C" \ nix-instantiate --eval --strict --json --show-trace \ "$src/pkgs/top-level/release-attrpaths-superset.nix" \ -A paths \ @@ -246,35 +247,25 @@ let jq -s from_entries > $out/stats.json ''; - compare = - { beforeResultDir, afterResultDir }: - runCommand "compare" - { - nativeBuildInputs = [ - jq - ]; - } - '' - mkdir $out - jq -n -f ${./compare.jq} \ - --slurpfile before ${beforeResultDir}/outpaths.json \ - --slurpfile after ${afterResultDir}/outpaths.json \ - > $out/changed-paths.json - - jq -r -f ${./generate-step-summary.jq} < $out/changed-paths.json > $out/step-summary.md - # TODO: Compare eval stats - ''; + compare = import ./compare { + inherit + lib + jq + runCommand + writeText + supportedSystems + ; + }; full = { - # Whether to evaluate just a single system, by default all are evaluated - evalSystem ? if quickTest then "x86_64-linux" else null, + # Whether to evaluate on a specific set of systems, by default all are evaluated + evalSystems ? if quickTest then [ "x86_64-linux" ] else supportedSystems, # The number of attributes per chunk, see ./README.md for more info. chunkSize, quickTest ? false, }: let - systems = if evalSystem == null then supportedSystems else [ evalSystem ]; results = linkFarm "results" ( map (evalSystem: { name = evalSystem; @@ -282,7 +273,7 @@ let inherit quickTest evalSystem chunkSize; attrpathFile = attrpathsSuperset + "/paths.json"; }; - }) systems + }) evalSystems ); in combine { diff --git a/ci/eval/generate-step-summary.jq b/ci/eval/generate-step-summary.jq deleted file mode 100644 index 28597eaec371f..0000000000000 --- a/ci/eval/generate-step-summary.jq +++ /dev/null @@ -1,15 +0,0 @@ -def truncate(xs; n): - if xs | length > n then xs[:n] + ["..."] - else xs - end; - -def itemize_packages(xs): - # we truncate the list to stay below the GitHub limit of 1MB per step summary. - truncate(xs; 3000) | map("- [\(.)](https://search.nixos.org/packages?channel=unstable&show=\(.)&from=0&size=50&sort=relevance&type=packages&query=\(.))") | join("\n"); - -def section(title; xs): - "
" + title + " (" + (xs | length | tostring) + ")\n\n" + itemize_packages(xs) + "
"; - -section("Added packages"; .attrdiff.added) + "\n\n" + -section("Removed packages"; .attrdiff.removed) + "\n\n" + -section("Changed packages"; .attrdiff.changed)