|
| 1 | +name: bit platform CI - Blex E2E |
| 2 | + |
| 3 | +# The cross-host suites: every web render mode in Chromium on net10.0/net9.0/net8.0, Blazor Hybrid in WebView2, |
| 4 | +# and trimmed/AOT publishes. They take far longer than the build-and-unit pipeline (bit.ci.Blex.yml), so they |
| 5 | +# run only when started by hand. See src/Blex/Tests/Bit.Blex.Tests.E2E/README.md for what each job proves and |
| 6 | +# how to run it locally. |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +env: |
| 12 | + DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + |
| 19 | + # Every web render mode (static SSR, Server, WebAssembly, Auto, with and without prerendering) in |
| 20 | + # Chromium, on each runtime the library ships for. |
| 21 | + e2e-web: |
| 22 | + name: Blex E2E - web render modes (${{ matrix.framework }}) |
| 23 | + runs-on: ubuntu-24.04 |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + framework: [ net10.0, net9.0, net8.0 ] |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout source code |
| 31 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 32 | + with: |
| 33 | + persist-credentials: false |
| 34 | + |
| 35 | + - name: Setup .NET 10.0 |
| 36 | + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 |
| 37 | + with: |
| 38 | + global-json-file: src/global.json |
| 39 | + |
| 40 | + - name: Setup .NET 9.0 |
| 41 | + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 |
| 42 | + with: |
| 43 | + dotnet-version: 9.0.x |
| 44 | + |
| 45 | + - name: Setup .NET 8.0 |
| 46 | + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 |
| 47 | + with: |
| 48 | + dotnet-version: 8.0.x |
| 49 | + |
| 50 | + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 |
| 51 | + with: |
| 52 | + node-version: 24 |
| 53 | + |
| 54 | + - name: Build the web harness host |
| 55 | + run: dotnet build src/Blex/Tests/Bit.Blex.Tests.Harness.Web/Bit.Blex.Tests.Harness.Web.csproj -c Release -f ${{ matrix.framework }} |
| 56 | + |
| 57 | + - name: Build the E2E suite |
| 58 | + run: dotnet build src/Blex/Tests/Bit.Blex.Tests.E2E/Bit.Blex.Tests.E2E.csproj -c Release |
| 59 | + |
| 60 | + - name: Install Playwright Chromium |
| 61 | + run: pwsh src/Blex/Tests/Bit.Blex.Tests.E2E/bin/Release/net10.0/playwright.ps1 install --with-deps chromium |
| 62 | + |
| 63 | + - name: Run E2E tests |
| 64 | + env: |
| 65 | + BLEX_E2E_FRAMEWORK: ${{ matrix.framework }} |
| 66 | + BLEX_E2E_CONFIGURATION: Release |
| 67 | + BLEX_E2E_SKIP_BUILD: 1 |
| 68 | + # Run from inside src so src/global.json's Microsoft.Testing.Platform runner setting applies. |
| 69 | + run: > |
| 70 | + cd src/Blex/Tests/Bit.Blex.Tests.E2E && |
| 71 | + dotnet test -c Release --no-build |
| 72 | + --filter "FullyQualifiedName!~HybridModeTests" |
| 73 | + --report-trx --report-trx-filename blex-e2e-web-${{ matrix.framework }}.trx |
| 74 | +
|
| 75 | + - name: Upload test results |
| 76 | + if: always() |
| 77 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 78 | + with: |
| 79 | + name: blex-e2e-web-${{ matrix.framework }} |
| 80 | + path: '**/blex-e2e-web-*.trx' |
| 81 | + if-no-files-found: ignore |
| 82 | + |
| 83 | + # Blazor Hybrid: the harness in a WinForms BlazorWebView (the WebView core MAUI Blazor Hybrid uses), |
| 84 | + # driven through WebView2's DevTools port. |
| 85 | + e2e-hybrid: |
| 86 | + name: Blex E2E - Blazor Hybrid (WebView2) |
| 87 | + runs-on: windows-2025 |
| 88 | + |
| 89 | + steps: |
| 90 | + - name: Checkout source code |
| 91 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 92 | + with: |
| 93 | + persist-credentials: false |
| 94 | + |
| 95 | + - name: Setup .NET 10.0 |
| 96 | + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 |
| 97 | + with: |
| 98 | + global-json-file: src/global.json |
| 99 | + |
| 100 | + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 |
| 101 | + with: |
| 102 | + node-version: 24 |
| 103 | + |
| 104 | + # windows-2025 ships the Edge browser but not the WebView2 Runtime, which BlazorWebView needs. |
| 105 | + - name: Install the WebView2 Runtime |
| 106 | + shell: pwsh |
| 107 | + run: | |
| 108 | + $clientKey = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' |
| 109 | + $version = (Get-ItemProperty $clientKey -ErrorAction SilentlyContinue).pv |
| 110 | + if (-not $version -or $version -eq '0.0.0.0') { |
| 111 | + $installer = Join-Path $env:RUNNER_TEMP 'MicrosoftEdgeWebview2Setup.exe' |
| 112 | + Invoke-WebRequest 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile $installer |
| 113 | + Start-Process $installer -ArgumentList '/silent', '/install' -Wait |
| 114 | + $version = (Get-ItemProperty $clientKey -ErrorAction SilentlyContinue).pv |
| 115 | + } |
| 116 | + if (-not $version -or $version -eq '0.0.0.0') { throw 'The WebView2 Runtime did not install.' } |
| 117 | + Write-Host "WebView2 Runtime $version" |
| 118 | +
|
| 119 | + - name: Build the hybrid harness host |
| 120 | + run: dotnet build src/Blex/Tests/Bit.Blex.Tests.Harness.Hybrid/Bit.Blex.Tests.Harness.Hybrid.csproj -c Release |
| 121 | + |
| 122 | + - name: Build the E2E suite |
| 123 | + run: dotnet build src/Blex/Tests/Bit.Blex.Tests.E2E/Bit.Blex.Tests.E2E.csproj -c Release |
| 124 | + |
| 125 | + # No Playwright browser download: it attaches to the WebView2 Runtime installed above. |
| 126 | + - name: Run hybrid E2E tests |
| 127 | + env: |
| 128 | + BLEX_E2E_CONFIGURATION: Release |
| 129 | + BLEX_E2E_SKIP_BUILD: 1 |
| 130 | + run: > |
| 131 | + cd src/Blex/Tests/Bit.Blex.Tests.E2E && |
| 132 | + dotnet test -c Release --no-build |
| 133 | + --filter "FullyQualifiedName~HybridModeTests" |
| 134 | + --report-trx --report-trx-filename blex-e2e-hybrid.trx |
| 135 | +
|
| 136 | + - name: Upload test results |
| 137 | + if: always() |
| 138 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 139 | + with: |
| 140 | + name: blex-e2e-hybrid |
| 141 | + path: '**/blex-e2e-hybrid.trx' |
| 142 | + if-no-files-found: ignore |
| 143 | + |
| 144 | + # Publishes the harness the way a WebAssembly app ships - trimmed, and in a second leg AOT-compiled - |
| 145 | + # failing on any trim analysis warning raised inside Bit.Blex, then runs the browser suite against that |
| 146 | + # published output. Trimming is where reflection-based snapshots, the JS bridges' [JSInvokable] callbacks and |
| 147 | + # the prerender state handoff break, and none of it is visible in a Debug build. |
| 148 | + publish-gate: |
| 149 | + name: Blex publish gate (${{ matrix.name }}) |
| 150 | + runs-on: ubuntu-24.04 |
| 151 | + strategy: |
| 152 | + fail-fast: false |
| 153 | + matrix: |
| 154 | + include: |
| 155 | + - name: trimmed |
| 156 | + properties: '' |
| 157 | + - name: aot |
| 158 | + properties: '-p:RunAOTCompilation=true' |
| 159 | + |
| 160 | + steps: |
| 161 | + - name: Checkout source code |
| 162 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 163 | + with: |
| 164 | + persist-credentials: false |
| 165 | + |
| 166 | + - name: Setup .NET 10.0 |
| 167 | + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 |
| 168 | + with: |
| 169 | + global-json-file: src/global.json |
| 170 | + |
| 171 | + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 |
| 172 | + with: |
| 173 | + node-version: 24 |
| 174 | + |
| 175 | + - name: Install wasm-tools |
| 176 | + if: matrix.name == 'aot' |
| 177 | + run: dotnet workload install wasm-tools |
| 178 | + |
| 179 | + - name: Publish the web harness host (fails on trim/AOT warnings from Bit.Blex) |
| 180 | + run: bash src/Blex/Tests/Bit.Blex.Tests.E2E/publish-gate.sh ${{ github.workspace }}/artifacts/harness-${{ matrix.name }} ${{ matrix.properties }} |
| 181 | + |
| 182 | + - name: Build the E2E suite |
| 183 | + run: dotnet build src/Blex/Tests/Bit.Blex.Tests.E2E/Bit.Blex.Tests.E2E.csproj -c Release |
| 184 | + |
| 185 | + - name: Install Playwright Chromium |
| 186 | + run: pwsh src/Blex/Tests/Bit.Blex.Tests.E2E/bin/Release/net10.0/playwright.ps1 install --with-deps chromium |
| 187 | + |
| 188 | + - name: Run E2E tests against the published host |
| 189 | + env: |
| 190 | + BLEX_E2E_PUBLISHED_HOST: ${{ github.workspace }}/artifacts/harness-${{ matrix.name }} |
| 191 | + run: > |
| 192 | + cd src/Blex/Tests/Bit.Blex.Tests.E2E && |
| 193 | + dotnet test -c Release --no-build |
| 194 | + --filter "FullyQualifiedName!~HybridModeTests" |
| 195 | + --report-trx --report-trx-filename blex-publish-${{ matrix.name }}.trx |
| 196 | +
|
| 197 | + - name: Upload test results |
| 198 | + if: always() |
| 199 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 200 | + with: |
| 201 | + name: blex-publish-${{ matrix.name }} |
| 202 | + path: '**/blex-publish-*.trx' |
| 203 | + if-no-files-found: ignore |
0 commit comments