Skip to content

Commit

Permalink
Unit tests in Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
gleblebedev committed Jul 10, 2024
1 parent 4c23708 commit 67d1e21
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"ezpipeline": {
"version": "0.0.44",
"version": "0.0.45",
"commands": [
"ezpipeline"
]
Expand Down
45 changes: 36 additions & 9 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Restore tools
run: dotnet tool restore
Expand Down Expand Up @@ -48,9 +48,33 @@ jobs:
ANDROID_VERSION: ${{ env.ANDROID_VERSION }}
HAS_PLAY_KEYSTORE: ${{ env.HAS_PLAY_KEYSTORE }}

# ---------------------------------------------------------------------------------------
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore tools
run: dotnet tool restore

- name: Test in Debug configuration
working-directory: ./RbfxTemplate.Tests
run: dotnet test --configuration Debug --verbosity normal

- name: Test in Release configuration
working-directory: ./RbfxTemplate.Tests
run: dotnet test --configuration Release --verbosity normal

# ---------------------------------------------------------------------------------------
build_desktop:
needs: set_version
needs: [set_version, tests]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -83,7 +107,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Restore tools
run: dotnet tool restore
Expand Down Expand Up @@ -126,10 +150,8 @@ jobs:
shell: bash
# ---------------------------------------------------------------------------------------
build_android:
needs: set_version
needs: [set_version, tests]
runs-on: ubuntu-latest
env:
ANDROID_PACKAGENAME: "com.companyname.RbfxTemplate.android"

steps:
- uses: actions/checkout@v3
Expand All @@ -140,7 +162,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Restore tools
run: dotnet tool restore
Expand Down Expand Up @@ -179,6 +201,11 @@ jobs:
fileName: 'googleplay.jks'
encodedString: ${{ secrets.PLAY_KEYSTORE }}

- name: Extract ApplicationId from RbfxTemplate.Android.csproj
working-directory: ./RbfxTemplate.Android
run: |
dotnet tool run ezpipeline get-msbuild-property -i RbfxTemplate.Android.csproj -p ApplicationId -v ANDROID_PACKAGENAME
- name: Dotnet Publish
working-directory: ./RbfxTemplate.Android
run: |
Expand Down Expand Up @@ -226,7 +253,7 @@ jobs:
track: internal
# ---------------------------------------------------------------------------------------
build_uwp:
needs: set_version
needs: [set_version, tests]
runs-on: windows-latest

steps:
Expand All @@ -238,7 +265,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Add msbuild to PATH
uses: microsoft/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion RbfxTemplate.Tests/SampleUnitTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async Task TestMethod()
await Assert.ThrowsAsync<ArgumentException>(TestMethod);
}

[Fact]
[Fact(Skip = "This test demonstrates that async failing test handled properly")]
public async Task SampleFailingTest()
{
await RbfxTestFramework.ToMainThreadAsync();
Expand Down
1 change: 1 addition & 0 deletions RbfxTemplate.Tests/SimpleHeadlessApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public override void Setup()
{
base.Setup();
EngineParameters[Urho3D.EpHeadless] = true;
EngineParameters[Urho3D.EpSound] = false;
}

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion RbfxTemplate/UrhoApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ public override void Stop()
_pluginApplication.Ptr.UnloadPlugin();
_pluginApplication.Dispose();
}

#if DEBUG
_debugHud?.Dispose();
#endif
base.Stop();
}

Expand Down

0 comments on commit 67d1e21

Please sign in to comment.