Skip to content

Commit 45dcfc2

Browse files
committed
Pin Paper benchmark object by hash
1 parent bd0f765 commit 45dcfc2

1 file changed

Lines changed: 31 additions & 23 deletions

File tree

.github/workflows/upstream-runtime-comparison.yml

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
PRODUCTION_CANDIDATE_SHA: c28db0146ec2f35eaf066b4202b33f08d06bbc4b
3030
PAPER_BUILD: "74"
3131
PAPER_SHA256: 1d70b1dab9cf4a6de615209a536f3a45a2186240253c428213ce2188ab95e5f7
32+
PAPER_ARTIFACT_SIZE: "52893229"
33+
PAPER_ARTIFACT_URL: https://fill-data.papermc.io/v1/objects/1d70b1dab9cf4a6de615209a536f3a45a2186240253c428213ce2188ab95e5f7/paper-26.1.2-74.jar
3234
COMPARE_RUNTIME_PROFILE: optimized-candidate
3335
EXPECTED_HARNESS_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
3436

@@ -192,32 +194,38 @@ jobs:
192194
PAPER_USER_AGENT: InteractionVisualizer-Upstream-Comparison/1.0 (https://github.com/EllanServer/InteractionVisualizer)
193195
run: |
194196
set -euo pipefail
195-
builds_url=https://fill.papermc.io/v3/projects/paper/versions/26.1.2/builds
196-
curl --fail --location --show-error --silent \
197-
--retry 10 --retry-all-errors --retry-max-time 300 --connect-timeout 30 \
198-
-H "User-Agent: $PAPER_USER_AGENT" \
199-
--output compare-dependencies/paper-builds.json "$builds_url"
200-
jq --argjson build "$PAPER_BUILD" --arg sha "$PAPER_SHA256" '
201-
[.[] | select(.id == $build)] as $selected
202-
| if ($selected | length) != 1 then error("Paper build is absent or duplicated") else $selected[0] end
203-
| if .channel != "STABLE" then error("Paper build is not STABLE") else . end
204-
| if .downloads["server:default"].name != "paper-26.1.2-74.jar"
205-
then error("Paper artifact name mismatch") else . end
206-
| if .downloads["server:default"].checksums.sha256 != $sha
207-
then error("Paper API SHA-256 mismatch") else . end
208-
' compare-dependencies/paper-builds.json \
209-
> compare-dependencies/paper-build-74.json
210-
paper_url=$(jq -r '.downloads["server:default"].url' \
211-
compare-dependencies/paper-build-74.json)
212-
paper_size=$(jq -r '.downloads["server:default"].size' \
213-
compare-dependencies/paper-build-74.json)
214-
[[ "$paper_url" == https://fill-data.papermc.io/* ]]
215-
[[ "$paper_size" =~ ^[0-9]+$ ]] && (( paper_size > 0 ))
197+
expected_url="https://fill-data.papermc.io/v1/objects/$PAPER_SHA256/paper-26.1.2-74.jar"
198+
[[ "$PAPER_ARTIFACT_URL" == "$expected_url" ]]
199+
[[ "$PAPER_ARTIFACT_SIZE" =~ ^[0-9]+$ ]] && (( PAPER_ARTIFACT_SIZE > 0 ))
200+
python3 - compare-dependencies/paper-build-74.json \
201+
"$PAPER_BUILD" "$PAPER_SHA256" "$PAPER_ARTIFACT_SIZE" \
202+
"$PAPER_ARTIFACT_URL" <<'PY'
203+
from pathlib import Path
204+
import json
205+
import sys
206+
207+
output, build, sha, size, url = sys.argv[1:]
208+
Path(output).write_text(json.dumps({
209+
"id": int(build),
210+
"time": "2026-07-06T16:51:09Z",
211+
"channel": "STABLE",
212+
"commits": [],
213+
"downloads": {
214+
"server:default": {
215+
"name": "paper-26.1.2-74.jar",
216+
"checksums": {"sha256": sha},
217+
"size": int(size),
218+
"url": url,
219+
}
220+
},
221+
"metadataSource": "pinned-from-verified-Paper-build-74-response",
222+
}, indent=2) + "\n", encoding="utf-8")
223+
PY
216224
curl --fail --location --show-error \
217225
--retry 10 --retry-all-errors --retry-max-time 300 --connect-timeout 30 \
218226
-H "User-Agent: $PAPER_USER_AGENT" \
219-
--output compare-dependencies/paper.jar "$paper_url"
220-
[[ "$(stat -c '%s' compare-dependencies/paper.jar)" == "$paper_size" ]]
227+
--output compare-dependencies/paper.jar "$PAPER_ARTIFACT_URL"
228+
[[ "$(stat -c '%s' compare-dependencies/paper.jar)" == "$PAPER_ARTIFACT_SIZE" ]]
221229
printf '%s %s\n' "$PAPER_SHA256" compare-dependencies/paper.jar \
222230
| sha256sum --check --strict
223231

0 commit comments

Comments
 (0)