|
| 1 | +name: "Test: Extension Host (Windows)" |
| 2 | + |
| 3 | +# Windows counterpart of test-ext-host.yml. Runs only the Electron ext-host |
| 4 | +# driver, through test-integration.bat. The Chromium (web) driver is skipped |
| 5 | +# because Positron has no web build on Windows, and the Remote driver because |
| 6 | +# Windows remote (WSL) is already covered by e2e tests. |
| 7 | +# |
| 8 | +# Merge-only by design: test-merge.yml and test-full-suite.yml call this, the |
| 9 | +# PR workflow does not. Windows runners are slow to provision and build, and the |
| 10 | +# Linux ext-host job already gates PRs. |
| 11 | +# |
| 12 | +# Restores caches but never saves them: e2e-windows in the same merge run owns |
| 13 | +# the Windows cache save (see the note at the top of test-e2e-windows-run.yml). |
| 14 | + |
| 15 | +on: |
| 16 | + workflow_call: |
| 17 | + inputs: |
| 18 | + commit: |
| 19 | + description: "Commit SHA to test" |
| 20 | + required: false |
| 21 | + default: "" |
| 22 | + type: string |
| 23 | + skip_cache: |
| 24 | + description: "Skip restoring caches (use when testing a specific commit)" |
| 25 | + required: false |
| 26 | + default: false |
| 27 | + type: boolean |
| 28 | + workflow_dispatch: |
| 29 | + |
| 30 | +permissions: |
| 31 | + contents: read |
| 32 | + |
| 33 | +jobs: |
| 34 | + ext-host-tests-windows: |
| 35 | + name: ext-host-win |
| 36 | + runs-on: windows-latest-8x |
| 37 | + # Same as test-e2e-windows-run.yml. Leaves room for the npm install retry. |
| 38 | + timeout-minutes: 150 |
| 39 | + env: |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + POSITRON_BUILD_NUMBER: 0 # CI skips building releases |
| 42 | + _R_CHECK_FUTURE_FILE_TIMESTAMPS_: false # this check can be flaky in the R pkg tests |
| 43 | + _R_CHECK_CRAN_INCOMING_: false |
| 44 | + _R_CHECK_SYSTEM_CLOCK_: false |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v7 |
| 47 | + with: |
| 48 | + submodules: recursive |
| 49 | + |
| 50 | + - name: Checkout specific commit |
| 51 | + if: ${{ inputs.commit != '' }} |
| 52 | + run: | |
| 53 | + git checkout ${{ inputs.commit }} |
| 54 | + git submodule update --init --recursive |
| 55 | +
|
| 56 | + - name: Setup Node |
| 57 | + |
| 58 | + with: |
| 59 | + node-version-file: .nvmrc |
| 60 | + |
| 61 | + - name: 📦 Restore caches |
| 62 | + if: ${{ !inputs.skip_cache }} |
| 63 | + id: restore-caches |
| 64 | + uses: ./.github/actions/restore-build-caches |
| 65 | + |
| 66 | + # Same toolchain workaround as test-e2e-windows-run.yml: node-gyp does |
| 67 | + # not recognize the runner's VS 2026, so give it VS 2022 to fall back |
| 68 | + # to. Runs on every run because "Download binaries" below always runs |
| 69 | + # `npm rebuild`. |
| 70 | + - name: Install Visual Studio 2022 C++ build tools |
| 71 | + uses: nick-fields/retry@v4 |
| 72 | + with: |
| 73 | + timeout_minutes: 30 |
| 74 | + max_attempts: 3 |
| 75 | + retry_wait_seconds: 15 |
| 76 | + shell: pwsh |
| 77 | + command: | |
| 78 | + $ErrorActionPreference = 'Stop' |
| 79 | + $bootstrapper = "$env:TEMP\vs_buildtools.exe" |
| 80 | + Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_buildtools.exe" -OutFile $bootstrapper |
| 81 | + $p = Start-Process -FilePath $bootstrapper -Wait -PassThru -ArgumentList @( |
| 82 | + '--quiet','--wait','--norestart','--nocache', |
| 83 | + '--add','Microsoft.VisualStudio.Workload.VCTools', |
| 84 | + '--add','Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre', |
| 85 | + '--includeRecommended' |
| 86 | + ) |
| 87 | + if ($p.ExitCode -notin 0,3010) { exit $p.ExitCode } |
| 88 | +
|
| 89 | + - name: Install node dependencies |
| 90 | + if: steps.restore-caches.outputs.cache-npm-core-hit != 'true' || |
| 91 | + steps.restore-caches.outputs.cache-npm-extensions-volatile-hit != 'true' || |
| 92 | + steps.restore-caches.outputs.cache-npm-extensions-stable-hit != 'true' |
| 93 | + uses: nick-fields/retry@v4 |
| 94 | + env: |
| 95 | + npm_config_arch: x64 |
| 96 | + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 |
| 97 | + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 |
| 98 | + POSITRON_GITHUB_RO_PAT: ${{ github.token }} |
| 99 | + POSITRON_PARALLEL_INSTALL: '0' # Disabled on Windows due to native module file locking races |
| 100 | + NPM_CONFIG_AUDIT: 'false' |
| 101 | + NPM_CONFIG_FUND: 'false' |
| 102 | + NPM_CONFIG_UPDATE_NOTIFIER: 'false' |
| 103 | + # Same extension filter logic as test-e2e-windows-run.yml. |
| 104 | + POSITRON_EXTENSIONS_FILTER: ${{ (steps.restore-caches.outputs.cache-npm-extensions-volatile-hit == 'true' && steps.restore-caches.outputs.cache-npm-extensions-stable-hit != 'true' && 'stable') || (steps.restore-caches.outputs.cache-npm-extensions-volatile-hit != 'true' && steps.restore-caches.outputs.cache-npm-extensions-stable-hit == 'true' && 'volatile') || '' }} |
| 105 | + with: |
| 106 | + timeout_minutes: 90 |
| 107 | + max_attempts: 3 |
| 108 | + retry_wait_seconds: 5 |
| 109 | + shell: bash |
| 110 | + command: | |
| 111 | + set -e |
| 112 | + npm --prefix build ci --no-audit --no-fund --fetch-timeout 120000 |
| 113 | + npm ci --no-audit --no-fund --fetch-timeout 120000 |
| 114 | +
|
| 115 | + - name: Download binaries (Ark, Kallichore) with retry |
| 116 | + uses: nick-fields/retry@v4 |
| 117 | + env: |
| 118 | + POSITRON_GITHUB_RO_PAT: ${{ github.token }} |
| 119 | + with: |
| 120 | + timeout_minutes: 20 |
| 121 | + max_attempts: 3 |
| 122 | + retry_wait_seconds: 10 |
| 123 | + shell: bash |
| 124 | + command: | |
| 125 | + set -e |
| 126 | + cd extensions/positron-r && npm rebuild --foreground-scripts |
| 127 | + cd ../positron-supervisor && npm rebuild --foreground-scripts |
| 128 | +
|
| 129 | + - name: Compile Positron and Download Electron |
| 130 | + run: npm exec -- npm-run-all --max-old-space-size=8192 -p compile "electron x64" |
| 131 | + |
| 132 | + # Downloads Builtin Extensions (needed for integration testing) |
| 133 | + - name: Prelaunch |
| 134 | + shell: bash |
| 135 | + run: npm run prelaunch |
| 136 | + |
| 137 | + - name: Install rig |
| 138 | + shell: pwsh |
| 139 | + run: | |
| 140 | + winget install --id Posit.rig --accept-source-agreements --accept-package-agreements |
| 141 | +
|
| 142 | + # Same R resolution as test-e2e-windows-run.yml, default version only. |
| 143 | + # See there for why `rig system add-pak` is called explicitly. |
| 144 | + - name: Install R |
| 145 | + id: r-versions |
| 146 | + shell: pwsh |
| 147 | + run: | |
| 148 | + $release = (Invoke-RestMethod -Uri 'https://api.r-hub.io/rversions/r-release' -MaximumRetryCount 3 -RetryIntervalSec 5).version |
| 149 | + Write-Host "Resolved R release=$release" |
| 150 | + "r_version=$release" >> $env:GITHUB_OUTPUT |
| 151 | + rig add $release |
| 152 | + rig default $release |
| 153 | + rig system add-pak |
| 154 | + rig ls |
| 155 | +
|
| 156 | + # The R package deps come from the e2e test-files DESCRIPTION. One |
| 157 | + # ext-host test ("Connections pane works for R") also reads it from the |
| 158 | + # repo root. |
| 159 | + - name: Stage R DESCRIPTION file |
| 160 | + id: download-r-desc |
| 161 | + run: | |
| 162 | + Copy-Item test/e2e/test-files/DESCRIPTION DESCRIPTION |
| 163 | + $hash = (Get-FileHash DESCRIPTION -Algorithm SHA256).Hash |
| 164 | + echo "description-hash=$hash" >> $env:GITHUB_OUTPUT |
| 165 | +
|
| 166 | + # Same key as the e2e-windows job, which saves it. |
| 167 | + - name: Restore R packages cache |
| 168 | + continue-on-error: true |
| 169 | + uses: actions/cache/restore@v6 |
| 170 | + with: |
| 171 | + path: | |
| 172 | + ~\AppData\Local\R\cache |
| 173 | + C:\Program Files\R\R-${{ steps.r-versions.outputs.r_version }}\library |
| 174 | + key: ${{ runner.os }}-r-${{ steps.r-versions.outputs.r_version }}-${{ steps.download-r-desc.outputs.description-hash }} |
| 175 | + restore-keys: | |
| 176 | + ${{ runner.os }}-r-${{ steps.r-versions.outputs.r_version }}- |
| 177 | +
|
| 178 | + - name: Install R packages |
| 179 | + env: |
| 180 | + # Frozen PPM snapshot, same as test-e2e-windows-run.yml. |
| 181 | + PPM_REPO: https://packagemanager.posit.co/cran/2026-06-30 |
| 182 | + run: | |
| 183 | + Rscript -e "options(repos = c(CRAN = Sys.getenv('PPM_REPO'))); pak::local_install_dev_deps(ask = FALSE, upgrade = FALSE)" |
| 184 | +
|
| 185 | + - name: 🧪 Run Extension Host Tests (Electron) |
| 186 | + id: electron-integration-tests |
| 187 | + shell: cmd |
| 188 | + env: |
| 189 | + # Prelaunch already ran above. Skipping it here also avoids the |
| 190 | + # agent host E2E runner's `spawnSync('npm.cmd')`, which Node rejects |
| 191 | + # with EINVAL on Windows (no `shell: true`). Upstream's Windows CI |
| 192 | + # sets this the same way. |
| 193 | + VSCODE_SKIP_PRELAUNCH: '1' |
| 194 | + run: scripts\test-integration.bat |
| 195 | + |
| 196 | + - name: Upload extension host logs |
| 197 | + if: ${{ failure() }} |
| 198 | + uses: actions/upload-artifact@v7 |
| 199 | + with: |
| 200 | + name: ext-host-win-logs |
| 201 | + path: | |
| 202 | + .build/logs |
| 203 | + .build/crashes |
| 204 | + if-no-files-found: ignore |
| 205 | + retention-days: 7 |
0 commit comments