diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..047864cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "daily" + ignore: + - dependency-name: "Newtonsoft.Json" + - dependency-name: "Bannerlord.ReferenceAssemblies.*" + - dependency-name: "Lib.Harmony" + - dependency-name: "Microsoft.Extensions.*" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml index 8e3e3262..0abe6248 100644 --- a/.github/workflows/docfx.yml +++ b/.github/workflows/docfx.yml @@ -25,39 +25,10 @@ jobs: name: DocFX documentation runs-on: windows-latest steps: - - name: Checkout Repository - uses: actions/checkout@v2 + - name: DocFX Setup + uses: butr/actions-docfx-setup@v1.1 with: - submodules: recursive - fetch-depth: 0 - - - name: Setup .NET Core - uses: actions/setup-dotnet@master - with: - dotnet-version: 3.1.x - - name: Setup .NET Core - uses: actions/setup-dotnet@master - with: - dotnet-version: 5.0.x - - name: Setup BUTR GPR - uses: actions/setup-dotnet@master - with: - source-url: https://nuget.pkg.github.com/BUTR/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - name: Setup NuGet - uses: nuget/setup-nuget@v1 - with: - nuget-version: 'latest' - - - name: Generating Newtonsoft.Json xref maps - run: >- - dotnet run -p build/SandcastleXrefGenerator -- ` - Newtonsoft.Json 11.0.2 netstandard2.0 ` - https://www.newtonsoft.com/json/help/html/ ` - $PWD/docs/xrefs/Newtonsoft.Json-xrefmap.yml - shell: pwsh + github-token: ${{secrets.GITHUB_TOKEN}} - name: Build Bannerlord.ButterLib and DocFx.Plugin.LastModified run: >- diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e8ba3b6d..1685be7f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,20 +19,10 @@ jobs: name: Build for NexusMods (Stable) runs-on: ubuntu-latest steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@master + - name: Setup + uses: butr/actions-common-setup@v1.2 with: - dotnet-version: 5.0.x - - - name: Setup BUTR GPR - uses: actions/setup-dotnet@master - with: - source-url: https://nuget.pkg.github.com/BUTR/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.GITHUB_TOKEN}} - name: Build Bannerlord.ButterLib Module run: | @@ -88,20 +78,10 @@ jobs: runs-on: ubuntu-latest if: ${{false}} steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@master + - name: Setup + uses: butr/actions-common-setup@v1.2 with: - dotnet-version: 3.1.x - - - name: Setup BUTR GPR - uses: actions/setup-dotnet@master - with: - source-url: https://nuget.pkg.github.com/BUTR/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.GITHUB_TOKEN}} - name: Download stable bannerlord folder uses: actions/download-artifact@v2 @@ -162,25 +142,10 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@master + - name: Setup + uses: butr/actions-common-setup@v1.2 with: - dotnet-version: 5.0.x - - - name: Setup .NET Core - uses: actions/setup-dotnet@master - with: - dotnet-version: 3.1.x - - - name: Setup BUTR GPR - uses: actions/setup-dotnet@master - with: - source-url: https://nuget.pkg.github.com/BUTR/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.GITHUB_TOKEN}} - name: Pack Bannerlord.ButterLib (Release) run: dotnet pack src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj --configuration Release -o "./packages" @@ -222,20 +187,10 @@ jobs: runs-on: ubuntu-latest needs: build steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@master - with: - dotnet-version: 3.1.x - - - name: Setup BUTR GPR - uses: actions/setup-dotnet@master + - name: Setup + uses: butr/actions-common-setup@v1.2 with: - source-url: https://nuget.pkg.github.com/BUTR/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.GITHUB_TOKEN}} - name: Download stable bannerlord folder uses: actions/download-artifact@v2 diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index 2c5c1980..14e57449 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -6,11 +6,11 @@ on: # If a new version of the game is released, test the repo against it. # This way we will always know if the repo is broken on a new update. - game_version_update -# push: -# branches: -# - dev -# paths: -# - '.github/workflows/test-full.yml' + push: + branches: + - dev + paths: + - '.github/workflows/test-full.yml' # - 'src/**' # - 'tests/**' # - 'build/**' @@ -32,62 +32,23 @@ env: 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 Fully runs-on: windows-latest steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@master - with: - dotnet-version: 5.0.x - - - name: Setup BUTR GPR - uses: actions/setup-dotnet@master - with: - source-url: https://nuget.pkg.github.com/BUTR/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - name: Download DepotDownloader_2.3.6 - uses: i3h/download-release-asset@v1 + - name: Tests Setup + uses: butr/actions-tests-setup@v1.5 with: - owner: SteamRE - repo: DepotDownloader - tag: DepotDownloader_2.3.6 - file: depotdownloader-2.3.6.zip - - - name: Extract DepotDownloader_2.3.6 - uses: DuckSoft/extract-7z-action@v1.0 - with: - pathSource: depotdownloader-2.3.6.zip - pathTarget: depotdownloader - - - name: Download opencover.4.7.922 - uses: i3h/download-release-asset@v1 - with: - owner: OpenCover - repo: opencover - tag: 4.7.922 - file: opencover.4.7.922.zip - - - name: Extract opencover.4.7.922 - uses: DuckSoft/extract-7z-action@v1.0 - with: - pathSource: opencover.4.7.922.zip - pathTarget: opencover + github-token: ${{secrets.GITHUB_TOKEN}} - name: Test run: | $testproj = "$PWD/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj"; $testprojimpl = "$PWD/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj"; - $filter = "+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]*"; - $gameversions = Get-Content -Path supported-game-versions.txt; For ($i = 0; $i -le $gameversions.Length - 1; $i++) @@ -100,20 +61,20 @@ jobs: dotnet depotdownloader/DepotDownloader.dll -app 261550 -depot 261551 -beta $gameversion -filelist "$PWD/.github/resources/FileFilters.regexp" -username "${{secrets.STEAM_LOGIN}}" -password "${{secrets.STEAM_PASSWORD}}" -dir "$gamefolder"; } - opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testproj --configuration Debug -p:OverrideGameVersion=$($gameversions[-1]) -p:GameFolder=""$PWD/bannerlord-$($gameversions[-1])""" -filter:"$filter" -output:"coverage_butterlib_$($gameversions[-1])_debug.xml" -mergebyhash; - opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testproj --configuration Release -p:OverrideGameVersion=$($gameversions[-1]) -p:GameFolder=""$PWD/bannerlord-$($gameversions[-1])""" -filter:"$filter" -output:"coverage_butterlib_$($gameversions[-1])_release.xml" -mergebyhash; + opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testproj --configuration Debug -p:OverrideGameVersion=$($gameversions[-1]) -p:GameFolder=""$PWD/bannerlord-$($gameversions[-1])""" -filter:"${{env.TEST_FILTERS}}" -output:"coverage_butterlib_$($gameversions[-1])_debug.xml" -mergebyhash; + opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testproj --configuration Release -p:OverrideGameVersion=$($gameversions[-1]) -p:GameFolder=""$PWD/bannerlord-$($gameversions[-1])""" -filter:"${{env.TEST_FILTERS}}" -output:"coverage_butterlib_$($gameversions[-1])_release.xml" -mergebyhash; For ($i = 0; $i -le $gameversions.Length - 1; $i++) { $gameversion = $gameversions[$i]; $gamefolder = "$PWD/bannerlord-$gameversion"; - opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testprojimpl --configuration Debug -p:OverrideGameVersion=$gameversion -p:GameFolder=""$gamefolder""" -filter:"$filter" -output:"coverage_butterlib_impl_$($gameversion)_debug.xml" -mergebyhash; - opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testprojimpl --configuration Release -p:OverrideGameVersion=$gameversion -p:GameFolder=""$gamefolder""" -filter:"$filter" -output:"coverage_butterlib_impl_$($gameversion)_release.xml" -mergebyhash; + opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testprojimpl --configuration Debug -p:OverrideGameVersion=$gameversion -p:GameFolder=""$gamefolder""" -filter:"${{env.TEST_FILTERS}}" -output:"coverage_butterlib_impl_$($gameversion)_debug.xml" -mergebyhash; + opencover/OpenCover.Console.exe -register -target:"dotnet.exe" -targetargs:"test $testprojimpl --configuration Release -p:OverrideGameVersion=$gameversion -p:GameFolder=""$gamefolder""" -filter:"${{env.TEST_FILTERS}}" -output:"coverage_butterlib_impl_$($gameversion)_release.xml" -mergebyhash; } shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@4.6.1 + uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12 with: reports: '*.xml' targetdir: 'coveragereport' @@ -128,7 +89,7 @@ jobs: path: coveragereport - name: Upload ReportGenerator to CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2.0.2 with: token: ${{secrets.CODECOV_TOKEN}} file: coveragereport/Cobertura.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8d15e569..b3e05d5f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,65 +32,23 @@ env: 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: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@master - with: - dotnet-version: 5.0.x - - - name: Setup BUTR GPR - uses: actions/setup-dotnet@master - with: - source-url: https://nuget.pkg.github.com/BUTR/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - name: Download DepotDownloader_2.3.6 - uses: i3h/download-release-asset@v1 - with: - owner: SteamRE - repo: DepotDownloader - tag: DepotDownloader_2.3.6 - file: depotdownloader-2.3.6.zip - - - name: Extract DepotDownloader_2.3.6 - uses: DuckSoft/extract-7z-action@v1.0 - with: - pathSource: depotdownloader-2.3.6.zip - pathTarget: depotdownloader - - - name: Download Bannerlord binaries (Stable) - run: >- - dotnet depotdownloader/DepotDownloader.dll -app 261550 -depot 261551 -beta ${{secrets.SYNCED_GAME_STABLE_VERSION}} -username ${{secrets.STEAM_LOGIN}} - -password ${{secrets.STEAM_PASSWORD}} -filelist ./.github/resources/FileFilters.regexp -dir bannerlord-stable - shell: pwsh - - name: Download Bannerlord binaries (Beta) - run: >- - dotnet depotdownloader/DepotDownloader.dll -app 261550 -depot 261551 -beta ${{secrets.SYNCED_GAME_BETA_VERSION}} -username ${{secrets.STEAM_LOGIN}} - -password ${{secrets.STEAM_PASSWORD}} -filelist ./.github/resources/FileFilters.regexp -dir bannerlord-beta - shell: pwsh - - - name: Download opencover.4.7.922 - uses: i3h/download-release-asset@v1 - with: - owner: OpenCover - repo: opencover - tag: 4.7.922 - file: opencover.4.7.922.zip - - - name: Extract opencover.4.7.922 - uses: DuckSoft/extract-7z-action@v1.0 + - name: Tests Setup + uses: butr/actions-tests-setup@v1.4 with: - pathSource: opencover.4.7.922.zip - pathTarget: opencover + 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' - name: Test run: >- @@ -111,16 +69,16 @@ jobs: - 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:"+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]*" -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:"+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]*" -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:"+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]*" -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:"+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]*" -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:"+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]*" -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:"+[Bannerlord.ButterLib*]* -[Bannerlord.ButterLib*.Tests]*" -output:coverage_butterlib_impl_beta_release.xml -mergebyhash; + 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}}" -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}}" -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}}" -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}}" -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}}" -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}}" -output:coverage_butterlib_impl_beta_release.xml -mergebyhash; shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@4.6.1 + uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12 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' @@ -135,7 +93,7 @@ jobs: path: coveragereport - name: Upload ReportGenerator to CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2.0.2 with: token: ${{secrets.CODECOV_TOKEN}} file: coveragereport/Cobertura.xml diff --git a/README.md b/README.md index 3607336b..6658febd 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,51 @@ # Bannerlord.ButterLib
- + + - - + + + + + + + + + + + - - - + + + + + + + + + - - - + + - + + - + + - + + - + + - + +
diff --git a/build/common.props b/build/common.props index 591f319f..381ac209 100644 --- a/build/common.props +++ b/build/common.props @@ -4,15 +4,15 @@