Fix build and add tests (#6)
Some checks failed
Build & Test / build (ubuntu-latest) (push) Has been cancelled

This commit is contained in:
metalgearsloth 2026-08-06 22:25:17 +10:00 • committed by GitHub
parent 750039957c
commit 3c4568c59e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 138 additions and 16 deletions

44
.github/workflows/build-test.yml vendored Normal file
View 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

View file

@ -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

View 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));
});
}
}

View 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>

15
nuget.config Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="nuget">
<package pattern="*" />
</packageSource>
<packageSource key="dotnet-eng">
<package pattern="Microsoft.DotNet.RemoteExecutor" />
</packageSource>
</packageSourceMapping>
</configuration>