Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberboss committed Feb 3, 2024
2 parents 8d7ebeb + 1f04fdd commit 8c66a1d
Show file tree
Hide file tree
Showing 247 changed files with 8,023 additions and 6,657 deletions.
41 changes: 39 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Test
name: Build, Test & Release

on:
push:
Expand Down Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.101
dotnet-version: 8.0.100
- name: Install dependencies
run: dotnet restore
- name: Build
Expand All @@ -43,3 +43,40 @@ jobs:
run: |
$env:COMPlus_gcServer=1
dotnet test --no-build Content.IntegrationTests/Content.IntegrationTests.csproj -v n
- name: Publish OpenDream
if: github.event_name == 'push'
run: dotnet run --project OpenDreamPackageTool --no-build --configuration Release -- --server --hybrid-acz --platform ${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }} --output output/
- name: Publish DMCompiler
if: github.event_name == 'push'
run: dotnet publish DMCompiler -c Release -o output/DMCompiler_${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }}
- name: Gzip releases
if: github.event_name == 'push'
run: |
tar -czvf output/DMCompiler_${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }}.tar.gz -C output DMCompiler_${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }}
tar -czvf output/OpenDreamServer_${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }}.tar.gz -C output OpenDreamServer_${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }}
- name: Upload artifact
if: github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: build-${{ matrix.os }}
path: output/*.tar.gz
retention-days: 1

release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Publish latest release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
artifacts/*/*.tar.gz
6 changes: 3 additions & 3 deletions .github/workflows/compiler-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.101
dotnet-version: 8.0.100
- name: Install dependencies
run: dotnet restore main/OpenDream.sln
run: dotnet restore main/DMCompiler/DMCompiler.csproj
- name: Build
run: dotnet build main/OpenDream.sln --configuration Release --no-restore /m
run: dotnet build main/DMCompiler/DMCompiler.csproj --configuration Release --no-restore /m
- name: Compile TestGame
run: main\bin\DMCompiler\DMCompiler.exe main\TestGame\environment.dme
- name: Checkout Modified /tg/station
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test-tgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ concurrency:
cancel-in-progress: true

env:
OD_DOTNET_VERSION: 7
OD_DOTNET_VERSION: 8
TGS_DOTNET_VERSION: 8
TGS_REFERENCE: V6 # This will break after the V6 branch gets deleted during the TGS6 release cycle. When it does, change this to `dev`
TGS_REFERENCE: dev
TGS_TEST_GITHUB_TOKEN: ${{ secrets.TGS_TEST_GITHUB_TOKEN }}

jobs:
build:
Expand Down Expand Up @@ -71,7 +72,7 @@ jobs:
cd ../tgstation-server/tests/Tgstation.Server.Tests
export TGS_TEST_OD_EXCLUSIVE=true
export TGS_TEST_OD_ENGINE_VERSION=$GITHUB_SHA
export TGS_TEST_OD_GIT_DIRECTORY="../../../../../../OpenDream"
export TGS_TEST_OD_GIT_DIRECTORY="../../../../../../${{ github.event.repository.name }}"
export TGS_TEST_DATABASE_TYPE=Sqlite
export TGS_TEST_CONNECTION_STRING="Data Source=TGS.sqlite3;Mode=ReadWriteCreate"
dotnet test -c ReleaseNoWindows --no-build --filter Name=TestOpenDreamExclusiveTgsOperation --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --settings ../../build/ci.runsettings --results-directory ../../TestResults
8 changes: 4 additions & 4 deletions Content.IntegrationTests/Content.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<OutputPath>..\bin\Content.IntegrationTests\</OutputPath>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenDreamClient\OpenDreamClient.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/mob/proc/test()
return

