Skip to content

Commit 7dd3418

Browse files
authored
Reintstate the TGS test with a retry handler this time (#2267)
1 parent b09f755 commit 7dd3418

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Rerun Flaky Tests
2+
on:
3+
workflow_run:
4+
workflows: ["Test tgstation-server Integration"]
5+
types:
6+
- completed
7+
jobs:
8+
rerun_flaky_tests:
9+
name: Rerun Flaky Tests
10+
runs-on: ubuntu-latest
11+
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt < 5 }}
12+
steps:
13+
- name: Rerun Flaky Tests
14+
uses: actions/github-script@v7
15+
with:
16+
script: |
17+
await github.rest.actions.reRunWorkflowFailedJobs({
18+
owner: context.repo.owner,
19+
repo: context.repo.repo,
20+
run_id: context.payload.workflow_run.id,
21+
});

.github/workflows/test-tgs.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Test tgstation-server Integration
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
concurrency:
10+
group: "tgs-${{ github.head_ref || github.run_id }}-${{ github.event_name }}"
11+
cancel-in-progress: true
12+
13+
env:
14+
OD_DOTNET_VERSION: 9
15+
TGS_DOTNET_VERSION: 8
16+
TGS_NODE_VERSION: 20.x
17+
TGS_REFERENCE: dev
18+
TGS_TEST_GITHUB_TOKEN: ${{ github.token }}
19+
20+
jobs:
21+
build:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [ ubuntu-latest, windows-latest ]
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- name: Disable ptrace_scope
29+
if: matrix.os == 'ubuntu-latest'
30+
run: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
31+
32+
- name: Install gdb and libgdiplus
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y gdb libgdiplus
37+
38+
- name: Setup dotnet
39+
uses: actions/setup-dotnet@v4
40+
with:
41+
dotnet-version: |
42+
${{ env.TGS_DOTNET_VERSION }}.0.x
43+
${{ env.OD_DOTNET_VERSION }}.0.x
44+
45+
- name: Setup Node.JS
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: ${{ env.TGS_NODE_VERSION }}
49+
50+
- name: Enable Corepack
51+
run: corepack enable
52+
53+
- name: Checkout OpenDream
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
fetch-tags: true
58+
submodules: true
59+
60+
- name: Pull engine updates
61+
uses: space-wizards/submodule-dependency@v0.1.5
62+
63+
- name: Update Engine Submodules
64+
run: |
65+
cd RobustToolbox/
66+
git submodule update --init --recursive
67+
68+
- name: Checkout TGS
69+
run: |
70+
cd ..
71+
git clone https://github.com/tgstation/tgstation-server --depth 1 --branch ${{ env.TGS_REFERENCE }}
72+
73+
- name: Build TGS Integration Tests
74+
env:
75+
TGS_TELEMETRY_KEY_FILE: fake.txt
76+
shell: bash
77+
run: |
78+
cd ../tgstation-server
79+
echo "fake" > src/Tgstation.Server.Host/${{ env.TGS_TELEMETRY_KEY_FILE }}
80+
dotnet build -c ReleaseNoWindows -p:TGS_HOST_NO_WEBPANEL=true tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj
81+
82+
- name: Run TGS OpenDream Tests
83+
shell: bash
84+
run: |
85+
cd ../tgstation-server/tests/Tgstation.Server.Tests
86+
export TGS_TEST_OD_EXCLUSIVE=true
87+
export TGS_TEST_OD_ENGINE_VERSION=$GITHUB_SHA
88+
export TGS_TEST_OD_GIT_DIRECTORY="../../../../../../${{ github.event.repository.name }}"
89+
export TGS_TEST_DATABASE_TYPE=Sqlite
90+
export TGS_TEST_CONNECTION_STRING="Data Source=TGS.sqlite3;Mode=ReadWriteCreate"
91+
dotnet test -c ReleaseNoWindows --no-build --filter Name=TestOpenDreamExclusiveTgsOperation --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --settings ../../build/ci.runsettings --results-directory ../../TestResults

OpenDreamRuntime/DreamManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ public sealed partial class DreamManager {
7171
//TODO This arg is awful and temporary until RT supports cvar overrides in unit tests
7272
public void PreInitialize(string? jsonPath) {
7373
_sawmill = Logger.GetSawmill("opendream");
74+
#if !DISABLE_BYOND_API
7475
ByondApi.ByondApi.Initialize(this, _atomManager, _dreamMapManager, _objectTree);
76+
#endif
7577

7678
InitializeConnectionManager();
7779
_dreamResourceManager.PreInitialize();

OpenDreamRuntime/OpenDreamRuntime.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<Configurations>Debug;Release;Tools</Configurations>
77
<Platforms>AnyCPU</Platforms>
88
</PropertyGroup>
9+
<PropertyGroup Condition="'$(TgsEngineBuild)'=='True'">
10+
<DefineConstants>$(DefineConstants);DISABLE_BYOND_API</DefineConstants>
11+
</PropertyGroup>
912
<ItemGroup>
1013
<ProjectReference Include="..\DMCompiler\DMCompiler.csproj" />
1114
<ProjectReference Include="..\OpenDreamPackaging\OpenDreamPackaging.csproj" />

OpenDreamRuntime/Procs/DMOpcodeHandlers.CallExt.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ private static unsafe ProcStatus CallExtByond(
3838
DreamProcArguments arguments) {
3939
// TODO: Don't allocate string copy
4040
// TODO: Handle stdcall (do we care?)
41+
#if DISABLE_BYOND_API
42+
throw new Exception("Server was not compiled with BYOND API support!");
43+
#else
4144
var entryPoint = (delegate* unmanaged[Cdecl]<uint, ByondApi.CByondValue*, ByondApi.CByondValue>)
4245
DllHelper.ResolveDllTarget(state.Proc.DreamResourceManager, dllName, procName["byond:".Length..]);
4346

@@ -53,6 +56,7 @@ private static unsafe ProcStatus CallExtByond(
5356

5457
state.Push(Api.ValueFromDreamApi(result));
5558
return ProcStatus.Continue;
59+
#endif
5660
}
5761

5862
private static unsafe ProcStatus CallExtString(

0 commit comments

Comments
 (0)