Skip to content

Commit 33a7d50

Browse files
ci: add temporary Nix HTTP/2 download experiment
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
1 parent d245b58 commit 33a7d50

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Temporary A/B experiment for the Nix HTTP 416 substitution flake. Do not merge.
2+
name: Nix HTTP/2 Experiment
3+
4+
on:
5+
push:
6+
branches:
7+
- "ci/cachix-download-flake/**"
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
fetch:
18+
name: fetch (shard ${{ matrix.shard }})
19+
runs-on: ubuntu-24.04
20+
timeout-minutes: 120
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
25+
env:
26+
ITERATIONS: "3"
27+
SHARD: ${{ matrix.shard }}
28+
steps:
29+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30+
with:
31+
persist-credentials: false
32+
33+
- uses: ./.github/actions/setup-nix
34+
35+
- name: Fetch the test-runner closure into fresh stores, alternating http2
36+
run: |
37+
set -uo pipefail
38+
nix config show | grep -E '^(http2|http-connections|download-attempts|substituters|download-buffer-size) ' || true
39+
out="$(nix eval --raw .#openshell-test-runner.outPath)"
40+
echo "closure: $out"
41+
sudo mkdir -p /mnt/exp && sudo chown "$(id -u):$(id -g)" /mnt/exp
42+
mkdir -p results/logs
43+
echo "shard,iteration,arm,http2,rc,seconds,resumes,eof416,range_err,terminal,started" > results/summary.csv
44+
if [ $((SHARD % 2)) -eq 0 ]; then arms="h2 h1"; else arms="h1 h2"; fi
45+
for i in $(seq 1 "$ITERATIONS"); do
46+
for arm in $arms; do
47+
if [ "$arm" = h2 ]; then h2=true; else h2=false; fi
48+
root="/mnt/exp/store-$i-$arm"
49+
log="results/logs/$i-$arm.log"
50+
started="$(date -u +%FT%TZ)"
51+
start=$(date +%s)
52+
nix build --no-link --max-jobs 0 --store "local?root=$root" \
53+
--option http2 "$h2" --option fallback false \
54+
--option substituters "https://openshell.cachix.org https://cache.nixos.org" \
55+
--option trusted-public-keys "openshell.cachix.org-1:OAr5MunsfH5PZvUsfD08OtGx5RtcwdNZGJdU5FqLm5w= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" \
56+
"$out" > "$log" 2>&1
57+
rc=$?
58+
secs=$(( $(date +%s) - start ))
59+
resumes=$(grep -c 'retrying from offset' "$log")
60+
e416=$(grep -c 'HTTP error 416' "$log")
61+
rerr=$(grep -c 'Requested range was not delivered' "$log")
62+
term=$(grep -c "^error: unable to download" "$log")
63+
echo "$SHARD,$i,$arm,$h2,$rc,$secs,$resumes,$e416,$rerr,$term,$started" >> results/summary.csv
64+
grep -E 'unable to download|no substituter|will be fetched|could not be realised' "$log" | sed "s/^/[$i $arm] /" || true
65+
chmod -R u+w "$root" 2>/dev/null; rm -rf "$root"
66+
# Keep only the interesting lines to bound artifact size.
67+
grep -E 'unable to download|no substituter|will be fetched|error' "$log" > "$log.tmp"; mv "$log.tmp" "$log"
68+
done
69+
done
70+
cat results/summary.csv
71+
{
72+
echo '```'
73+
cat results/summary.csv
74+
echo '```'
75+
} >> "$GITHUB_STEP_SUMMARY"
76+
77+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
78+
if: always()
79+
with:
80+
name: nix-http2-experiment-${{ matrix.shard }}
81+
path: results

0 commit comments

Comments
 (0)