From eccd9564abe5de9d9931f974dc0fe68887b73a96 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 18 May 2025 19:31:29 +0200 Subject: [PATCH] ci/eval: improve api when calling in steps Previously, `eval.full` organized the results for the supported systems in a specific layout, i.e. with a folder with one subfolder per system. Then, `eval.combine` relied on that. When using `eval.singleSystem` and `eval.combine` directly, the caller was responsible to recreate the same layout. This is annoying and error-prone to do, when downloading artifacts from CI to recreate some steps locally. With this change, all the artifacts can be downloaded and extracted into the same folder - because the result from `eval.singleSystem` already contains the / subfolder. --- .github/workflows/eval.yml | 2 ++ ci/eval/default.nix | 33 +++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/eval.yml b/.github/workflows/eval.yml index badef2f9af85..bec9c23de6a0 100644 --- a/.github/workflows/eval.yml +++ b/.github/workflows/eval.yml @@ -95,6 +95,7 @@ jobs: with: pattern: intermediate-* path: intermediate + merge-multiple: true - name: Check out the PR at the test merge commit uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -158,6 +159,7 @@ jobs: with: name: result path: targetResult + merge-multiple: true github-token: ${{ github.token }} run-id: ${{ steps.targetRunId.outputs.targetRunId }} diff --git a/ci/eval/default.nix b/ci/eval/default.nix index 4bd390307152..d2d4ebe0db67 100644 --- a/ci/eval/default.nix +++ b/ci/eval/default.nix @@ -3,7 +3,7 @@ runCommand, writeShellScript, writeText, - linkFarm, + symlinkJoin, time, procps, nixVersions, @@ -147,7 +147,7 @@ let chunkCount=$(( (attrCount - 1) / chunkSize + 1 )) echo "Chunk count: $chunkCount" - mkdir $out + mkdir -p $out/${evalSystem} # Record and print stats on free memory and swap in the background ( @@ -156,11 +156,11 @@ let freeSwap=$(free -b | grep Swap | awk '{print $4}') echo "Available memory: $(( availMemory / 1024 / 1024 )) MiB, free swap: $(( freeSwap / 1024 / 1024 )) MiB" - if [[ ! -f "$out/min-avail-memory" ]] || (( availMemory < $(<$out/min-avail-memory) )); then - echo "$availMemory" > $out/min-avail-memory + if [[ ! -f "$out/${evalSystem}/min-avail-memory" ]] || (( availMemory < $(<$out/${evalSystem}/min-avail-memory) )); then + echo "$availMemory" > $out/${evalSystem}/min-avail-memory fi - if [[ ! -f $out/min-free-swap ]] || (( availMemory < $(<$out/min-free-swap) )); then - echo "$freeSwap" > $out/min-free-swap + if [[ ! -f $out/${evalSystem}/min-free-swap ]] || (( availMemory < $(<$out/${evalSystem}/min-free-swap) )); then + echo "$freeSwap" > $out/${evalSystem}/min-free-swap fi sleep 4 done @@ -176,18 +176,18 @@ let mkdir "$chunkOutputDir"/{result,stats,timestats,stderr} seq -w 0 "$seq_end" | - command time -f "%e" -o "$out/total-time" \ + command time -f "%e" -o "$out/${evalSystem}/total-time" \ xargs -I{} -P"$cores" \ ${singleChunk} "$chunkSize" {} "$evalSystem" "$chunkOutputDir" - cp -r "$chunkOutputDir"/stats $out/stats-by-chunk + cp -r "$chunkOutputDir"/stats $out/${evalSystem}/stats-by-chunk if (( chunkSize * chunkCount != attrCount )); then # A final incomplete chunk would mess up the stats, don't include it rm "$chunkOutputDir"/stats/"$seq_end" fi - cat "$chunkOutputDir"/result/* > $out/paths + cat "$chunkOutputDir"/result/* > $out/${evalSystem}/paths ''; combine = @@ -247,14 +247,15 @@ let quickTest ? false, }: let - results = linkFarm "results" ( - map (evalSystem: { - name = evalSystem; - path = singleSystem { + results = symlinkJoin { + name = "results"; + paths = map ( + evalSystem: + singleSystem { inherit quickTest evalSystem chunkSize; - }; - }) evalSystems - ); + } + ) evalSystems; + }; in combine { resultsDir = results;