mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
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 <system-name>/ subfolder.
This commit is contained in:
parent
82396d1f48
commit
eccd9564ab
2 changed files with 19 additions and 16 deletions
2
.github/workflows/eval.yml
vendored
2
.github/workflows/eval.yml
vendored
|
@ -95,6 +95,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
pattern: intermediate-*
|
pattern: intermediate-*
|
||||||
path: intermediate
|
path: intermediate
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Check out the PR at the test merge commit
|
- name: Check out the PR at the test merge commit
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
@ -158,6 +159,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: result
|
name: result
|
||||||
path: targetResult
|
path: targetResult
|
||||||
|
merge-multiple: true
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
run-id: ${{ steps.targetRunId.outputs.targetRunId }}
|
run-id: ${{ steps.targetRunId.outputs.targetRunId }}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
runCommand,
|
runCommand,
|
||||||
writeShellScript,
|
writeShellScript,
|
||||||
writeText,
|
writeText,
|
||||||
linkFarm,
|
symlinkJoin,
|
||||||
time,
|
time,
|
||||||
procps,
|
procps,
|
||||||
nixVersions,
|
nixVersions,
|
||||||
|
@ -147,7 +147,7 @@ let
|
||||||
chunkCount=$(( (attrCount - 1) / chunkSize + 1 ))
|
chunkCount=$(( (attrCount - 1) / chunkSize + 1 ))
|
||||||
echo "Chunk count: $chunkCount"
|
echo "Chunk count: $chunkCount"
|
||||||
|
|
||||||
mkdir $out
|
mkdir -p $out/${evalSystem}
|
||||||
|
|
||||||
# Record and print stats on free memory and swap in the background
|
# 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}')
|
freeSwap=$(free -b | grep Swap | awk '{print $4}')
|
||||||
echo "Available memory: $(( availMemory / 1024 / 1024 )) MiB, free swap: $(( freeSwap / 1024 / 1024 )) MiB"
|
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
|
if [[ ! -f "$out/${evalSystem}/min-avail-memory" ]] || (( availMemory < $(<$out/${evalSystem}/min-avail-memory) )); then
|
||||||
echo "$availMemory" > $out/min-avail-memory
|
echo "$availMemory" > $out/${evalSystem}/min-avail-memory
|
||||||
fi
|
fi
|
||||||
if [[ ! -f $out/min-free-swap ]] || (( availMemory < $(<$out/min-free-swap) )); then
|
if [[ ! -f $out/${evalSystem}/min-free-swap ]] || (( availMemory < $(<$out/${evalSystem}/min-free-swap) )); then
|
||||||
echo "$freeSwap" > $out/min-free-swap
|
echo "$freeSwap" > $out/${evalSystem}/min-free-swap
|
||||||
fi
|
fi
|
||||||
sleep 4
|
sleep 4
|
||||||
done
|
done
|
||||||
|
@ -176,18 +176,18 @@ let
|
||||||
mkdir "$chunkOutputDir"/{result,stats,timestats,stderr}
|
mkdir "$chunkOutputDir"/{result,stats,timestats,stderr}
|
||||||
|
|
||||||
seq -w 0 "$seq_end" |
|
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" \
|
xargs -I{} -P"$cores" \
|
||||||
${singleChunk} "$chunkSize" {} "$evalSystem" "$chunkOutputDir"
|
${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
|
if (( chunkSize * chunkCount != attrCount )); then
|
||||||
# A final incomplete chunk would mess up the stats, don't include it
|
# A final incomplete chunk would mess up the stats, don't include it
|
||||||
rm "$chunkOutputDir"/stats/"$seq_end"
|
rm "$chunkOutputDir"/stats/"$seq_end"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat "$chunkOutputDir"/result/* > $out/paths
|
cat "$chunkOutputDir"/result/* > $out/${evalSystem}/paths
|
||||||
'';
|
'';
|
||||||
|
|
||||||
combine =
|
combine =
|
||||||
|
@ -247,14 +247,15 @@ let
|
||||||
quickTest ? false,
|
quickTest ? false,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
results = linkFarm "results" (
|
results = symlinkJoin {
|
||||||
map (evalSystem: {
|
name = "results";
|
||||||
name = evalSystem;
|
paths = map (
|
||||||
path = singleSystem {
|
evalSystem:
|
||||||
|
singleSystem {
|
||||||
inherit quickTest evalSystem chunkSize;
|
inherit quickTest evalSystem chunkSize;
|
||||||
|
}
|
||||||
|
) evalSystems;
|
||||||
};
|
};
|
||||||
}) evalSystems
|
|
||||||
);
|
|
||||||
in
|
in
|
||||||
combine {
|
combine {
|
||||||
resultsDir = results;
|
resultsDir = results;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue