Merge pull request #390 from ludovic111/feat/version-port-agent
🤖 Agent: merged (version-port tooling, rebased on main). Ludovic asked on 10-21 to clear the PR queue.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!-- The daily version port (docs/version-ports.md, "Detect"). A template: @HOME@ becomes the home folder when it is
|
||||
installed; not installed until Ludovic approves (see the doc for how to turn it on). 16:00 in Zurich is 14:00
|
||||
UTC in summer and 15:00 UTC in winter, after Mojang's usual release hours. -->
|
||||
<plist version="1.0"><dict>
|
||||
<key>Label</key><string>dev.horizon.version-port</string>
|
||||
<key>ProgramArguments</key><array>
|
||||
<string>/bin/bash</string><string>@HOME@/code/horizon-parity/version-port-daily.sh</string>
|
||||
</array>
|
||||
<key>StartCalendarInterval</key><dict><key>Hour</key><integer>16</integer><key>Minute</key><integer>0</integer></dict>
|
||||
<key>LowPriorityIO</key><true/>
|
||||
<key>Nice</key><integer>10</integer>
|
||||
<key>StandardOutPath</key><string>@HOME@/Library/Logs/horizon-version-port.log</string>
|
||||
<key>StandardErrorPath</key><string>@HOME@/Library/Logs/horizon-version-port.log</string>
|
||||
<key>EnvironmentVariables</key><dict>
|
||||
<key>HOME</key><string>@HOME@</string>
|
||||
<key>PATH</key><string>@HOME@/.local/bin:@HOME@/.cargo/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
||||
<key>HORIZON_PORT_KIRA_CARD</key><string>28</string>
|
||||
</dict>
|
||||
</dict></plist>
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# Daily on the Mac mini, from launchd (tools/ci/dev.horizon.version-port.plist; docs/version-ports.md, "Detect"):
|
||||
# when Mojang releases a Minecraft version Horizon doesn't pin, port it as far as the report: prepare, diff,
|
||||
# regen (ports/NEW on the local branch port/NEW), every harness against it, the report, and publish's dry run.
|
||||
# It never publishes (version_port.py publish --yes stays a person's call) and never pushes.
|
||||
#
|
||||
# It runs from a copy taken from main, never from a checkout (it updates its own worktree of origin/main):
|
||||
# curl -fsSL https://raw.githubusercontent.com/ludovic111/horizon/main/tools/ci/version-port-daily.sh \
|
||||
# -o ~/code/horizon-parity/version-port-daily.sh
|
||||
#
|
||||
# HORIZON_REPO the clone to make the worktree from (default ~/code/horizon)
|
||||
# HORIZON_PORT_MAIN the worktree of origin/main it works in (default ~/code/horizon-parity/port-main)
|
||||
# HORIZON_PORT_REF what that worktree checks out (default origin/main)
|
||||
# HORIZON_PORT_VERSION=V port release V now, without asking Mojang what is new (by hand, or to replay one)
|
||||
# HORIZON_PORT_SNAPSHOTS=1 snapshots too: prepared, diffed and reported only (no regen, no harnesses)
|
||||
# HORIZON_PORT_KIRA_CARD=N post a note on Kira card N when a port report is ready
|
||||
set -euo pipefail
|
||||
repo=${HORIZON_REPO:-$HOME/code/horizon}
|
||||
root=${HORIZON_PORT_MAIN:-$HOME/code/horizon-parity/port-main}
|
||||
ref=${HORIZON_PORT_REF:-origin/main}
|
||||
shared=$HOME/code/horizon-parity/shared-local
|
||||
log() { echo "$(date -u +%FT%TZ) $*"; }
|
||||
|
||||
if [ ! -e "$root/.git" ]; then
|
||||
git -C "$repo" fetch -q origin
|
||||
git -C "$repo" worktree add -q --detach "$root" "$ref"
|
||||
fi
|
||||
cd "$root"
|
||||
git fetch -q origin
|
||||
git checkout -q --detach "$ref"
|
||||
if [ ! -d .local ]; then
|
||||
mkdir .local
|
||||
for d in minecraft horizon-client tools datagen; do ln -s "$shared/$d" ".local/$d"; done
|
||||
fi
|
||||
# shellcheck disable=SC1091
|
||||
source "$HOME/code/horizon-parity/env.sh"
|
||||
|
||||
# --dry-run: what is new is remembered (versions/detect-state.json) only once its port went through, so a port
|
||||
# that fails is tried again the next day.
|
||||
if [ -n "${HORIZON_PORT_VERSION:-}" ]; then
|
||||
kind=release new=$HORIZON_PORT_VERSION
|
||||
else
|
||||
set +e
|
||||
python3 tools/version_port.py detect --dry-run ${HORIZON_PORT_SNAPSHOTS:+--snapshots} > "$root/.local/detect.txt"
|
||||
found=$?
|
||||
set -e
|
||||
cat "$root/.local/detect.txt"
|
||||
case $found in
|
||||
0) exit 0 ;;
|
||||
10) kind=release ;;
|
||||
11) kind=snapshot ;;
|
||||
*) log "detect failed ($found)"; exit "$found" ;;
|
||||
esac
|
||||
new=$(sed -n "s/^New $kind: \([^ ]*\) .*/\1/p" "$root/.local/detect.txt" | head -1)
|
||||
fi
|
||||
old=$(python3 -c 'import json; print(json.load(open("research-lock.json"))["minecraft"]["version"])')
|
||||
log "Minecraft $new ($kind) is out; Horizon pins $old"
|
||||
|
||||
if [ "$kind" = snapshot ]; then
|
||||
python3 tools/version_port.py port "$new" --no-regen
|
||||
else
|
||||
python3 tools/version_port.py port "$new" # prepare both, diff, regen, report
|
||||
# The baseline: every harness on main against the pinned version (what passed before is not rerun).
|
||||
python3 tools/parity.py > "$root/.local/baseline.log" 2>&1 || true
|
||||
python3 tools/version_port.py harnesses "$new" --old "$old" --baseline .local/parity-runner/state.json
|
||||
python3 tools/version_port.py report "$old" "$new" --lines 30
|
||||
python3 tools/version_port.py publish "$old" "$new" --check-github --show 0
|
||||
fi
|
||||
[ -n "${HORIZON_PORT_VERSION:-}" ] || python3 tools/version_port.py detect ${HORIZON_PORT_SNAPSHOTS:+--snapshots} > /dev/null || true
|
||||
report=${HORIZON_VERSIONS:-$HOME/code/horizon-parity/versions}/diff-$old-$new/report.md
|
||||
log "Port report: $report"
|
||||
if [ -n "${HORIZON_PORT_KIRA_CARD:-}" ]; then
|
||||
text="Minecraft $new ($kind) is out. Port report ready on the Mac mini ($report); publish's dry run is in the log."
|
||||
node "$HOME/code/horizon-parity/tools/kira.mjs" card_note \
|
||||
"$(python3 -c 'import json,sys; print(json.dumps({"ref": "card " + sys.argv[1], "text": sys.argv[2]}))' \
|
||||
"$HORIZON_PORT_KIRA_CARD" "$text")" > /dev/null || true
|
||||
fi
|
||||
Reference in New Issue
Block a user