mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 13:07:07 +01:00
Merge pull request #981 from tgstation/937-EnoughWithSlowAppveyor
Change dox generation to a travis job
This commit is contained in:
+18
-5
@@ -12,6 +12,15 @@ branches:
|
||||
jobs:
|
||||
include:
|
||||
- env:
|
||||
- DoxGeneration=true
|
||||
name: "Dox Generation"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- doxygen
|
||||
- graphviz
|
||||
- env:
|
||||
- DoxGeneration=false
|
||||
- DockerBuild=false
|
||||
- DMAPI=true
|
||||
- BYOND_MAJOR="513"
|
||||
@@ -28,6 +37,7 @@ jobs:
|
||||
- libc6-i386
|
||||
- libstdc++6:i386
|
||||
- env:
|
||||
- DoxGeneration=false
|
||||
- DockerBuild=false
|
||||
- DMAPI=false
|
||||
- CONFIG=Debug
|
||||
@@ -46,6 +56,7 @@ jobs:
|
||||
- libc6-i386
|
||||
- libstdc++6:i386
|
||||
- env:
|
||||
- DoxGeneration=false
|
||||
- DockerBuild=false
|
||||
- DMAPI=false
|
||||
- CONFIG=Release
|
||||
@@ -64,16 +75,18 @@ jobs:
|
||||
- libc6-i386
|
||||
- libstdc++6:i386
|
||||
- env:
|
||||
- DoxGeneration=false
|
||||
- DockerBuild=true
|
||||
name: "Docker Build"
|
||||
services:
|
||||
- docker
|
||||
|
||||
install:
|
||||
- if [ $DockerBuild = false ] && [ $DMAPI = true ]; then build/install_byond.sh; fi
|
||||
- if [ $DockerBuild = false ] && [ $DMAPI = false ]; then dotnet restore tgstation-server.sln; fi
|
||||
- if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = true ]; then build/install_byond.sh; fi
|
||||
- if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = false ]; then dotnet restore tgstation-server.sln; fi
|
||||
|
||||
script:
|
||||
- if [ $DockerBuild = false ] && [ $DMAPI = true ]; then tests/DMAPI/BasicOperation/build_byond.sh || travis_terminate 1; fi
|
||||
- if [ $DockerBuild = false ] && [ $DMAPI = false ]; then build/test_core.sh; fi
|
||||
- if [ $DockerBuild = true ]; then docker build . -f build/Dockerfile; fi
|
||||
- if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = true ]; then tests/DMAPI/BasicOperation/build_byond.sh || travis_terminate 1; fi
|
||||
- if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = false ]; then build/test_core.sh; fi
|
||||
- if [ $DoxGeneration = false ] && [ $DockerBuild = true ]; then docker build . -f build/Dockerfile; fi
|
||||
- if [ $DoxGeneration = true ]; then build/build_dox.sh; fi
|
||||
|
||||
+2
-5
@@ -24,7 +24,6 @@ branches:
|
||||
skip_tags: true
|
||||
image: Visual Studio 2019
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
shallow_clone: true
|
||||
artifacts:
|
||||
@@ -36,8 +35,6 @@ artifacts:
|
||||
name: ServerUpdatePackage
|
||||
- path: src/DMAPI
|
||||
name: DMAPI
|
||||
- path: tgsdox
|
||||
name: DocumentationHtml
|
||||
- path: swagger.json
|
||||
name: SwaggerSpec
|
||||
cache:
|
||||
@@ -45,7 +42,7 @@ cache:
|
||||
services:
|
||||
- mssql2017
|
||||
install:
|
||||
- choco install doxygen.install codecov graphviz.portable opencover.portable
|
||||
- choco install codecov opencover.portable
|
||||
- npm i -g ibm-openapi-validator
|
||||
- nuget restore tgstation-server.sln
|
||||
- ps: Install-Product node 10
|
||||
@@ -81,8 +78,8 @@ test_script:
|
||||
- ps: $wc.UploadFile("https://ci.appveyor.com/api/testresults/mstest/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\tests\Tgstation.Server.Tests\TestResults\results.trx))
|
||||
- lint-openapi -p -c build/OpenApiValidationSettings.json C:/swagger.json
|
||||
after_test:
|
||||
- ps: Move-Item -path C:/swagger.json swagger.json
|
||||
- ps: build/UploadCoverage.ps1
|
||||
- ps: build/BuildDox.ps1
|
||||
#host updater
|
||||
- dotnet publish src/Tgstation.Server.Host/Tgstation.Server.Host.csproj -o artifacts/ServerHost -c %CONFIGURATION%
|
||||
#console
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
$bf = $Env:APPVEYOR_BUILD_FOLDER
|
||||
|
||||
$doxdir = "C:\tgsdox"
|
||||
|
||||
New-Item -Path $doxdir -ItemType directory
|
||||
|
||||
$publish_dox = (-not (Test-Path Env:APPVEYOR_PULL_REQUEST_NUMBER)) -and ("$Env:APPVEYOR_REPO_BRANCH" -eq "master")
|
||||
|
||||
if($publish_dox){
|
||||
$github_url = "github.com/$Env:APPVEYOR_REPO_NAME"
|
||||
echo "Cloning https://git@$github_url..."
|
||||
git clone -b gh-pages --single-branch "https://git@$github_url" "$doxdir" 2>$null
|
||||
rm -r "$doxdir\*"
|
||||
}
|
||||
|
||||
Add-Content "$bf\docs\Doxyfile" "`nPROJECT_NUMBER = $version`nINPUT = $bf`nOUTPUT_DIRECTORY = $doxdir`nPROJECT_LOGO = $bf/build/tgs.ico`nHAVE_DOT=YES"
|
||||
|
||||
&"C:\Program Files\doxygen\bin\doxygen.exe" "$bf\docs\Doxyfile"
|
||||
|
||||
if($publish_dox){
|
||||
cd $doxdir
|
||||
git config --global push.default simple
|
||||
git config user.name "tgstation-server"
|
||||
git config user.email "tgstation-server@tgstation13.org"
|
||||
echo '# THIS BRANCH IS AUTO GENERATED BY APPVEYOR CI' > README.md
|
||||
|
||||
# Add in the swagger specification
|
||||
cp C:/swagger.json "$doxdir/swagger.json"
|
||||
|
||||
# Need to create a .nojekyll file to allow filenames starting with an underscore
|
||||
# to be seen on the gh-pages site. Therefore creating an empty .nojekyll file.
|
||||
echo "" > .nojekyll
|
||||
git add --all
|
||||
git commit -m "Deploy code docs to GitHub Pages for Appveyor build $Env:APPVEYOR_BUILD_NUMBER" -m "Commit: $Env:APPVEYOR_REPO_COMMIT"
|
||||
git push -f "https://$Env:TGS4_TEST_GITHUB_TOKEN@$github_url" 2>&1 | out-null
|
||||
cd "$bf"
|
||||
rm -r "$doxdir/.git"
|
||||
}
|
||||
mv C:/tgsdox "$bf/tgsdox"
|
||||
|
||||
# Add in the swagger specification
|
||||
cp C:/swagger.json "$bf/swagger.json"
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
BUILD_FOLDER=$TRAVIS_BUILD_DIR
|
||||
|
||||
DOXDIR=~/tgsdox
|
||||
|
||||
mkdir -p $DOXDIR
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" -eq "$false" ] && [ "$TRAVIS_BRANCH" -eq "master" ]; then
|
||||
PUBLISH_DOX=true
|
||||
else
|
||||
PUBLISH_DOX=false
|
||||
fi
|
||||
|
||||
if [ "$PUBLISH_DOX" = true ] ; then
|
||||
GITHUB_URL="github.com/$TRAVIS_PULL_REQUEST_SLUG"
|
||||
echo "Cloning https://git@$GITHUB_URL..."
|
||||
git clone -b gh-pages --single-branch "https://git@$GITHUB_URL" "$DOXDIR" 2> /dev/null
|
||||
rm -r "$DOXDIR\*"
|
||||
fi
|
||||
|
||||
VERSION=cat "$BUILD_FOLDER/build/Version.props" | grep -oPm1 "(?<=<TgsCoreVersion>)[^<]+"
|
||||
|
||||
echo -e "\nPROJECT_NUMBER = $VERSION\nINPUT = $BUILD_FOLDER\nOUTPUT_DIRECTORY = $DOXDIR\nPROJECT_LOGO = $BUILD_FOLDER/build/tgs.ico\nHAVE_DOT=YES" >> "$BUILD_FOLDER/docs/Doxyfile"
|
||||
|
||||
doxygen "$BUILD_FOLDER/docs/Doxyfile"
|
||||
|
||||
if [ "$PUBLISH_DOX" = true ] ; then
|
||||
cd $DOXDIR
|
||||
git config --global push.default simple
|
||||
git config user.name "tgstation-server"
|
||||
git config user.email "tgstation-server@tgstation13.org"
|
||||
echo '# THIS BRANCH IS AUTO GENERATED BY APPVEYOR CI' > README.md
|
||||
|
||||
# Need to create a .nojekyll file to allow filenames starting with an underscore
|
||||
# to be seen on the gh-pages site. Therefore creating an empty .nojekyll file.
|
||||
echo "" > .nojekyll
|
||||
git add --all
|
||||
git commit -m "Deploy code docs to GitHub Pages for Travis build $TRAVIS_BUILD_NUMBER" -m "Commit: $TRAVIS_COMMIT"
|
||||
git push -f "https://$TGS4_TEST_GITHUB_TOKEN@$GITHUB_URL" 2>&1 | out-null
|
||||
cd "$BUILD_FOLDER"
|
||||
rm -r "$DOXDIR/.git"
|
||||
fi
|
||||
|
||||
mv $DOXDIR "$BUILD_FOLDER/tgsdox"
|
||||
@@ -57,6 +57,7 @@ namespace Tgstation.Server.Host.Watchdog
|
||||
|
||||
/// <inheritdoc />
|
||||
#pragma warning disable CA1502 // TODO: Decomplexify
|
||||
#pragma warning disable CA1506
|
||||
public async Task RunAsync(bool runConfigure, string[] args, CancellationToken cancellationToken)
|
||||
{
|
||||
logger.LogInformation("Host watchdog starting...");
|
||||
@@ -78,27 +79,30 @@ namespace Tgstation.Server.Host.Watchdog
|
||||
var rootLocation = Path.GetDirectoryName(executingAssembly.Location);
|
||||
|
||||
var assemblyStoragePath = Path.Combine(rootLocation, "lib"); // always always next to watchdog
|
||||
#if DEBUG
|
||||
Directory.CreateDirectory(assemblyStoragePath);
|
||||
#endif
|
||||
|
||||
var defaultAssemblyPath = Path.GetFullPath(Path.Combine(assemblyStoragePath, "Default"));
|
||||
#if DEBUG
|
||||
// just copy the shit where it belongs
|
||||
Directory.Delete(assemblyStoragePath, true);
|
||||
Directory.CreateDirectory(defaultAssemblyPath);
|
||||
|
||||
var sourcePath = "../../../../Tgstation.Server.Host/bin/Debug/netcoreapp3.1";
|
||||
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
|
||||
Directory.CreateDirectory(dirPath.Replace(sourcePath, defaultAssemblyPath));
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
// VS special tactics
|
||||
// just copy the shit where it belongs
|
||||
Directory.Delete(assemblyStoragePath, true);
|
||||
Directory.CreateDirectory(defaultAssemblyPath);
|
||||
|
||||
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
|
||||
File.Copy(newPath, newPath.Replace(sourcePath, defaultAssemblyPath), true);
|
||||
var sourcePath = "../../../../Tgstation.Server.Host/bin/Debug/netcoreapp3.1";
|
||||
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
|
||||
Directory.CreateDirectory(dirPath.Replace(sourcePath, defaultAssemblyPath));
|
||||
|
||||
const string AppSettingsJson = "appsettings.json";
|
||||
var rootJson = Path.Combine(rootLocation, AppSettingsJson);
|
||||
File.Delete(rootJson);
|
||||
File.Move(Path.Combine(defaultAssemblyPath, AppSettingsJson), rootJson);
|
||||
#endif
|
||||
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
|
||||
File.Copy(newPath, newPath.Replace(sourcePath, defaultAssemblyPath), true);
|
||||
|
||||
const string AppSettingsJson = "appsettings.json";
|
||||
var rootJson = Path.Combine(rootLocation, AppSettingsJson);
|
||||
File.Delete(rootJson);
|
||||
File.Move(Path.Combine(defaultAssemblyPath, AppSettingsJson), rootJson);
|
||||
}
|
||||
else
|
||||
Directory.CreateDirectory(assemblyStoragePath);
|
||||
|
||||
var assemblyName = String.Join(".", nameof(Tgstation), nameof(Server), nameof(Host), "dll");
|
||||
var assemblyPath = Path.Combine(defaultAssemblyPath, assemblyName);
|
||||
@@ -309,5 +313,6 @@ namespace Tgstation.Server.Host.Watchdog
|
||||
}
|
||||
}
|
||||
#pragma warning restore CA1502
|
||||
#pragma warning restore CA1506
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Configuration;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using Tgstation.Server.Host.Configuration;
|
||||
|
||||
@@ -76,9 +77,8 @@ namespace Tgstation.Server.Host.Extensions
|
||||
|
||||
builder.AddSerilog(configuration.CreateLogger(), true);
|
||||
|
||||
#if DEBUG
|
||||
builder.AddDebug();
|
||||
#endif
|
||||
if (Debugger.IsAttached)
|
||||
builder.AddDebug();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,6 @@ namespace Tgstation.Server.Host.Setup
|
||||
/// <returns>A <see cref="Task{TResult}"/> resulting in the input <see cref="DatabaseType"/>.</returns>
|
||||
async Task<DatabaseType> PromptDatabaseType(CancellationToken cancellationToken)
|
||||
{
|
||||
#if !DEBUG
|
||||
await console.WriteAsync(String.Empty, true, cancellationToken).ConfigureAwait(false);
|
||||
await console.WriteAsync(
|
||||
"NOTE: It is HIGHLY reccommended that TGS runs on a complete relational database, specfically *NOT* Sqlite.",
|
||||
@@ -304,7 +303,6 @@ namespace Tgstation.Server.Host.Setup
|
||||
await console.WriteAsync(String.Empty, true, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await asyncDelayer.Delay(TimeSpan.FromSeconds(3), cancellationToken).ConfigureAwait(false);
|
||||
#endif
|
||||
|
||||
await console.WriteAsync("What SQL database type will you be using?", true, cancellationToken).ConfigureAwait(false);
|
||||
do
|
||||
|
||||
@@ -25,59 +25,6 @@ namespace Tgstation.Server.Tests
|
||||
{
|
||||
readonly IServerClientFactory clientFactory = new ServerClientFactory(new ProductHeaderValue(Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version.ToString()));
|
||||
|
||||
static string RequireDiscordToken()
|
||||
{
|
||||
var discordToken = Environment.GetEnvironmentVariable("TGS4_TEST_DISCORD_TOKEN");
|
||||
if (String.IsNullOrWhiteSpace(discordToken))
|
||||
Assert.Inconclusive("The TGS4_TEST_DISCORD_TOKEN environment variable must be set to run this test!");
|
||||
|
||||
return discordToken;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TestAutomaticDiscordReconnection()
|
||||
{
|
||||
var discordToken = RequireDiscordToken();
|
||||
|
||||
using var discordProvider = new DiscordProvider(Mock.Of<ILogger<DiscordProvider>>(), discordToken, 1);
|
||||
var connectResult = await discordProvider.Connect(default).ConfigureAwait(false);
|
||||
Assert.IsTrue(connectResult, "Failed to connect to discord!");
|
||||
Assert.IsTrue(discordProvider.Connected, "Discord provider is not connected!");
|
||||
|
||||
// Forcefully close the connection under the provider's nose
|
||||
// This will be detected in real life scenarios
|
||||
DiscordSocketClient socketClient = typeof(DiscordProvider)
|
||||
.GetField("client", BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
?.GetValue(discordProvider)
|
||||
as DiscordSocketClient;
|
||||
Assert.IsNotNull(socketClient, "Reflection unable to read discord socket client!");
|
||||
|
||||
await socketClient.LogoutAsync().ConfigureAwait(false);
|
||||
|
||||
Assert.IsFalse(discordProvider.Connected, "Discord provider is still connected!");
|
||||
|
||||
try
|
||||
{
|
||||
using CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(70));
|
||||
do
|
||||
{
|
||||
var message = await discordProvider.NextMessage(cts.Token).ConfigureAwait(false);
|
||||
if (message == null)
|
||||
break;
|
||||
}
|
||||
while (true);
|
||||
|
||||
// Prevents a deadlock coming from having the NextMessage continuation call Dispose
|
||||
await Task.Yield();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Assert.Fail("Failed to reconnect within the time period!");
|
||||
}
|
||||
|
||||
Assert.IsTrue(discordProvider.Connected, "Discord provider not connected!");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TestServerUpdate()
|
||||
{
|
||||
@@ -153,7 +100,6 @@ namespace Tgstation.Server.Tests
|
||||
[TestMethod]
|
||||
public async Task TestFullStandardOperation()
|
||||
{
|
||||
RequireDiscordToken();
|
||||
using var server = new TestingServer(clientFactory);
|
||||
using var serverCts = new CancellationTokenSource();
|
||||
var cancellationToken = serverCts.Token;
|
||||
|
||||
Reference in New Issue
Block a user