dotnet-core.yml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: Build & Test Terminal.Gui with .NET Core
  2. on:
  3. push:
  4. branches: [ v2_release, v2_develop ]
  5. paths-ignore:
  6. - '**.md'
  7. pull_request:
  8. branches: [ v2_release, v2_develop ]
  9. paths-ignore:
  10. - '**.md'
  11. jobs:
  12. build_and_test:
  13. runs-on: ${{ matrix.os }}
  14. strategy:
  15. # Turn off fail-fast to let all runners run even if there are errors
  16. fail-fast: true
  17. matrix:
  18. os: [ ubuntu-latest, windows-latest, macos-latest ]
  19. timeout-minutes: 10
  20. steps:
  21. # Build
  22. - name: Checkout code
  23. uses: actions/checkout@v4
  24. - name: Setup .NET Core
  25. uses: actions/setup-dotnet@v4
  26. with:
  27. dotnet-version: 8.x
  28. dotnet-quality: 'ga'
  29. - name: Install dependencies
  30. run: |
  31. dotnet restore
  32. - name: Build Debug
  33. run: dotnet build --configuration Debug --no-restore
  34. # Test
  35. # Note: The --blame and VSTEST_DUMP_PATH stuff is needed to diagnose the test runner crashing on ubuntu/mac
  36. # See https://github.com/microsoft/vstest/issues/2952 for why the --blame stuff below is needed.
  37. # Without it, the test runner crashes on ubuntu (but not Windows or mac)
  38. - name: MacOS - Patch test runner settings to stop on fail
  39. if: runner.os == 'macOS'
  40. run: |
  41. brew install gnu-sed
  42. gsed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
  43. - name: Windows/Linux - Patch test runner settings to stop on fail
  44. if: runner.os != 'macOS'
  45. run: |
  46. sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
  47. - name: Set VSTEST_DUMP_PATH
  48. shell: bash
  49. run: echo "{VSTEST_DUMP_PATH}={logs/${{ runner.os }}/}" >> $GITHUB_ENV
  50. - name: Test
  51. run: |
  52. dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings --diag:logs/${{ runner.os }}/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always
  53. # mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
  54. - name: Upload Test Logs
  55. if: always()
  56. uses: actions/upload-artifact@v4
  57. with:
  58. name: test-logs-${{ runner.os }}
  59. path: |
  60. logs/
  61. UnitTests/TestResults/
  62. # Note: this step is currently not writing to the gist for some reason
  63. # - name: Create Test Coverage Badge
  64. # uses: simon-k/[email protected]
  65. # id: create_coverage_badge
  66. # with:
  67. # label: Unit Test Coverage
  68. # color: brightgreen
  69. # path: UnitTests/TestResults/coverage.opencover.xml
  70. # gist-filename: code-coverage.json
  71. # # https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
  72. # gist-id: 90ef67a684cb71db1817921a970f8d27
  73. # gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
  74. # - name: Print Code Coverage
  75. # run: |
  76. # echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
  77. # echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"