Compare commits

...
Author SHA1 Message Date
maxjivi05 00c0c6174e fix(gog): create ISI savePath folders on first launch 2026-11-29 22:16:52 -05:00
LarzVaderandKurt Himebauch 57055be6fb fix(ci): Robolectric's jar cache is saved again, and a Maven 429 runs the unit tests again (#3418)
* fix(ci): Robolectric's jar cache is saved again, and a Maven 429 runs the unit tests again

* fix(ci): retry Gradle artifact download rate limits too

* fix(ci): restrict Maven retry to dependency download exceptions

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
2026-11-29 21:13:54 -05:00
5 changed files with 194 additions and 14 deletions

No files matched your search

+17 -5
View File
@@ -740,7 +740,8 @@ jobs:
echo "version=$(grep -o "org.robolectric:robolectric:[0-9.]*" app/build.gradle | cut -d: -f3)" >> "$GITHUB_OUTPUT"
# Robolectric downloads these from Maven Central on first use without retrying, and 429s fail whole test classes.
# The cache path sits beside the workspace because runner homes are at different depths from it, and
# actions/cache stores paths relative to the workspace. Runners that keep their own ~/.m2 skip the cache.
# actions/cache stores paths relative to the workspace. It is passed as an absolute path: the save action rejects
# "..". Runners that keep their own ~/.m2 skip the cache.
- name: Place Robolectric's Android jars beside the workspace
id: robolectric-jars
run: |
@@ -751,7 +752,9 @@ jobs:
echo "cache=false" >> "$GITHUB_OUTPUT"
else
mkdir -p "$jars" "$(dirname "$m2")"
ln -sfn "$(cd "$jars" && pwd)" "$m2"
jars=$(cd "$jars" && pwd)
ln -sfn "$jars" "$m2"
echo "path=$jars" >> "$GITHUB_OUTPUT"
echo "cache=true" >> "$GITHUB_OUTPUT"
fi
- name: Restore Robolectric's Android jars
@@ -759,7 +762,7 @@ jobs:
if: steps.robolectric-jars.outputs.cache == 'true'
uses: actions/cache/restore@v4
with:
path: ../robolectric-jars
path: ${{ steps.robolectric-jars.outputs.path }}
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
restore-keys: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-
- name: Count the restored Robolectric jars
@@ -773,7 +776,16 @@ jobs:
run: |
set -o pipefail
mkdir -p app/build
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log
# A Maven 429 fails every test class that needs the missing jar. The jars an attempt did get stay for the next.
for wait in 60 180 0; do
status=0
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log || status=$?
if [ "$status" = 0 ] || [ "$wait" = 0 ] || ! grep -Eq '^[[:space:]]*(Caused by: org\.gradle\.internal\.resource\.transport\.http\.HttpErrorStatusCodeException: Could not GET .*https://repo\.maven\.apache\.org/.*Received status code 429 from server|Caused by: java\.io\.IOException: Server returned HTTP response code: 429 for URL: https://repo\.maven\.apache\.org/)' app/build/unit-tests.log; then
exit "$status"
fi
echo "::warning::Maven Central answered 429; running the unit tests again in ${wait}s"
sleep "$wait"
done
# actions/cache only saves when the job succeeds, so a run whose tests died on a Maven 429 never filled the cache.
# Save the complete jars even after a failed test step, when this run added some; a partial download is dropped first.
@@ -800,7 +812,7 @@ jobs:
if: always() && steps.robolectric-jars-final.outputs.save == 'true'
uses: actions/cache/save@v4
with:
path: ../robolectric-jars
path: ${{ steps.robolectric-jars.outputs.path }}
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
- name: Upload unit test diagnostics
+8 -6
View File
@@ -252,13 +252,15 @@ self-extractor stops at "Path not found", so the values it installs are applied
`goggame-<id>.info`, and a script's own `setRegistry` entries always win over the built-in table.
The script's `supportData` actions run right after: files and folders from the game folder
(`{app}`) or its support files (`{supportDir}`, `support/<id>/`) are copied to `{userdocs}` and
`{localappdata}` in the prefix, and `type: folder` without a source creates the folder. Mods such
as one-click editions ship their `Plugins.txt` and INI files this way. Paths match without regard
(`{app}`) or its support files (`{supportDir}`, `support/<id>/`) are copied to `{userdocs}`,
`{localappdata}` or `{userappdata}` in the prefix, and `type: folder` without a source creates the
folder. Mods such as one-click editions ship their `Plugins.txt` and INI files this way. The
`savePath` action's `savePath` folder is created with the same path rules, including the common
case where a one-click edition names it again as a `supportData` folder. Paths match without regard
to case, links are copied as links, and a path outside those folders is refused. A file the
player already has is replaced only when the action says `overwrite`. `.droiddeck-gog-support` in
the prefix holds the actions' hash, so they run once per script revision and a player's later
edits stay.
player already has is replaced only when the action says `overwrite`. `.droiddeck-gog-support` and
`.droiddeck-gog-save-path` in the prefix hold the actions' hashes, so they run once per script
revision and a player's later edits stay.
A GOG game's exe comes from its own manifest first: `goggame-<id>.info`'s play task in category
`game` (`isPrimary` first), or a primary `launcher` task for launcher games, whose `path` stays
@@ -968,6 +968,7 @@ def prepare_gog(sidecar, compat_data, launch_dir):
GOG_SCRIPTS = "goggame-*.script"
GOG_REGISTRY_MARK = ".droiddeck-gog-registry"
GOG_SUPPORT_MARK = ".droiddeck-gog-support"
GOG_SAVE_PATH_MARK = ".droiddeck-gog-save-path"
GOG_ROOTS = {"HKEY_LOCAL_MACHINE": "HKEY_LOCAL_MACHINE", "HKLM": "HKEY_LOCAL_MACHINE",
"HKEY_CURRENT_USER": "HKEY_CURRENT_USER", "HKCU": "HKEY_CURRENT_USER",
"HKEY_CLASSES_ROOT": "HKEY_CLASSES_ROOT", "HKCR": "HKEY_CLASSES_ROOT"}
@@ -1716,7 +1717,7 @@ def prepare_steam_ea(argv, compat_data, launch_dir):
return REPLACED
def gog_support_actions(folder):
def gog_script_actions(folder, name):
found = []
for script in sorted(Path(folder).glob(GOG_SCRIPTS)):
product = script.name[len("goggame-"):-len(".script")]
@@ -1726,17 +1727,22 @@ def gog_support_actions(folder):
continue
for action in actions if isinstance(actions, list) else []:
install = action.get("install") if isinstance(action, dict) else None
if isinstance(install, dict) and install.get("action") == "supportData" \
if isinstance(install, dict) and install.get("action") == name \
and isinstance(install.get("arguments"), dict):
found.append((product, install["arguments"]))
return found
def gog_support_actions(folder):
return gog_script_actions(folder, "supportData")
def gog_support_bases(folder, product, pfx):
user = Path(pfx) / "drive_c" / "users" / "steamuser"
support = Path(folder) / "support" / product
return {"app": Path(folder), "supportdir": support, "support": support,
"userdocs": user / "Documents", "localappdata": user / "AppData" / "Local"}
"userdocs": user / "Documents", "localappdata": user / "AppData" / "Local",
"userappdata": user / "AppData" / "Roaming"}
def gog_inside(path, base):
@@ -1830,6 +1836,44 @@ def gog_support_data(folder, compat_data, proton):
return "copied=%d%s" % (copied, note)
def gog_save_paths(folder, compat_data, proton):
actions = gog_script_actions(folder, "savePath")
if not actions:
return "none"
pfx = Path(compat_data) / "pfx" if compat_data else None
if not pfx or not (pfx / "drive_c" / "users" / "steamuser").is_dir():
made = create_prefix(compat_data, proton)
if made not in ("present", "created") or not (pfx / "drive_c" / "users" / "steamuser").is_dir():
return "no-prefix"
stamp = hashlib.sha256(json.dumps(actions, sort_keys=True).encode("utf-8")).hexdigest()
marker = pfx / GOG_SAVE_PATH_MARK
try:
if marker.is_file() and marker.read_text() == stamp:
return "ready"
except OSError:
pass
paths = skipped = 0
for product, arguments in actions:
bases = gog_support_bases(folder, product, pfx)
found = gog_support_path(arguments.get("savePath") or arguments.get("target"), bases)
if found is None:
skipped += 1
continue
target, _root = found
try:
target.mkdir(parents=True, exist_ok=True)
paths += 1
except OSError:
skipped += 1
note = " skipped=%d" % skipped if skipped else ""
if not skipped:
try:
marker.write_text(stamp)
except OSError:
pass
return "paths=%d%s" % (paths, note)
def main(argv):
if os.environ.get("DROIDDECK_GOG_MAINTENANCE") == "1":
return 0
@@ -1876,6 +1920,7 @@ def main(argv):
prepare_gog(sidecar, compat_data, launch_dir)
log("gog registry: " + apply_gog_registry(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
log("gog support data: " + gog_support_data(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
log("gog save paths: " + gog_save_paths(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
if store == "rockstar":
if game not in ROCKSTAR_TITLES and not rockstar_sdk(folder, sidecar):
if compat_data:
+22
View File
@@ -24,6 +24,28 @@ class CiChecksTest(unittest.TestCase):
gradle = (ROOT / 'app/build.gradle').read_text()
self.assertIn("gitValue(['show', '-s', '--format=%ct', '--end-of-options', sourceCommit])", gradle)
def test_robolectric_cache_saves_and_restores_the_same_absolute_path(self):
steps = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs']['build']['steps']
caches = [step['with'] for step in steps if step.get('uses', '').startswith('actions/cache')]
for cache in caches:
for path in cache['path'].split('\n'):
self.assertNotIn('..', path.split('/'))
robolectric = [cache['path'] for cache in caches if cache['key'].startswith('robolectric-')]
self.assertEqual(robolectric, ['${{ steps.robolectric-jars.outputs.path }}'] * 2)
def test_unit_test_retry_requires_maven_exception(self):
steps = yaml.safe_load((ROOT / '.github/workflows/build.yml').read_text())['jobs']['build']['steps']
run = next(step['run'] for step in steps if step.get('id') == 'unit-tests')
line = next(line for line in run.splitlines() if 'grep -Eq' in line)
pattern = shlex.split(line)[shlex.split(line).index('-Eq') + 1]
for log, expected in (
("Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not GET 'https://repo.maven.apache.org/maven2/a.jar'. Received status code 429 from server: Too Many Requests", 0),
("Caused by: java.io.IOException: Server returned HTTP response code: 429 for URL: https://repo.maven.apache.org/maven2/a.jar", 0),
("SomeTest > test FAILED: Too Many Requests", 1),
("Caused by: java.lang.AssertionError: HTTP 429", 1),
):
self.assertEqual(subprocess.run(['grep', '-Eq', pattern], input=log, text=True).returncode, expected)
def test_report_comment_lookup_ignores_human_marker(self):
if not shutil.which('jq'):
self.skipTest('jq required to execute comment selection')
+99
View File
@@ -626,6 +626,10 @@ def support_data(**arguments):
return {'install': {'action': 'supportData', 'arguments': arguments}, 'name': 'supportData'}
def save_path(**arguments):
return {'install': {'action': 'savePath', 'arguments': arguments}, 'name': 'saveFolders'}
class GogSupportData(unittest.TestCase):
def prefix(self, root):
user = Path(root) / 'compat/pfx/drive_c/users/steamuser'
@@ -809,6 +813,101 @@ class GogSupportData(unittest.TestCase):
self.assertTrue((Path(root) / 'compat/pfx/drive_c/users/steamuser/Documents/My Games/G').is_dir())
class GogSavePaths(unittest.TestCase):
def prefix(self, root):
user = Path(root) / 'compat/pfx/drive_c/users/steamuser'
user.mkdir(parents=True)
return user
def test_the_london_script_creates_its_save_path_and_keeps_player_settings(self):
with tempfile.TemporaryDirectory() as root:
folder = game(root, store_id='gog', ident='1897848199')
user = self.prefix(root)
support = folder / 'support/1897848199'
(support / 'docs').mkdir(parents=True)
(folder / '__AppData').mkdir()
(folder / '__AppData/save.dat').write_text('save')
for name in ('Fallout4Prefs.ini', 'Fallout4.ini'):
(support / 'docs' / name).write_text('[Archive]\n')
for name in ('DLCList.txt', 'Plugins.txt', 'UserDownloadedContent.txt'):
(support / name).write_text('*LondonWorldSpace.esm\n')
gog_script(folder, '1897848199', [
save_path(savePath='{userdocs}/My Games/Fallout4', type='folder'),
set_registry(root='HKLM', subkey='Software\\Bethesda Softworks\\Fallout4',
valueName='Installed Path', valueData='{app}\\', valueType='string'),
support_data(type='folder', target='{userdocs}/My Games/Fallout4'),
support_data(type='folder', target='{localappdata}/Fallout4'),
support_data(type='file', overwrite=True, source='{supportDir}/docs/Fallout4Prefs.ini',
target='{userdocs}/My Games/Fallout4/Fallout4Prefs.ini'),
support_data(type='file', overwrite=True, source='{supportDir}/docs/Fallout4.ini',
target='{userdocs}/My Games/Fallout4/Fallout4.ini'),
support_data(type='file', overwrite=True, source='{supportDir}/DLCList.txt',
target='{localappdata}/Fallout4/DLCList.txt'),
support_data(type='file', overwrite=True, source='{supportDir}/Plugins.txt',
target='{localappdata}/Fallout4/Plugins.txt'),
support_data(type='file', overwrite=True, source='{supportDir}/UserDownloadedContent.txt',
target='{localappdata}/Fallout4/UserDownloadedContent.txt'),
support_data(type='folder', overwrite=True, source='{app}/__AppData', target='{localappdata}/Fallout4'),
])
with patch.object(store, 'create_prefix') as create:
self.assertEqual('copied=6', store.gog_support_data(folder, root + '/compat', '/proton'))
self.assertEqual('paths=1', store.gog_save_paths(folder, root + '/compat', '/proton'))
create.assert_not_called()
saves = user / 'Documents/My Games/Fallout4'
self.assertTrue(saves.is_dir())
self.assertEqual('[Archive]\n', (saves / 'Fallout4.ini').read_text())
self.assertEqual('*LondonWorldSpace.esm\n', (user / 'AppData/Local/Fallout4/Plugins.txt').read_text())
self.assertTrue((Path(root) / 'compat/pfx' / store.GOG_SAVE_PATH_MARK).is_file())
(saves / 'my settings.ini').write_text('player')
self.assertEqual('ready', store.gog_save_paths(folder, root + '/compat', '/proton'))
self.assertEqual('player', (saves / 'my settings.ini').read_text())
def test_only_save_path_actions_create_known_folders(self):
with tempfile.TemporaryDirectory() as root:
folder = game(root, store_id='gog', ident='9')
user = self.prefix(root)
saves = user / 'Documents/My Games/Fallout4'
saves.mkdir(parents=True)
(saves / 'Fallout4Prefs.ini').write_text('player')
gog_script(folder, '9', [
set_registry(root='HKLM', subkey='Software\\Game', valueName='a', valueData='b', valueType='string'),
{'install': {'action': 'createFolder', 'arguments': {'savePath': '{userdocs}/Other'}}},
save_path(savePath='{windir}/evil'),
save_path(savePath='{userdocs}/../../escape'),
save_path(savePath='{userappdata}/Ubisoft/Anno1404/Config'),
])
self.assertEqual('paths=1 skipped=2', store.gog_save_paths(folder, root + '/compat', '/proton'))
self.assertTrue((user / 'AppData/Roaming/Ubisoft/Anno1404/Config').is_dir())
self.assertFalse((user / 'Documents/Other').exists())
self.assertFalse((Path(root) / 'escape').exists())
self.assertEqual('player', (saves / 'Fallout4Prefs.ini').read_text())
self.assertFalse((Path(root) / 'compat/pfx' / store.GOG_SAVE_PATH_MARK).exists())
def test_without_save_paths_no_prefix_is_made(self):
with tempfile.TemporaryDirectory() as root:
folder = game(root, store_id='gog', ident='9')
gog_script(folder, '9', [set_registry(root='HKLM', subkey='Software\\Game', valueName='a',
valueData='b', valueType='string')])
with patch.object(store, 'create_prefix') as create:
self.assertEqual('none', store.gog_save_paths(folder, root + '/compat', '/proton'))
create.assert_not_called()
def test_a_missing_prefix_is_made_first(self):
with tempfile.TemporaryDirectory() as root:
folder = game(root, store_id='gog', ident='9')
gog_script(folder, '9', [save_path(savePath='{userdocs}/My Games/G')])
with patch.object(store, 'create_prefix', return_value='failed') as create:
self.assertEqual('no-prefix', store.gog_save_paths(folder, root + '/compat', '/proton'))
create.assert_called_once_with(root + '/compat', '/proton')
def made(compat_data, proton):
self.prefix(root)
return 'created'
with patch.object(store, 'create_prefix', side_effect=made):
self.assertEqual('paths=1', store.gog_save_paths(folder, root + '/compat', '/proton'))
self.assertTrue((Path(root) / 'compat/pfx/drive_c/users/steamuser/Documents/My Games/G').is_dir())
class GogRegistry(unittest.TestCase):
def test_patch_registration_uses_authentic_build_and_the_prefix_registry_executable(self):
with tempfile.TemporaryDirectory() as root: