Merge branch 'main' into fix/mali-g615-venus-shader-crash

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-16 15:22:23 -05:00
commit 3bdc58e969
5 files changed
+96 -5

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
validate:
name: Validate source and build result
runs-on: ubuntu-24.04
timeout-minutes: 5
timeout-minutes: 70
steps:
- uses: actions/checkout@v4
with:
@@ -335,7 +335,10 @@ object AddedGames {
val path = canonical(exe)
val owner = ownerFolder(app, exe)
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let { return AddResult.Existing(it) }
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let {
if (guestPath(app, exe) != null) AddedExes.put(app, AddedExes.Entry(owner.path, exe.path))
return AddResult.Existing(it)
}
}
if (guestPath(app, exe) == null) {
(owner ?: exe.parentFile)?.takeIf { guestPath(app, it) == null }?.let { bindFolder(app, it) }
@@ -344,7 +347,7 @@ object AddedGames {
val folder = owner ?: exe.parentFile ?: return AddResult.NotFound
SessionPrefs.setAddedGameRemoved(app, folder.path, false)
SessionPrefs.setAddedGameExe(app, folder.path, exe.path)
if (owner == null) AddedExes.put(app, AddedExes.Entry(folder.path, exe.path))
AddedExes.put(app, AddedExes.Entry(folder.path, exe.path))
val game = single(app, folder.path) ?: return AddResult.NotFound
AddedGamesPublisher.later(app) { com.droiddeck.launcher.stores.SteamLiveShortcuts.sync(app, listOf(game)) { true } }
Log.i(TAG, "added ${game.name} from its exe")
@@ -62,6 +62,36 @@ class AddedExesTest {
assertEquals(1, AddedGames.scan(app).size)
}
@Test fun aPickedSteamInstallSurvivesFullScansWithAndWithoutAManifest() {
for (manifestFirst in listOf(false, true)) {
val storage = tmp.newFolder("Library-$manifestFirst")
val pick = exe(File(storage, "steamapps/common/Example/Example.exe"))
val other = exe(File(storage, "steamapps/common/Other/Other.exe"))
val manifest = File(storage, "steamapps/appmanifest_123.acf")
exe(File(storage, "steamapps/common/Unselected/Unselected.exe"))
File(storage, "steamapps/appmanifest_456.acf").writeText("\"installdir\" \"Unselected\"")
SessionPrefs.setAddedGamesDirs(app, emptyList())
SessionPrefs.setGameStorage(app, storage.path, "Card")
if (manifestFirst) manifest.writeText("\"installdir\" \"Example\"")
SessionPrefs.setAddedGameLaunch(app, pick.parentFile!!.path, "--custom")
val game = result(AddedGames.addExe(app, pick))
assertEquals(pick.path, AddedExes.list(app).single { it.folder == game.folder.path }.exe)
assertEquals(game.appId, AddedGames.scan(app).single { it.folder == game.folder }.appId)
manifest.writeText("\"installdir\" \"Example\"")
val scanned = AddedGames.scan(app).single { it.folder == game.folder }
assertEquals(game.appId, scanned.appId)
assertEquals(pick.path, scanned.exe.path)
assertEquals("--custom", scanned.launchOptions)
assertTrue(AddedGames.scan(app).none { it.folder.name == "Unselected" })
assertTrue(AddedGames.scan(app).any { it.exe == other })
AddedGames.remove(app, game.folder)
assertTrue(AddedGames.scan(app).none { it.folder == game.folder })
assertTrue(AddedGames.addExe(app, pick) is AddedGames.AddResult.Switched)
assertEquals(game.appId, AddedGames.scan(app).single { it.folder == game.folder }.appId)
AddedExes.drop(app, game.folder.path)
}
}
@Test fun anotherExeInTheSameGameSwitchesItsExe() {
noGamesFolders()
val first = onStorage("Games2/Hades/Hades.exe")
+22 -2
View File
@@ -2,13 +2,33 @@
import json
import os
import subprocess
import sys
import time
from urllib.parse import urlencode
from check_authorship import check_revision, event_violations
def api(path, *args):
return json.loads(subprocess.check_output(["gh", "api", path, *args], text=True))
RATE_LIMIT_WAIT = 1800
def rate_limit_wait():
try:
reset = json.loads(subprocess.check_output(["gh", "api", "rate_limit"], text=True))["resources"]["core"]["reset"]
except (subprocess.CalledProcessError, KeyError, ValueError):
return 60
return max(5, min(RATE_LIMIT_WAIT, reset - time.time() + 5))
def api(path, *args, attempts=3):
for attempt in range(attempts):
done = subprocess.run(["gh", "api", path, *args], text=True, capture_output=True)
if done.returncode == 0:
return json.loads(done.stdout)
if "--method" in args or "rate limit" not in done.stderr.lower() or attempt == attempts - 1:
sys.stderr.write(done.stderr)
raise subprocess.CalledProcessError(done.returncode, done.args, done.stdout, done.stderr)
time.sleep(rate_limit_wait())
def compilation_state(run, jobs):
+38
View File
@@ -130,3 +130,41 @@ class ValidateApkTest(unittest.TestCase):
self.git("commit", "-qm", "Rename source")
with contextlib.chdir(self.root):
self.assertFalse(validate_apk.documentation_only(self.git("rev-parse", "HEAD")))
class RateLimitTest(unittest.TestCase):
def call(self, results):
replies = list(results)
runs = []
def run(args, **kwargs):
runs.append(args)
code, out, err = replies.pop(0)
return subprocess.CompletedProcess(args, code, out, err)
with patch.object(validate_apk.subprocess, "run", side_effect=run), \
patch.object(validate_apk, "rate_limit_wait", return_value=7), \
patch.object(validate_apk.time, "sleep") as sleep, \
contextlib.redirect_stderr(open(os.devnull, "w")):
try:
return validate_apk.api("repos/x/pulls/1"), runs, sleep
except subprocess.CalledProcessError as error:
return error, runs, sleep
def test_waits_for_the_rate_limit_then_retries(self):
result, runs, sleep = self.call([(1, "", "gh: API rate limit exceeded for installation."), (0, '{"number": 1}', "")])
self.assertEqual(result, {"number": 1})
self.assertEqual(len(runs), 2)
sleep.assert_called_once_with(7)
def test_other_errors_fail_without_waiting(self):
result, runs, sleep = self.call([(1, "", "gh: Not Found (HTTP 404)")])
self.assertIsInstance(result, subprocess.CalledProcessError)
self.assertEqual(len(runs), 1)
sleep.assert_not_called()
def test_gives_up_after_the_last_attempt(self):
result, runs, sleep = self.call([(1, "", "API rate limit exceeded")] * 3)
self.assertIsInstance(result, subprocess.CalledProcessError)
self.assertEqual(len(runs), 3)
self.assertEqual(sleep.call_count, 2)