Skip to content

Commit 3f928d5

Browse files
authored
Merge pull request #890 from C7-Game/twrner/trying-ci-timeouts
Put a 5 minute timeout on CI test runs and improve some debugging aspects
2 parents cae4484 + 70f5653 commit 3f928d5

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

.github/workflows/export-c7.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ jobs:
5252
godot -v --headless --export${BUILD_SUFFIX} "Windows Desktop" ../build/${FOLDER_NAME}/${EXPORT_NAME}.exe
5353
- name: Run tests
5454
run: |
55-
dotnet test C7
55+
dotnet test C7 --blame-hang-dump-type full --blame-hang-timeout 5m --logger:"console;verbosity=detailed"
56+
- name: Upload Hang Dump
57+
if: failure()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: hang-dump-${{ github.job }}-${{ github.run_id }}
61+
path: |
62+
EngineTests/TestResults/**/*.dmp
63+
EngineTests/TestResults/**/*.xml
5664
- name: Verify formatting (`run dotnet format C7/C7.sln whitespace` to fix)
5765
run: |
5866
dotnet format C7/C7.sln whitespace --verify-no-changes
@@ -91,7 +99,15 @@ jobs:
9199
godot -v --headless --export${BUILD_SUFFIX} "Linux/X11" ../build/${FOLDER_NAME}/${EXPORT_NAME}.x86_64
92100
- name: Run tests
93101
run: |
94-
dotnet test C7
102+
dotnet test C7 --blame-hang-dump-type full --blame-hang-timeout 5m --logger:"console;verbosity=detailed"
103+
- name: Upload Hang Dump
104+
if: failure()
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: hang-dump-${{ github.job }}-${{ github.run_id }}
108+
path: |
109+
EngineTests/TestResults/**/*.dmp
110+
EngineTests/TestResults/**/*.xml
95111
- name: Verify formatting (`run dotnet format C7/C7.sln whitespace` to fix)
96112
run: |
97113
dotnet format C7/C7.sln whitespace --verify-no-changes
@@ -133,7 +149,15 @@ jobs:
133149
godot -v --headless --export${BUILD_SUFFIX} "macOS" ../build/${FOLDER_NAME}.zip
134150
- name: Run tests
135151
run: |
136-
dotnet test C7
152+
dotnet test C7 --blame-hang-dump-type full --blame-hang-timeout 5m --logger:"console;verbosity=detailed"
153+
- name: Upload Hang Dump
154+
if: failure()
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: hang-dump-${{ github.job }}-${{ github.run_id }}
158+
path: |
159+
EngineTests/TestResults/**/*.dmp
160+
EngineTests/TestResults/**/*.xml
137161
- name: Verify formatting (`run dotnet format C7/C7.sln whitespace` to fix)
138162
run: |
139163
dotnet format C7/C7.sln whitespace --verify-no-changes

EngineTests/EngineTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<ItemGroup>
99
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
11+
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
1112
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.8" />
1213
<PackageReference Include="xunit" Version="2.4.1" />
1314
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">

EngineTests/GameData/SaveTest.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Newtonsoft.Json.Linq;
1313
using QueryCiv3;
1414
using Xunit;
15+
using Serilog;
1516

1617
namespace EngineTests.GameData;
1718

@@ -169,7 +170,12 @@ private void WaitForStartTurnMessage() {
169170
switch (msg) {
170171
case MsgStartTurn mST:
171172
return;
173+
case MsgWarDeclaration mWD:
174+
continue;
175+
case MsgShowTemporaryPopup mSTP:
176+
continue;
172177
default:
178+
throw new Exception($"{msg}");
173179
continue;
174180
}
175181
}
@@ -229,6 +235,11 @@ private void CheckAiInvariants() {
229235
[InlineData(SaveType.basic, "basic")]
230236
[InlineData(SaveType.standalone, "standalone")]
231237
public void SimpleGame(SaveType saveType, string outputFilePostfix) {
238+
Log.Logger = new LoggerConfiguration()
239+
.WriteTo.Console(outputTemplate: "[{Level:u3}] {Timestamp:HH:mm:ss} {SourceContext}: {Message:lj} {NewLine}{Exception}")
240+
.MinimumLevel.Information()
241+
.CreateLogger();
242+
232243
SaveGame developerSave = GetSave(saveType);
233244

234245
new MsgSetAnimationsEnabled(false).send();

0 commit comments

Comments
 (0)