Skip to content

top level statistics metrics #202

top level statistics metrics

top level statistics metrics #202

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "develop", "main" ]
pull_request:
branches: [ "develop", "main" ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
tst: ${{ steps.filter.outputs.tst }}
steps:
- uses: actions/checkout@v4
# https://github.com/dorny/paths-filter
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'src/**'
tst:
- 'src/**'
- 'tests/**'
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore
run: |
dotnet restore
dotnet restore sample
- name: Build
run: |
dotnet build -c Debug --no-restore
dotnet build sample -c Debug --no-restore
- name: Start containers
if: steps.filter.outputs.tst == 'true'
run: ./kafka-start.cmd
working-directory: ./tests
- name: Test
if: steps.filter.outputs.tst == 'true'
run: dotnet test -c Debug -f net8.0 --no-build --verbosity normal --settings .runsettings
- name: Stop containers
if: always()
run: ./kafka-stop.cmd
working-directory: ./tests
- name: Report
if: github.event_name == 'pull_request' && steps.filter.outputs.tst == 'true'
run: |
dotnet tool restore
dotnet reportgenerator -reports:./artifacts/cob/*/coverage.cobertura.xml -targetdir:artifacts -reporttypes:"Cobertura;HtmlSummary"
- name: Code Coverage Report
if: github.event_name == 'pull_request' && steps.filter.outputs.tst == 'true'
uses: irongut/[email protected]
with:
filename: ./artifacts/Cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '75 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && steps.filter.outputs.tst == 'true'
with:
recreate: true
path: code-coverage-results.md
publish:
runs-on: ubuntu-latest
needs: "build"
if: github.event_name != 'pull_request' && needs.build.outputs.src == 'true' # publish only if src folder changed and if not pull request
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
- name: Restore
run: dotnet restore
if: steps.changes.outputs.src == 'true'
- name: Pack Rc
run: dotnet pack -c Release -p:VersionPrefix=${{ github.run_number }}-rc --output ./artifacts/nuget
if: github.ref == 'refs/heads/develop'
- name: Pack
run: dotnet pack -c Release -p:VersionPrefix=${{ github.run_number }} --output ./artifacts/nuget
if: github.ref == 'refs/heads/main'
- name: Push
run: |
ls ./artifacts/nuget
dotnet nuget push ./artifacts/nuget/* -k ${{secrets.NUGET_TOKEN}} --skip-duplicate