dotnet-core.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: .NET Core
  2. on:
  3. push:
  4. branches: [ main, develop ]
  5. paths-ignore:
  6. - '**.md'
  7. pull_request:
  8. branches: [ main, develop ]
  9. paths-ignore:
  10. - '**.md'
  11. jobs:
  12. build:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v4
  16. - name: Setup .NET Core
  17. uses: actions/setup-dotnet@v3
  18. with:
  19. dotnet-version: 7.0
  20. dotnet-quality: 'ga'
  21. - name: Install dependencies
  22. run: |
  23. dotnet restore
  24. - name: Build Debug
  25. run: |
  26. dotnet build --configuration Debug --no-restore
  27. - name: Test
  28. run: |
  29. sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
  30. dotnet test --no-restore --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
  31. mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
  32. # Note: this step is currently not writing to the gist for some reason
  33. - name: Create Test Coverage Badge
  34. uses: simon-k/[email protected]
  35. id: create_coverage_badge
  36. with:
  37. label: Unit Test Coverage
  38. color: brightgreen
  39. path: UnitTests/TestResults/coverage.opencover.xml
  40. gist-filename: code-coverage.json
  41. # https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
  42. gist-id: 90ef67a684cb71db1817921a970f8d27
  43. gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
  44. - name: Print Code Coverage
  45. run: |
  46. echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
  47. echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"