test.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. mcp-tests:
  44. name: MCP Tests
  45. runs-on: ubuntu-latest
  46. needs: format
  47. # Every MCP test is end-to-end: a real MCP client speaking streamable HTTP to the
  48. # real server over WebApplicationFactory, asserting on the YAML that lands on disk.
  49. steps:
  50. - name: Checkout
  51. uses: actions/checkout@v4
  52. - name: Setup .NET
  53. uses: actions/setup-dotnet@v4
  54. with:
  55. dotnet-version: 10.0.x
  56. - name: Restore
  57. run: dotnet restore Tests.Mcp
  58. - name: Run MCP Tests
  59. run: dotnet test Tests.Mcp --configuration Release --verbosity normal
  60. cli-tests:
  61. name: CLI Tests
  62. runs-on: ubuntu-latest
  63. needs: format
  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: Restore
  72. run: dotnet restore
  73. - name: Build
  74. run: dotnet build --no-restore --configuration Release
  75. - name: Run CLI Tests
  76. run: dotnet test Tests --no-build --configuration Release --verbosity normal
  77. webui-tests:
  78. name: WebUI / Playwright Tests
  79. runs-on: ubuntu-24.04
  80. needs: cli-tests
  81. steps:
  82. - name: Checkout
  83. uses: actions/checkout@v4
  84. - name: Setup .NET
  85. uses: actions/setup-dotnet@v4
  86. with:
  87. dotnet-version: 10.0.x
  88. - name: Cache NuGet
  89. uses: actions/cache@v4
  90. with:
  91. path: ~/.nuget/packages
  92. key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/packages.lock.json') }}
  93. restore-keys: |
  94. ${{ runner.os }}-nuget-
  95. - name: Cache Playwright browsers
  96. uses: actions/cache@v4
  97. with:
  98. path: ~/.cache/ms-playwright
  99. key: ${{ runner.os }}-pw-chromium-${{ hashFiles('**/*.csproj') }}
  100. restore-keys: |
  101. ${{ runner.os }}-pw-chromium-
  102. - name: Restore
  103. run: dotnet restore
  104. - name: Build
  105. run: dotnet build --no-restore --configuration Release
  106. - name: Install Playwright Browsers
  107. shell: bash
  108. run: |
  109. pwsh Tests.E2e/bin/Release/net*/playwright.ps1 install --with-deps chromium
  110. - name: Build Docker Image
  111. run: |
  112. docker build \
  113. -t rackpeek:ci \
  114. -f RackPeek.Web/Dockerfile \
  115. .
  116. - name: Run E2E Tests
  117. run: dotnet test Tests.E2e --configuration Release --verbosity normal