Skip to content

Commit

Permalink
Merge branch 'master' into CodeCoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberboss authored Dec 28, 2023
2 parents e016c81 + 3ccb916 commit d50c7cd
Show file tree
Hide file tree
Showing 125 changed files with 3,029 additions and 2,625 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
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 Down
2 changes: 1 addition & 1 deletion .github/workflows/compiler-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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 main/OpenDream.sln
- name: Build
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/test-tgs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test tgstation-server Integration

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

concurrency:
group: "tgs-${{ github.head_ref || github.run_id }}-${{ github.event_name }}"
cancel-in-progress: true

env:
OD_DOTNET_VERSION: 8
TGS_DOTNET_VERSION: 8
TGS_REFERENCE: dev

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Disable ptrace_scope
if: matrix.os == 'ubuntu-latest'
run: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

- name: Install gdb
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y gdb
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
${{ env.TGS_DOTNET_VERSION }}.0.x
${{ env.OD_DOTNET_VERSION }}.0.x
- name: Checkout OpenDream
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
submodules: true

- name: Pull engine updates
uses: space-wizards/[email protected]

- name: Update Engine Submodules
run: |
cd RobustToolbox/
git submodule update --init --recursive
- name: Checkout TGS
run: |
cd ..
git clone https://github.com/tgstation/tgstation-server --depth 1 --branch ${{ env.TGS_REFERENCE }}
- name: Build TGS Integration Tests
run: |
cd ../tgstation-server
dotnet build -c ReleaseNoWindows -p:TGS_HOST_NO_WEBPANEL=true tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj
- name: Run TGS OpenDream Tests
shell: bash
run: |
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="../../../../../../${{ 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
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Content.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<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" />
Expand Down
2 changes: 1 addition & 1 deletion 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 Down
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)
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("[ "\[" ]" == @"[")
16 changes: 16 additions & 0 deletions Content.Tests/RuntimeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using DMCompiler.Bytecode;
using NUnit.Framework;

namespace Content.Tests;

[TestFixture]
public sealed class RuntimeTests {
/// <summary>
/// Validates that the opcodes in DreamProcOpcode are all unique, such that none resolve to the same byte.
/// </summary>
[Test]
public void EnsureOpcodesUnique() {
Assert.That(Enum.GetValues<DreamProcOpcode>(), Is.Unique);
}
}
Loading

0 comments on commit d50c7cd

Please sign in to comment.