/proc/RunTest()
/proc/test_verb_duplicate()
var/mob/m = new
m.verbs += /mob/proc/test
m.verbs += /mob/proc/test
Expand Down
1 change: 1 addition & 0 deletions Content.IntegrationTests/DMProject/code.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@
test_block()
test_color_matrix()
test_range()
test_verb_duplicate()
world.log << "IntegrationTests successful, /world/New() exiting..."
1 change: 1 addition & 0 deletions Content.IntegrationTests/DMProject/environment.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
#include "Tests/block.dm"
#include "Tests/color_matrix.dm"
#include "Tests/range.dm"
#include "Tests/verb_duplicate.dm"
#include "map.dmm"
#include "interface.dmf"
2 changes: 1 addition & 1 deletion Content.IntegrationTests/GameTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed class GameTests : ContentIntegrationTest {
public async Task NoRuntimesTest() {
var (client, server) = await StartConnectedServerClientPair();
await RunTicksSync(client, server, 1000);
Assert.IsTrue(server.IsAlive);
Assert.That(server.IsAlive);
var manager = server.ResolveDependency<DreamManager>();
if(manager.LastDMException is not null) {
Assert.Fail($"Runtime occurred on server boot: {manager.LastDMException}");
Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/SetupCompileDM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void Compile() {
Files = new() { DmEnvironment }
});

Assert.IsTrue(successfulCompile && File.Exists(CompiledProject), "Failed to compile DM test project!");
Assert.That(successfulCompile && File.Exists(CompiledProject), "Failed to compile DM test project!");
}

[OneTimeTearDown]
Expand Down
10 changes: 5 additions & 5 deletions Content.Tests/Content.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>..\bin\Content.Tests\</OutputPath>
Expand All @@ -11,10 +11,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.15.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit.ConsoleRunner" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DMCompiler\DMCompiler.csproj" />
Expand Down
76 changes: 36 additions & 40 deletions Content.Tests/ContentUnitTest.cs
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using OpenDreamClient;
using OpenDreamRuntime;
using OpenDreamRuntime.Rendering;
using OpenDreamShared;
using OpenDreamShared.Rendering;
using Robust.Shared.Analyzers;
using Robust.Shared.IoC;
using Robust.UnitTesting;
using EntryPoint = OpenDreamRuntime.EntryPoint;

namespace Content.Tests
{
[Virtual]
public class ContentUnitTest : RobustUnitTest
{
protected override void OverrideIoC()
{
base.OverrideIoC();

SharedOpenDreamIoC.Register();

if (Project == UnitTestProject.Server)
{
ServerContentIoC.Register(unitTests: true);
IoCManager.Register<IDreamMapManager, DummyDreamMapManager>();
}
else if (Project == UnitTestProject.Client)
{
ClientContentIoC.Register();
}
namespace Content.Tests;

[Virtual]
public class ContentUnitTest : RobustUnitTest {
protected override Type[] ExtraComponents { get; } = {
typeof(DMISpriteComponent),
typeof(DreamMobSightComponent)
};

protected override void OverrideIoC() {
base.OverrideIoC();

SharedOpenDreamIoC.Register();

if (Project == UnitTestProject.Server) {
ServerContentIoC.Register(unitTests: true);
IoCManager.Register<IDreamMapManager, DummyDreamMapManager>();
} else if (Project == UnitTestProject.Client) {
ClientContentIoC.Register();
}
}

protected override Assembly[] GetContentAssemblies()
{
var l = new List<Assembly>
{
typeof(OpenDreamShared.EntryPoint).Assembly
};

if (Project == UnitTestProject.Server)
{
l.Add(typeof(EntryPoint).Assembly);
}
else if (Project == UnitTestProject.Client)
{
l.Add(typeof(OpenDreamClient.EntryPoint).Assembly);
}

l.Add(typeof(ContentUnitTest).Assembly);

return l.ToArray();
protected override Assembly[] GetContentAssemblies() {
var l = new List<Assembly> {
typeof(OpenDreamShared.EntryPoint).Assembly
};

if (Project == UnitTestProject.Server) {
l.Add(typeof(EntryPoint).Assembly);
} else if (Project == UnitTestProject.Client) {
l.Add(typeof(OpenDreamClient.EntryPoint).Assembly);
}

l.Add(typeof(ContentUnitTest).Assembly);

return l.ToArray();
}
}

6 changes: 6 additions & 0 deletions Content.Tests/DMProject/Tests/Builtins/isnull.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/proc/RunTest()
ASSERT(isnull(null))
var/obj/O = new()
ASSERT(!isnull(O))
del(O)
ASSERT(isnull(O))
3 changes: 2 additions & 1 deletion Content.Tests/DMProject/Tests/Regex/regex_defer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
/proc/RunTest()
var/regex/R = regex(@"\w+")
var/result = R.Replace("Hello, there", /proc/regex_callback)
ASSERT(result == "good, there")
ASSERT(result == "good, there")
ASSERT(R.next == 5)
8 changes: 8 additions & 0 deletions Content.Tests/DMProject/Tests/Special Procs/nameof/nameof.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
var/global/foobar
/proc/meep()

/datum/test/two
var/name = "some name"

/datum/test
var/datum/test/two/two

/datum/test/proc/testarg(atom/movable/A, B)
ASSERT(nameof(two) == "two")
ASSERT(nameof(A) == "A")
ASSERT(nameof(B) == "B")

Expand All @@ -13,4 +20,5 @@ var/global/foobar
ASSERT(nameof(/datum/test) == "test")
ASSERT(nameof(global.foobar) == "foobar")
var/datum/test/T = new
ASSERT(nameof(T.two.name) == "name")
T.testarg(new /datum) // Just for fun we won't pass the arg's declared type
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

//Issue OD#996, kinda: https://github.com/OpenDreamProject/OpenDream/issues/996

/proc/RunTest()
var/x = 5
switch(x)
if(1)
CRASH("Strange branch chosen in switch statement")
if(4)
CRASH("Strange branch chosen in switch statement")
else if(x == 3)
CRASH("Parser failed to understand 'else if' in switch block")
else
return
CRASH("Parser failed to understand 'else if' in switch block")
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//COMPILE ERROR
//test to make sure SuspiciousSwitchCase is working

#pragma SuspiciousSwitchCase error

/proc/RunTest()
var/x = 5
switch(x)
if(1)
return
if(4)
return
else if(x == 3)
return
else
return
6 changes: 6 additions & 0 deletions Content.Tests/DMProject/Tests/Text/LongString.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/proc/RunTest()
ASSERT({"A
B
C"} == "A\nB\nC")

ASSERT({" " "} == " \" ")
4 changes: 4 additions & 0 deletions Content.Tests/DMProject/Tests/Text/NestedEscapedBracket.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Issue #700

/proc/RunTest()
ASSERT("[ "\[" ]" == @"[")
34 changes: 34 additions & 0 deletions Content.Tests/DMProject/Tests/Text/Splittext.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/proc/RunTest()
var/test_text = "The average of 1, 2, 3, 4, 5 is: 3"
var/list/test1 = splittext(test_text, " ")
var/list/test1_expected = list("The","average","of","1,","2,","3,","4,","5","is:","3")
ASSERT(test1 ~= test1_expected)

var/list/test2 = splittext(test_text, " ", 5)
var/test2_expected = list("average","of","1,","2,","3,","4,","5","is:","3")
ASSERT(test2 ~= test2_expected)

var/list/test3 = splittext(test_text, " ", 5, 10)
var/test3_expected = list("avera")
ASSERT(test3 ~= test3_expected)

var/list/test4 = splittext(test_text, " ", 10, 20)
var/test4_expected = list("ge","of","1,","2")
ASSERT(test4 ~= test4_expected)

var/list/test5 = splittext(test_text, " ", 10, 20, 1)
var/test5_expected = list("ge"," ","of"," ","1,"," ","2")
ASSERT(test5 ~= test5_expected)

//it's regex time
var/test6 = splittext(test_text, regex(@"\d"))
var/test6_expected = list("The average of ",", ",", ",", ",", "," is: ","")
ASSERT(test6 ~= test6_expected)

var/test7 = splittext(test_text, regex(@"\d"), 5, 30)
var/test7_expected = list("average of ",", ",", ",", ",", "," ")
ASSERT(test7 ~= test7_expected)

var/test8 = splittext(test_text, regex(@"\d"), 5, 30, 1)
var/test8_expected = list("average of ","1",", ","2",", ","3",", ","4",", ","5"," ")
ASSERT(test8 ~= test8_expected)
Loading

0 comments on commit 8c66a1d

Please sign in to comment.