shrink coverage report to fit upload size #320
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: Build & Release | |
| permissions: | |
| actions: read | |
| pull-requests: write | |
| security-events: write | |
| contents: write | |
| checks: write | |
| on: | |
| push: | |
| branches: [ "**" ] | |
| tags: [ "**" ] | |
| workflow_dispatch: | |
| merge_group: | |
| env: | |
| build-version-number: 0.0.${{ github.run_number }} | |
| docker-image-name: ghcr.io/tonycknight/microbroker | |
| jobs: | |
| variables: | |
| name: Set variables | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build-version-number: ${{ env.build-version-number }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set BuildVersion for release | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| echo "build-version-number=$(git describe --tags --dirty)" >> $GITHUB_ENV | |
| - name: Report version | |
| run: echo "build-version-number ${{ env.build-version-number }}" >> $GITHUB_STEP_SUMMARY | |
| sca: | |
| name: SCA | |
| runs-on: ubuntu-latest | |
| needs: [ variables ] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v6 | |
| - name: pkgchk | |
| uses: tonycknight/pkgchk-action@v1 | |
| with: | |
| scan-issues: true | |
| scan-upgrades: true | |
| config: pkgchk.config.yml | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [ variables ] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v6 | |
| - name: Run build | |
| run: | | |
| dotnet tool restore | |
| dotnet build -c Release | |
| unit-tests: | |
| name: Run Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: [ variables ] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v6 | |
| - name: Tests | |
| run: | | |
| dotnet tool restore | |
| dotnet test -c Debug --filter FullyQualifiedName~unit --ignore-exit-code 8 -- --coverage --coverage-output-format cobertura --report-trx | |
| - name: Consolidate code coverage | |
| run: | | |
| dotnet reportgenerator -reports:./TestResults/*.cobertura.xml -targetdir:./publish/codecoverage -reporttypes:Html | |
| dotnet reportgenerator -reports:./TestResults/*.cobertura.xml -targetdir:"./publish/codecoveragedata" -reporttypes:"Cobertura" | |
| - name: Report Unit test results | |
| uses: dorny/test-reporter@v3 | |
| if: always() | |
| with: | |
| name: Unit test results | |
| path: ${{ github.workspace }}/TestResults/*.trx | |
| reporter: dotnet-trx | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Code coverage summary | |
| uses: 5monkeys/cobertura-action@v14 | |
| if: always() | |
| with: | |
| path: ${{ github.workspace }}/TestResults/*.cobertura.xml | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| minimum_coverage: 0 | |
| fail_below_threshold: true | |
| show_line: true | |
| show_branch: true | |
| show_missing: true | |
| show_class_names: true | |
| skip_covered: true | |
| link_missing_lines: true | |
| report_name: Code coverage summary | |
| acceptance-tests: | |
| name: Run Acceptance tests | |
| runs-on: ubuntu-latest | |
| needs: [ variables ] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Build docker image | |
| run: docker build -f Dockerfile -t microbroker:localbuild --build-arg BuildVersion=0.0.0-localbuild . | |
| - name: Set docker vars | |
| run: | | |
| echo "docker-network=microbroker-acceptance-tests-${{ github.run_number }}" >> $GITHUB_ENV | |
| echo "docker-container=microbroker-acceptance-tests-${{ github.run_number }}" >> $GITHUB_ENV | |
| - name: Create docker network | |
| run: | | |
| docker network create -d bridge ${{ env.docker-network }} | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@9306129218d23ef2e0a9e11bd708950d886bb855 # TODO: 1.12.1 was tagged before the network support. | |
| with: | |
| mongodb-version: 8 # latest # ${{ matrix.mongodb-version }} | |
| docker-network: ${{ env.docker-network }} | |
| docker-network-alias: mongodb | |
| - name: Start microbroker | |
| run: | | |
| docker run --name ${{ env.docker-container }} --detach --network=${{ env.docker-network }} -it --rm -p 8080:8080 microbroker:localbuild --mongoConnection=mongodb://mongodb:27017 --ttaScanFrequency=00:00:15 | |
| - name: Run Tests | |
| run: | | |
| dotnet test --filter FullyQualifiedName~acceptance --ignore-exit-code 8 -- --coverage --coverage-output-format cobertura --report-trx | |
| - name: Stop microbroker | |
| if: always() | |
| run: | | |
| docker stop ${{ env.docker-container }} | |
| - name: Report Acceptance test results | |
| uses: dorny/test-reporter@v3 | |
| if: always() | |
| with: | |
| name: Acceptance test results | |
| path: ${{ github.workspace }}/TestResults/*.trx | |
| reporter: dotnet-trx | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| server-performance-tests: | |
| name: Run Server Performance tests | |
| runs-on: ubuntu-latest | |
| needs: [ variables ] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Build docker image | |
| run: docker build -f Dockerfile -t microbroker:localbuild --build-arg BuildVersion=0.0.0-localbuild . | |
| - name: Set docker vars | |
| run: | | |
| echo "docker-network=microbroker-performance-tests-${{ github.run_number }}" >> $GITHUB_ENV | |
| echo "docker-container=microbroker-performance-tests-${{ github.run_number }}" >> $GITHUB_ENV | |
| - name: Create docker network | |
| run: | | |
| docker network create -d bridge ${{ env.docker-network }} | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@9306129218d23ef2e0a9e11bd708950d886bb855 # TODO: 1.12.1 was tagged before the network support. | |
| with: | |
| mongodb-version: 8 # latest # ${{ matrix.mongodb-version }} | |
| docker-network: ${{ env.docker-network }} | |
| docker-network-alias: mongodb | |
| - name: Start microbroker | |
| run: | | |
| docker run --name ${{ env.docker-container }} --detach --network=${{ env.docker-network }} -it --rm -p 8080:8080 microbroker:localbuild --mongoConnection=mongodb://mongodb:27017 --ttaScanFrequency=00:00:15 | |
| - name: Run Tests | |
| run: | | |
| dotnet run --project ./tests/microbroker.tests.performance/microbroker.tests.performance.fsproj -c Release -- --rate 10 --duration 180 | |
| - name: Stop microbroker | |
| if: always() | |
| run: | | |
| docker stop ${{ env.docker-container }} | |
| - name: Report Performance test results | |
| if: always() | |
| run: | | |
| cat reports/**/nbomber_report_*.md >> $GITHUB_STEP_SUMMARY | |
| build-publish-docker-image: | |
| name: Build & Publish docker image | |
| runs-on: ubuntu-latest | |
| needs: [ variables, build, unit-tests, sca, acceptance-tests, server-performance-tests ] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set Docker image name | |
| run: | | |
| echo "docker-image-name-tagged=${{ env.docker-image-name }}:v${{ needs.variables.outputs.build-version-number }}" >> $GITHUB_ENV | |
| echo "docker-image-name-latest=${{ env.docker-image-name }}:latest" >> $GITHUB_ENV | |
| echo "Building image ${{ env.docker-image-name }}" >> $GITHUB_STEP_SUMMARY | |
| - name: Build docker image | |
| run: docker build -f Dockerfile -t ${{ env.docker-image-name-tagged }} -t ${{ env.docker-image-name-latest }} --build-arg BuildVersion=${{ needs.variables.outputs.build-version-number }} . | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| uses: docker/login-action@v4.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GHCR }} | |
| - name: Push docker image | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| run: docker push ${{ env.docker-image-name }} --all-tags | |
| build-publish-client-library: | |
| name: Build & Publish client library | |
| runs-on: ubuntu-latest | |
| needs: [ variables, build, unit-tests, sca, acceptance-tests, server-performance-tests ] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v6 | |
| - name: dotnet tool restore | |
| run: | | |
| dotnet tool restore | |
| dotnet restore | |
| - name: Create Nuget package | |
| run: dotnet pack ./src/microbroker.client/Microbroker.Client.fsproj -c Release -o ./package/ /p:PackageVersion=${{ needs.variables.outputs.build-version-number }} /p:Version=${{ needs.variables.outputs.build-version-number }} /p:AssemblyInformationalVersion=${{ needs.variables.outputs.build-version-number }} | |
| - name: Push nuget package | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| run: dotnet nuget push "package/*.nupkg" --api-key ${{ secrets.NUGET_PAT }} --source "nuget.org" |