test.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: Tests
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. jobs:
  6. format:
  7. name: Format Check
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v4
  12. - name: Setup .NET
  13. uses: actions/setup-dotnet@v4
  14. with:
  15. dotnet-version: 10.0.x
  16. - name: Restore
  17. run: dotnet restore
  18. - name: Check Formatting
  19. run: dotnet format --verify-no-changes
  20. discovery-tests:
  21. name: Discovery Tests (${{ matrix.os }})
  22. runs-on: ${{ matrix.os }}
  23. needs: format
  24. # Discovery runs on the machines being inventoried rather than on the RackPeek
  25. # host, so its tests are the ones that have to pass on every platform. They are
  26. # driven entirely from captured fixtures and never read the runner itself.
  27. # windows-latest joins this list when the Windows probe lands.
  28. strategy:
  29. fail-fast: false
  30. matrix:
  31. os: [ubuntu-latest, macos-latest]
  32. steps:
  33. - name: Checkout
  34. uses: actions/checkout@v4
  35. - name: Setup .NET
  36. uses: actions/setup-dotnet@v4
  37. with:
  38. dotnet-version: 10.0.x
  39. - name: Restore
  40. run: dotnet restore Tests.Discovery
  41. - name: Run Discovery Tests
  42. run: dotnet test Tests.Discovery --configuration Release --verbosity normal
  43. cli-tests:
  44. name: CLI Tests
  45. runs-on: ubuntu-latest
  46. needs: format
  47. steps:
  48. - name: Checkout
  49. uses: actions/checkout@v4
  50. - name: Setup .NET
  51. uses: actions/setup-dotnet@v4
  52. with:
  53. dotnet-version: 10.0.x
  54. - name: Restore
  55. run: dotnet restore
  56. - name: Build
  57. run: dotnet build --no-restore --configuration Release
  58. - name: Run CLI Tests
  59. run: dotnet test Tests --no-build --configuration Release --verbosity normal
  60. webui-tests:
  61. name: WebUI / Playwright Tests
  62. runs-on: ubuntu-24.04
  63. needs: cli-tests
  64. steps:
  65. - name: Checkout
  66. uses: actions/checkout@v4
  67. - name: Setup .NET
  68. uses: actions/setup-dotnet@v4
  69. with:
  70. dotnet-version: 10.0.x
  71. - name: Cache NuGet
  72. uses: actions/cache@v4
  73. with:
  74. path: ~/.nuget/packages
  75. key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/packages.lock.json') }}
  76. restore-keys: |
  77. ${{ runner.os }}-nuget-
  78. - name: Cache Playwright browsers
  79. uses: actions/cache@v4
  80. with:
  81. path: ~/.cache/ms-playwright
  82. key: ${{ runner.os }}-pw-chromium-${{ hashFiles('**/*.csproj') }}
  83. restore-keys: |
  84. ${{ runner.os }}-pw-chromium-
  85. - name: Restore
  86. run: dotnet restore
  87. - name: Build
  88. run: dotnet build --no-restore --configuration Release
  89. - name: Install Playwright Browsers
  90. shell: bash
  91. run: |
  92. pwsh Tests.E2e/bin/Release/net*/playwright.ps1 install --with-deps chromium
  93. - name: Build Docker Image
  94. run: |
  95. docker build \
  96. -t rackpeek:ci \
  97. -f RackPeek.Web/Dockerfile \
  98. .
  99. - name: Run E2E Tests
  100. run: dotnet test Tests.E2e --configuration Release --verbosity normal