StrongName the assemblies to allow [InternalsVisibleTo] to work correctly in test projects #465
Workflow file for this run
This file contains hidden or 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: .NET | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| # Required by release-please | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| if: github.ref == 'refs/heads/master' | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| release-type: simple | |
| - name: Set default build number | |
| run: | | |
| # https://stackoverflow.com/questions/8653126/how-to-increment-version-number-in-a-shell-script | |
| BUILD_VERSION=$(cat version.txt | awk -F. -v OFS=. '{$NF=$NF+1;print}')-pre.${{ github.run_number }} | |
| echo "APP_BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_ENV | |
| - name: Update build number | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: | | |
| RELEASE_VERSION=${{ steps.release.outputs.tag_name }} | |
| echo "APP_BUILD_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV | |
| - name: Final build version | |
| run: | | |
| echo ${{ env.APP_BUILD_VERSION }} | |
| outputs: | |
| build_version: ${{ env.APP_BUILD_VERSION }} | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-22.04, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| needs: [version] | |
| env: | |
| APP_BUILD_VERSION: ${{ needs.version.outputs.build_version }} | |
| # force color output for dotnet | |
| DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1" | |
| TERM: "xterm" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET 9.0 | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: 9.x | |
| - name: Setup .NET 3.1.x | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: "3.1.x" | |
| - name: Configure NuGet cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Package (debug) | |
| run: dotnet pack -p:PackageVersion=${{ env.APP_BUILD_VERSION }} | |
| - name: Package (release) | |
| run: dotnet pack -c Release -p:PackageVersion=${{ env.APP_BUILD_VERSION }} | |
| - name: Unit test | |
| run: | | |
| dotnet test -p:PackageVersion=${{ env.APP_BUILD_VERSION }} test/TestLogger.UnitTests/TestLogger.UnitTests.csproj -p:CollectCoverage=true -p:CoverletOutputFormat=opencover | |
| dotnet test -p:PackageVersion=${{ env.APP_BUILD_VERSION }} test/NUnit.Xml.TestLogger.UnitTests/NUnit.Xml.TestLogger.UnitTests.csproj -p:CollectCoverage=true -p:CoverletOutputFormat=opencover | |
| dotnet test -p:PackageVersion=${{ env.APP_BUILD_VERSION }} test/JUnit.Xml.TestLogger.UnitTests/JUnit.Xml.TestLogger.UnitTests.csproj -p:CollectCoverage=true -p:CoverletOutputFormat=opencover | |
| - name: Acceptance test | |
| run: | | |
| echo "Running acceptance tests with verbose output..." | |
| dotnet test -p:PackageVersion=${{ env.APP_BUILD_VERSION }} test/TestLogger.AcceptanceTests/TestLogger.AcceptanceTests.csproj --logger "console;verbosity=detailed" --blame | |
| dotnet test -p:PackageVersion=${{ env.APP_BUILD_VERSION }} test/Xunit.Xml.TestLogger.AcceptanceTests/Xunit.Xml.TestLogger.AcceptanceTests.csproj --logger "console;verbosity=detailed" --blame | |
| dotnet test -p:PackageVersion=${{ env.APP_BUILD_VERSION }} test/NUnit.Xml.TestLogger.AcceptanceTests/NUnit.Xml.TestLogger.AcceptanceTests.csproj --logger "console;verbosity=detailed" --blame | |
| dotnet test -p:PackageVersion=${{ env.APP_BUILD_VERSION }} test/JUnit.Xml.TestLogger.AcceptanceTests/JUnit.Xml.TestLogger.AcceptanceTests.csproj --logger "console;verbosity=detailed" --blame | |
| - name: Upload Debug Files on Fail | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Acceptance Test Failure Debug Files | |
| retention-days: 5 | |
| path: | | |
| **/*.verified.txt | |
| **/*.received.txt | |
| **/test-results-*.xml | |
| **/test-results-*.json | |
| **/*.log | |
| test/assets/**/bin/Debug/netcoreapp3.1/ | |
| test/assets/**/bin/Debug/net9.0/ | |
| - name: Codecov | |
| uses: codecov/[email protected] | |
| with: | |
| files: test/TestLogger.UnitTests/coverage.opencover.xml | |
| - name: Publish packages | |
| if: ${{ github.event_name == 'push' && matrix.os != 'windows-latest' }} | |
| run: | | |
| dotnet nuget push 'src/TestLogger/bin/Release/*.nupkg' --api-key ${{ secrets.SPEKT_MYGET_KEY }} --source https://www.myget.org/F/spekt/api/v3/index.json | |
| dotnet nuget push 'src/Xunit.Xml.Package/bin/Release/*.nupkg' --api-key ${{ secrets.SPEKT_MYGET_KEY }} --source https://www.myget.org/F/spekt/api/v3/index.json | |
| dotnet nuget push 'src/NUnit.Xml.Package/bin/Release/*.nupkg' --api-key ${{ secrets.SPEKT_MYGET_KEY }} --source https://www.myget.org/F/spekt/api/v3/index.json | |
| dotnet nuget push 'src/JUnit.Xml.Package/bin/Release/*.nupkg' --api-key ${{ secrets.SPEKT_MYGET_KEY }} --source https://www.myget.org/F/spekt/api/v3/index.json |