mirror of
https://github.com/space-wizards/RobustToolboxTemplateSingleplayer.git
synced 2026-10-24 05:32:56 -04:00
Fix build and add tests
This commit is contained in:
parent
750039957c
commit
df1e98f0b9
5 changed files with 123 additions and 16 deletions
44
.github/workflows/build-test.yml
vendored
Normal file
44
.github/workflows/build-test.yml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
name: Build & Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v4.1.0
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --no-restore /p:WarningsAsErrors=nullable
|
||||
|
||||
- name: Run tests
|
||||
shell: pwsh
|
||||
run: dotnet test --no-build Template.Tests/Template.Tests.csproj -- NUnit.ConsoleOut=0 NUnit.TestOutputXml="logs" NUnit.WorkDirectory="$(pwd)/test_results"
|
||||
|
||||
- name: Archive NUnit3 test results.
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nunit3-results-${{ matrix.os }}
|
||||
path: test_results/*
|
||||
retention-days: 7
|
||||
|
|
@ -31,8 +31,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlX.IL.Cecil", "RobustToo
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlX.Runtime", "RobustToolbox\XamlX\src\XamlX.Runtime\XamlX.Runtime.csproj", "{19BC1F51-45E8-4BA6-854C-FDB7670AB4E3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenToolkit.GraphicsLibraryFramework", "RobustToolbox\OpenToolkit.GraphicsLibraryFramework\OpenToolkit.GraphicsLibraryFramework.csproj", "{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Robust.LoaderApi", "Robust.LoaderApi", "{EDB842C6-67AE-4F0E-A9F2-09C2DF1024C9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.LoaderApi", "RobustToolbox\Robust.LoaderApi\Robust.LoaderApi\Robust.LoaderApi.csproj", "{EC94C69F-F0E2-44B0-BE5E-C385BECB6AD3}"
|
||||
|
|
@ -58,6 +56,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project Files", "Project Fi
|
|||
Directory.Packages.props = Directory.Packages.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Template.Tests", "Template.Tests\Template.Tests.csproj", "{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -191,18 +191,6 @@ Global
|
|||
{19BC1F51-45E8-4BA6-854C-FDB7670AB4E3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{19BC1F51-45E8-4BA6-854C-FDB7670AB4E3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{19BC1F51-45E8-4BA6-854C-FDB7670AB4E3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{EC94C69F-F0E2-44B0-BE5E-C385BECB6AD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC94C69F-F0E2-44B0-BE5E-C385BECB6AD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC94C69F-F0E2-44B0-BE5E-C385BECB6AD3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
|
|
@ -311,6 +299,18 @@ Global
|
|||
{D6ABF4A1-95C0-4930-9076-58413D0617BE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D6ABF4A1-95C0-4930-9076-58413D0617BE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D6ABF4A1-95C0-4930-9076-58413D0617BE}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D3CED347-5E73-44C1-83FD-D7FB72D3F82F}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{2A829DE3-FCB2-4FEA-A6F3-B85122C8D11E} = {F5F87A9D-C304-4833-B107-D666317F6931}
|
||||
|
|
@ -325,7 +325,6 @@ Global
|
|||
{7380FFC8-AFEF-4B66-8426-2D8E34221CF4} = {91AF0388-356D-4929-9A86-1B1F5196E921}
|
||||
{A406137A-DEC7-4CC5-99A8-6595ACC70B92} = {91AF0388-356D-4929-9A86-1B1F5196E921}
|
||||
{19BC1F51-45E8-4BA6-854C-FDB7670AB4E3} = {91AF0388-356D-4929-9A86-1B1F5196E921}
|
||||
{6E9EFBDA-DC7F-4AFE-8BEF-D75C71FFB11F} = {F5F87A9D-C304-4833-B107-D666317F6931}
|
||||
{EDB842C6-67AE-4F0E-A9F2-09C2DF1024C9} = {F5F87A9D-C304-4833-B107-D666317F6931}
|
||||
{EC94C69F-F0E2-44B0-BE5E-C385BECB6AD3} = {EDB842C6-67AE-4F0E-A9F2-09C2DF1024C9}
|
||||
{AF551ED1-6F07-4035-8ADE-E647A9E533AB} = {F5F87A9D-C304-4833-B107-D666317F6931}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit dbde8023ed256ac69ae4b419422c936f78361653
|
||||
Subproject commit b366e29750a1b41352bc0ca0c7c47b618df36838
|
||||
40
Template.Tests/StartupTest.cs
Normal file
40
Template.Tests/StartupTest.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using NUnit.Framework;
|
||||
using Robust.Client;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.UnitTesting;
|
||||
using Template.Game;
|
||||
|
||||
namespace Template.Tests;
|
||||
|
||||
[TestFixture]
|
||||
public sealed class StartupTest : RobustIntegrationTest
|
||||
{
|
||||
[Test]
|
||||
public async Task GameStartsSingleplayer()
|
||||
{
|
||||
var client = StartClient(new ClientIntegrationOptions
|
||||
{
|
||||
ContentStart = true,
|
||||
ContentAssemblies = [typeof(EntryPoint).Assembly],
|
||||
Options = new GameControllerOptions
|
||||
{
|
||||
ContentModulePrefix = "Template.",
|
||||
ContentBuildDirectory = "Template.Game",
|
||||
LoadConfigAndUserData = false,
|
||||
LoadContentResources = false,
|
||||
},
|
||||
});
|
||||
|
||||
await client.WaitIdleAsync();
|
||||
|
||||
Assert.That(client.IsAlive, Is.True);
|
||||
Assert.That(client.UnhandledException, Is.Null);
|
||||
|
||||
await client.WaitAssertion(() =>
|
||||
{
|
||||
var baseClient = IoCManager.Resolve<IBaseClient>();
|
||||
|
||||
Assert.That(baseClient.RunLevel, Is.EqualTo(ClientRunLevel.SinglePlayerGame));
|
||||
});
|
||||
}
|
||||
}
|
||||
24
Template.Tests/Template.Tests.csproj
Normal file
24
Template.Tests/Template.Tests.csproj
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<WarningsAsErrors>nullable</WarningsAsErrors>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>..\bin\Template.Tests\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="NUnit" />
|
||||
<PackageReference Include="NUnit3TestAdapter" />
|
||||
<PackageReference Include="NUnit.Analyzers" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Template.Game\Template.Game.csproj" />
|
||||
<ProjectReference Include="..\RobustToolbox\Robust.UnitTesting\Robust.UnitTesting.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue