Package only quest journal classes and artwork for retained builds
Some checks failed
DuneRealms Plugin CI / plugins (push) Failing after 10m24s
Quest Arc Presentation Overlay / quest-story-arcs (push) Successful in 1m20s

This commit is contained in:
unimatrixgit 2026-12-05 07:31:45 +01:00
commit c35522facd
2 changed files with 97 additions and 12 deletions

View file

@ -0,0 +1,51 @@
name: Quest Arc Presentation Overlay
on:
workflow_dispatch:
push:
branches: ['feat/quest-story-arcs-*']
jobs:
quest-story-arcs:
runs-on: dune-ci
steps:
- name: Check out exact revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/plugins.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '9.2.1'
- name: Test the journal and package only quest arc classes and art
shell: bash
run: |
set -euo pipefail
gradle --no-daemon -p DuneRealmsGUI test jar
mkdir quest-story-arcs
PYTHONPATH=tools python3 - <<'PY'
from pathlib import Path
from quest_arc_artwork import CATALOG, OVERLAY, artwork, gui_entries
from plugin_wild_update import read_archive, write_archive
source = read_archive(Path("DuneRealmsGUI/build/libs/DunerealmsGUI.jar").read_bytes())
Path("quest-story-arcs/donor.zip").write_bytes(write_archive({entry: source[entry] for entry in gui_entries()}))
assets = artwork(Path("."))
art = {f"{OVERLAY}/{name}": data for name, data in assets.items()}
art[CATALOG] = Path(CATALOG).read_bytes()
Path("quest-story-arcs/artwork.zip").write_bytes(write_archive(art))
PY
cp tools/{quest_arc_artwork.py,plugin_wild_update.py} quest-story-arcs/
printf '%s\n' "$GITHUB_SHA" > quest-story-arcs/SOURCE_COMMIT
(cd quest-story-arcs && sha256sum -- *.zip *.py SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Quest-Story-Arcs
path: quest-story-arcs
if-no-files-found: error

View file

@ -10,6 +10,18 @@ NETWORK_SHA256 = "8a1bd9c2784be4231ffd2f29e9dbcb43a04eb69a5c14966077084a916769fd
ASSETS = "assets/dunerealms/"
CATALOG = "DuneRealmsGUI/src/main/resources/quest-categories.json"
OVERLAY = "network/resource-pack/central/overlay"
GUI_PREFIX = "com/dunerealms/gui/"
GUI_CHANGED = ("QuestMenus.class", "QuestMenus$JournalView.class")
GUI_ADDED = ("QuestCategories.class", "QuestCategories$Category.class", "QuestCategories$Group.class")
GUI_CATALOG = "quest-categories.json"
GUI_BASELINES = {
"e015af5c7f063b4ec2be51ce586376cf3a350be4dfa832032a027e8d9513b429",
"19157b96c1802ece522e0560020a93ec87ca78815c7a823406ac61650c999e5d",
}
MENU_BASELINES = {
"75bf2b32df6f516079c8ef53c49e58db7fc415e7306043073ca378988a7c4838",
"4f5a9f9c4ddb4f0c76e3d7565aa4ba58064b18ee6675ba9400f855a9329e81fd",
}
MENU_PREFIX = "menu-art/pack/"
@ -42,22 +54,42 @@ def artwork(source):
return paths
def assemble(source, baseline, output, target, baseline_sha=None):
def gui_entries():
return [*(GUI_PREFIX + name for name in (*GUI_CHANGED, *GUI_ADDED)), GUI_CATALOG]
def assemble(source, baseline, output, target, baseline_sha=None, donor=None, donor_sha=None):
existing = baseline.read_bytes()
if digest(existing) != (NETWORK_SHA256 if target == "network" else baseline_sha):
accepted = {"network": {NETWORK_SHA256}, "menus": MENU_BASELINES, "gui": GUI_BASELINES}
actual = digest(existing)
if actual not in accepted[target] or baseline_sha is not None and actual != baseline_sha:
raise ValueError("Unexpected retained archive checksum")
base = read_archive(existing)
added = artwork(source)
if target == "menus":
if "com/dunerealms/menus/MenuArt.class" not in base:
raise ValueError("Expected the retained DuneMenus artwork resolver")
added = {MENU_PREFIX + name: contents for name, contents in added.items()}
if set(added) & set(base):
raise ValueError("Quest artwork already exists in the retained archive")
base.update(added)
if target == "gui":
compiled = donor.read_bytes()
if digest(compiled) != donor_sha:
raise ValueError("Unexpected quest journal donor checksum")
payload = read_archive(compiled)
if set(payload) != set(gui_entries()) or payload[GUI_CATALOG] != (source / CATALOG).read_bytes():
raise ValueError("Unexpected quest journal donor entries")
expected_overlap = {GUI_PREFIX + name for name in GUI_CHANGED}
if set(payload) & set(base) != expected_overlap:
raise ValueError("Unexpected existing quest journal entries")
base.update(payload)
count = len(payload)
else:
added = artwork(source)
if target == "menus":
if "com/dunerealms/menus/MenuArt.class" not in base:
raise ValueError("Expected the retained DuneMenus artwork resolver")
added = {MENU_PREFIX + name: contents for name, contents in added.items()}
if set(added) & set(base):
raise ValueError("Quest artwork already exists in the retained archive")
base.update(added)
count = len(added)
with output.open("xb") as candidate:
candidate.write(write_archive(base))
print(f"{target}: added {len(added)} files, SHA256 {digest(output.read_bytes())}")
print(f"{target}: applied {count} files, SHA256 {digest(output.read_bytes())}")
if __name__ == "__main__":
@ -65,6 +97,8 @@ if __name__ == "__main__":
parser.add_argument("source", type=Path)
parser.add_argument("baseline", type=Path)
parser.add_argument("output", type=Path)
parser.add_argument("target", choices=("network", "menus"))
parser.add_argument("target", choices=("network", "menus", "gui"))
parser.add_argument("--baseline-sha")
parser.add_argument("--donor", type=Path)
parser.add_argument("--donor-sha")
assemble(**vars(parser.parse_args()))