dotnet-core.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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_debug:
  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 (Debug)
  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. build_release:
  63. # Ensure that RELEASE builds are not broken
  64. runs-on: ubuntu-latest
  65. steps:
  66. - name: Checkout code
  67. uses: actions/checkout@v4
  68. - name: Setup .NET Core
  69. uses: actions/setup-dotnet@v4
  70. with:
  71. dotnet-version: 8.x
  72. dotnet-quality: 'ga'
  73. - name: Build Release Terminal.Gui
  74. run: dotnet build Terminal.Gui/Terminal.Gui.csproj --configuration Release
  75. - name: Pack Release Terminal.Gui
  76. run: dotnet pack Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ./local_packages
  77. - name: Build Release Solution
  78. run: dotnet build --configuration Release
  79. # Note: this step is currently not writing to the gist for some reason
  80. # - name: Create Test Coverage Badge
  81. # uses: simon-k/[email protected]
  82. # id: create_coverage_badge
  83. # with:
  84. # label: Unit Test Coverage
  85. # color: brightgreen
  86. # path: UnitTests/TestResults/coverage.opencover.xml
  87. # gist-filename: code-coverage.json
  88. # # https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
  89. # gist-id: 90ef67a684cb71db1817921a970f8d27
  90. # gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
  91. # - name: Print Code Coverage
  92. # run: |
  93. # echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
  94. # echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"