mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 22:48:20 +01:00
Finish properly setting up mirror and caching courtesy of @AffectedArc07
This commit is contained in:
@@ -51,6 +51,8 @@ You must also have the following environment variables set. To run them more acc
|
||||
- `TGS_TEST_CONNECTION_STRING`: To a valid database connection string. You can use the setup wizard to create one.
|
||||
- (Optional) `TGS_TEST_GITHUB_TOKEN`: A GitHub personal access token with no scopes used to bypass rate limits.
|
||||
- (Optional) `TGS_TEST_BYOND_ZIP_DOWNLOAD_TEMPLATE`: Template URL for downloading BYOND zip files from a non-official mirror.
|
||||
- (Optional) `TGS_TEST_BYOND_MIRROR_VERSION_TXT`: version.txt for a BYOND zip mirror. Requires `TGS_TEST_BYOND_ZIP_DOWNLOAD_TEMPLATE`.
|
||||
- (Optional) `TGS_TEST_BYOND_ZIPS_BASE_PATH`: Directory on disk to cache BYOND zip files.
|
||||
- (Optional) The following variables are all interdependent, so if one is set they all must be.
|
||||
- `TGS_TEST_DISCORD_TOKEN`: To a valid discord bot token.
|
||||
- `TGS_TEST_DISCORD_CHANNEL`: To a valid discord channel ID that the above bot can access.
|
||||
|
||||
@@ -42,6 +42,8 @@ env:
|
||||
TGS_NODE_VERSION: 20.x
|
||||
TGS_TEST_GITHUB_TOKEN: ${{ secrets.LIVE_TESTS_TOKEN }}
|
||||
PACKAGING_PRIVATE_KEY_PASSPHRASE: ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }}
|
||||
TGS_TEST_BYOND_ZIP_DOWNLOAD_TEMPLATE: https://mocha.affectedarc07.co.uk/tgs_byond_mirrors/${Major}.${Minor}_byond${Linux:_linux}.zip
|
||||
TGS_TEST_BYOND_MIRROR_VERSION_TXT: https://mocha.affectedarc07.co.uk/tgs_byond_mirrors/version.txt
|
||||
|
||||
concurrency:
|
||||
group: "ci-${{ (github.event_name != 'push' && github.event_name != 'schedule' && github.event.inputs.pull_request_number) || github.run_id }}-${{ github.event_name }}"
|
||||
|
||||
@@ -92,15 +92,21 @@ namespace Tgstation.Server.Tests
|
||||
|
||||
var url = ByondInstallerBase.GetDownloadZipUrl(byondVersion, urlTemplate, new PlatformIdentifier().IsWindows ? "Windows" : "Linux");
|
||||
string path = null;
|
||||
if (TestingUtils.RunningInGitHubActions)
|
||||
string basePath = Environment.GetEnvironmentVariable("TGS_TEST_BYOND_ZIPS_BASE_PATH");
|
||||
if (basePath == null && TestingUtils.RunningInGitHubActions)
|
||||
{
|
||||
// actions is supposed to cache BYOND for us
|
||||
|
||||
var dir = Path.Combine(
|
||||
// actions is supposed to cache BYOND for us here
|
||||
basePath = Path.Combine(
|
||||
Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.UserProfile,
|
||||
Environment.SpecialFolderOption.DoNotVerify),
|
||||
"byond-zips-cache",
|
||||
"byond-zips-cache");
|
||||
}
|
||||
|
||||
if (basePath != null)
|
||||
{
|
||||
var dir = Path.Combine(
|
||||
basePath,
|
||||
"live",
|
||||
windows ? "windows" : "linux");
|
||||
path = Path.Combine(
|
||||
@@ -109,15 +115,23 @@ namespace Tgstation.Server.Tests
|
||||
$"{version.Version.Major}.{version.Version.Minor}.zip");
|
||||
}
|
||||
|
||||
Uri overrideUrl = null;
|
||||
if (urlCacheOverrideTemplate != null)
|
||||
{
|
||||
overrideUrl = url;
|
||||
url = ByondInstallerBase.GetDownloadZipUrl(byondVersion, urlCacheOverrideTemplate, new PlatformIdentifier().IsWindows ? "Windows" : "Linux");
|
||||
}
|
||||
|
||||
await (await CacheFile(
|
||||
logger,
|
||||
urlCacheOverrideTemplate != null
|
||||
? ByondInstallerBase.GetDownloadZipUrl(byondVersion, urlCacheOverrideTemplate, new PlatformIdentifier().IsWindows ? "Windows" : "Linux")
|
||||
: url,
|
||||
url,
|
||||
null,
|
||||
path,
|
||||
cancellationToken))
|
||||
.DisposeAsync();
|
||||
|
||||
if (overrideUrl != null)
|
||||
cachedPaths[overrideUrl.ToString()] = cachedPaths[url.ToString()];
|
||||
}
|
||||
|
||||
public static void Cleanup()
|
||||
|
||||
@@ -1626,6 +1626,16 @@ namespace Tgstation.Server.Tests.Live
|
||||
if (openDreamOnly)
|
||||
return;
|
||||
|
||||
var windowsMinCompat = new Version(510, 1346);
|
||||
var linuxMinCompat = new Version(512, 1451); // http://www.byond.com/forum/?forum=5&command=search&scope=local&text=resolved%3a512.1451
|
||||
await CachingFileDownloader.InitializeByondVersion(
|
||||
GetLogger(),
|
||||
new PlatformIdentifier().IsWindows
|
||||
? windowsMinCompat
|
||||
: linuxMinCompat,
|
||||
new PlatformIdentifier().IsWindows,
|
||||
cancellationToken);
|
||||
|
||||
var compatTests = FailFast(
|
||||
instanceTest
|
||||
.RunCompatTests(
|
||||
@@ -1633,8 +1643,8 @@ namespace Tgstation.Server.Tests.Live
|
||||
{
|
||||
Engine = EngineType.Byond,
|
||||
Version = new PlatformIdentifier().IsWindows
|
||||
? new Version(510, 1346)
|
||||
: new Version(512, 1451) // http://www.byond.com/forum/?forum=5&command=search&scope=local&text=resolved%3a512.1451
|
||||
? windowsMinCompat
|
||||
: linuxMinCompat,
|
||||
},
|
||||
server.OpenDreamUrl,
|
||||
firstAdminRestClient.Instances.CreateClient(compatInstance),
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Tgstation.Server.Tests
|
||||
const string DefaultMirror = "https://www.byond.com/download/version.txt";
|
||||
edgeVersion = await GetVersionFromResponse(DefaultMirror);
|
||||
|
||||
logger.LogInformation("Downloading edge version from BYOND.com");
|
||||
logger.LogInformation("Downloading edge version from BYOND.com {edge}", edgeVersion);
|
||||
|
||||
// if we got the result from byond.com, make sure the cache grabs the zip from there as well
|
||||
await CachingFileDownloader.InitializeByondVersion(logger, Version.Parse(edgeVersion), new PlatformIdentifier().IsWindows, cancellationToken, GeneralConfiguration.DefaultByondZipDownloadTemplate);
|
||||
|
||||
Reference in New Issue
Block a user