unit-tests.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. name: Build & Run Unit Tests
  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. # Call the build workflow to build the solution once
  13. build:
  14. uses: ./.github/workflows/build.yml
  15. non_parallel_unittests:
  16. name: Non-Parallel Unit Tests
  17. runs-on: ${{ matrix.os }}
  18. needs: build
  19. strategy:
  20. # Turn off fail-fast to let all runners run even if there are errors
  21. fail-fast: true
  22. matrix:
  23. os: [ ubuntu-latest, windows-latest, macos-latest ]
  24. timeout-minutes: 10
  25. steps:
  26. - name: Checkout code
  27. uses: actions/checkout@v4
  28. - name: Setup .NET Core
  29. uses: actions/setup-dotnet@v4
  30. with:
  31. dotnet-version: 8.x
  32. dotnet-quality: 'ga'
  33. - name: Download build artifacts
  34. uses: actions/download-artifact@v4
  35. with:
  36. name: build-artifacts
  37. path: .
  38. - name: Restore NuGet packages
  39. run: dotnet restore
  40. # Test
  41. # Note: The --blame and VSTEST_DUMP_PATH stuff is needed to diagnose the test runner crashing on ubuntu/mac
  42. # See https://github.com/microsoft/vstest/issues/2952 for why the --blame stuff below is needed.
  43. # Without it, the test runner crashes on ubuntu (but not Windows or mac)
  44. - name: Set VSTEST_DUMP_PATH
  45. shell: bash
  46. run: echo "{VSTEST_DUMP_PATH}={logs/UnitTests/${{ runner.os }}/}" >> $GITHUB_ENV
  47. - name: Run UnitTests
  48. run: |
  49. dotnet test Tests/UnitTests --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings Tests/UnitTests/coverlet.runsettings --diag:logs/UnitTests/${{ runner.os }}/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always -- xunit.stopOnFail=false
  50. # mv -v Tests/UnitTests/TestResults/*/*.* TestResults/UnitTests/
  51. - name: Upload Test Logs
  52. if: always()
  53. uses: actions/upload-artifact@v4
  54. with:
  55. name: non_parallel_unittests-logs-${{ runner.os }}
  56. path: |
  57. logs/UnitTests
  58. TestResults/UnitTests/
  59. parallel_unittests:
  60. name: Parallel Unit Tests
  61. runs-on: ${{ matrix.os }}
  62. needs: build
  63. strategy:
  64. # Turn off fail-fast to let all runners run even if there are errors
  65. fail-fast: true
  66. matrix:
  67. os: [ ubuntu-latest, windows-latest, macos-latest ]
  68. timeout-minutes: 10
  69. steps:
  70. - name: Checkout code
  71. uses: actions/checkout@v4
  72. - name: Setup .NET Core
  73. uses: actions/setup-dotnet@v4
  74. with:
  75. dotnet-version: 8.x
  76. dotnet-quality: 'ga'
  77. - name: Download build artifacts
  78. uses: actions/download-artifact@v4
  79. with:
  80. name: build-artifacts
  81. path: .
  82. - name: Restore NuGet packages
  83. run: dotnet restore
  84. # Test
  85. # Note: The --blame and VSTEST_DUMP_PATH stuff is needed to diagnose the test runner crashing on ubuntu/mac
  86. # See https://github.com/microsoft/vstest/issues/2952 for why the --blame stuff below is needed.
  87. # Without it, the test runner crashes on ubuntu (but not Windows or mac)
  88. - name: Set VSTEST_DUMP_PATH
  89. shell: bash
  90. run: echo "{VSTEST_DUMP_PATH}={logs/UnitTestsParallelizable/${{ runner.os }}/}" >> $GITHUB_ENV
  91. - name: Run UnitTestsParallelizable
  92. run: |
  93. dotnet test Tests/UnitTestsParallelizable --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings Tests/UnitTestsParallelizable/coverlet.runsettings --diag:logs/UnitTestsParallelizable/${{ runner.os }}/logs.txt --blame --blame-crash --blame-hang --blame-hang-timeout 60s --blame-crash-collect-always -- xunit.stopOnFail=false
  94. # mv -v Tests/UnitTestsParallelizable/TestResults/*/*.* TestResults/UnitTestsParallelizable/
  95. - name: Upload UnitTestsParallelizable Logs
  96. if: always()
  97. uses: actions/upload-artifact@v4
  98. with:
  99. name: parallel_unittests-logs-${{ runner.os }}
  100. path: |
  101. logs/UnitTestsParallelizable/
  102. TestResults/UnitTestsParallelizable/