game_version_update_patch #1111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
repository_dispatch: | |
types: [game_version_update, game_version_update_patch] | |
push: | |
branches: | |
- dev | |
paths: | |
- '.github/workflows/test.yml' | |
- 'src/**' | |
- 'tests/**' | |
- 'build/**' | |
pull_request: | |
branches: | |
- dev | |
# will be triggered when undrafting or requesting review | |
types: [review_requested, ready_for_review] | |
paths: | |
- '.github/workflows/test.yml' | |
- 'src/**' | |
- 'tests/**' | |
- 'build/**' | |
workflow_dispatch: | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
TEST_FILTERS: "+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]* -[*]System.Diagnostics.CodeAnalysis* -[*]BUTR.DependencyInjection* -[*]Bannerlord.BUTR.Shared* -[*]HarmonyLib.BUTR*" | |
jobs: | |
test: | |
name: Test | |
runs-on: windows-latest | |
steps: | |
- name: Tests Setup | |
uses: butr/actions-tests-setup@v1 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
steam-login: ${{secrets.STEAM_LOGIN}} | |
steam-password: ${{secrets.STEAM_PASSWORD}} | |
stable-version: ${{secrets.SYNCED_GAME_STABLE_VERSION}} | |
beta-version: ${{secrets.SYNCED_GAME_BETA_VERSION}} | |
stable-directory: 'bannerlord-stable' | |
beta-directory: 'bannerlord-beta' | |
steam-depotid: '261551 261552' | |
- name: Test | |
run: >- | |
$stable_version=$env:STABLE_VERSION; | |
$stable_version=$stable_version.substring(1); | |
$beta_version=$env:BETA_VERSION; | |
$beta_version=$beta_version.substring(1); | |
dotnet test tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj --configuration Debug -p:StableVersion=$stable_version -p:GameFolder="$PWD/bannerlord-stable"; | |
dotnet test tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj --configuration Release -p:StableVersion=$stable_version -p:GameFolder="$PWD/bannerlord-stable"; | |
dotnet test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Stable_Debug -p:StableVersion=$stable_version -p:GameFolder="$PWD/bannerlord-stable"; | |
dotnet test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Stable_Release -p:StableVersion=$stable_version -p:GameFolder="$PWD/bannerlord-stable"; | |
dotnet test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Beta_Debug -p:BetaVersion=$beta_version -p:GameFolder="$PWD/bannerlord-beta"; | |
dotnet test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Beta_Release -p:BetaVersion=$beta_version -p:GameFolder="$PWD/bannerlord-beta"; | |
env: | |
STABLE_VERSION: ${{secrets.SYNCED_GAME_STABLE_VERSION}} | |
BETA_VERSION: ${{secrets.SYNCED_GAME_BETA_VERSION}} | |
shell: pwsh | |
- name: Test Coverage | |
run: >- | |
opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj --configuration Debug --no-build" -filter:"${{env.TEST_FILTERS}}" -excludebyattribute:"*.ExcludeFromCodeCoverage*" -output:coverage_butterlib_stable_debug.xml -mergebyhash; | |
opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj --configuration Release --no-build" -filter:"${{env.TEST_FILTERS}}" -excludebyattribute:"*.ExcludeFromCodeCoverage*" -output:coverage_butterlib_stable_release.xml -mergebyhash; | |
opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Stable_Debug --no-build" -filter:"${{env.TEST_FILTERS}}" -excludebyattribute:"*.ExcludeFromCodeCoverage*" -output:coverage_butterlib_impl_stable_debug.xml -mergebyhash; | |
opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Stable_Release --no-build" -filter:"${{env.TEST_FILTERS}}" -excludebyattribute:"*.ExcludeFromCodeCoverage*" -output:coverage_butterlib_impl_stable_release.xml -mergebyhash; | |
opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Beta_Debug --no-build" -filter:"${{env.TEST_FILTERS}}" -excludebyattribute:"*.ExcludeFromCodeCoverage*" -output:coverage_butterlib_impl_beta_debug.xml -mergebyhash; | |
opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj --configuration Beta_Release --no-build" -filter:"${{env.TEST_FILTERS}}" -excludebyattribute:"*.ExcludeFromCodeCoverage*" -output:coverage_butterlib_impl_beta_release.xml -mergebyhash; | |
shell: pwsh | |
- name: ReportGenerator | |
uses: danielpalme/[email protected] | |
with: | |
reports: 'coverage_butterlib_stable_debug.xml;coverage_butterlib_stable_release.xml;coverage_butterlib_impl_stable_debug.xml;coverage_butterlib_impl_stable_release.xml;coverage_butterlib_impl_beta_debug.xml;coverage_butterlib_impl_beta_release.xml;' | |
targetdir: 'coveragereport' | |
reporttypes: 'HtmlInline;Cobertura' | |
sourcedirs: './' | |
tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version. | |
- name: Upload ReportGenerator to GitHub | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coveragereport | |
- name: Upload ReportGenerator to CodeCov | |
uses: codecov/[email protected] | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
file: coveragereport/Cobertura.xml | |
fail_ci_if_error: true |