Repository navigation
621 lines (559 loc) · 28.3 KB
/
Copy pathe2e-autotest.yml
File metadata and controls
621 lines (559 loc) · 28.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
name: E2E AutoTest
on:
pull_request:
branches:
- main
schedule:
# Every weekday (Mon–Fri) at 13:00 Shanghai time (05:00 UTC)
- cron: '0 5 * * 1-5'
workflow_dispatch:
inputs:
test_plan:
description: "Test plan to run (leave empty for all)"
required: false
default: ""
type: string
vsix_urls:
description: "VSIX URLs, GitHub release tag URLs, GitHub Actions run URLs, or redhat-developer/vscode-java run IDs, comma-separated (e.g. https://github.com/redhat-developer/vscode-java/releases/tag/v1.54.0,https://github.com/redhat-developer/vscode-java/actions/runs/28102068371,https://host/vscode-java-debug-0.58.0.vsix). Release/run inputs auto-resolve to the platform-specific VSIX for the runner OS."
required: false
default: ""
type: string
pre_release:
description: "Install pre-release versions of marketplace extensions"
required: false
default: true
type: boolean
permissions:
contents: read
actions: read
jobs:
# ── Job 1a: Build vscode-java-pack VSIX from the PR/manual branch ───────
build-pack:
if: ${{ github.event_name != 'schedule' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '22'
cache: npm
- name: Install dependencies
run: npm ci
- name: Build extension
run: npm run build
- name: Package branch VSIX
run: npx @vscode/vsce@latest package -o vscode-java-pack-pr.vsix
- name: Upload branch VSIX
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: pack-vsix
path: vscode-java-pack-pr.vsix
retention-days: 1
# ── Job 1b: Discover test plans ──────────────────────────
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.scan.outputs.matrix }}
autotest_version: ${{ steps.autotest.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Resolve latest AutoTest version for this run
id: autotest
shell: bash
run: |
version=$(npm view @vscjava/vscode-autotest@latest version)
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo "::error::Invalid AutoTest version returned by npm: $version"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Using AutoTest $version for all jobs in this run"
- name: Resolve test plan matrix
id: scan
shell: bash
run: |
requested="${{ inputs.test_plan }}"
if [ -n "$requested" ]; then
# Strip optional .yaml suffix and emit a single-entry matrix
plan="${requested%.yaml}"
matrix=$(printf '%s' "$plan" | jq -R . | jq -sc .)
else
matrix=$(ls test-plans/*.yaml | xargs -I{} basename {} .yaml | grep -v java-fresh-import | jq -R . | jq -sc .)
fi
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
echo "Found plans: $matrix"
# ── Job 2: Run each test plan in parallel ───────────────
e2e-test:
needs: [discover, build-pack]
# build-pack is skipped on schedule; PR/manual runs install this branch's pack VSIX first.
if: ${{ always() && needs.discover.result == 'success' && (github.event_name == 'schedule' || needs.build-pack.result == 'success') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
plan: ${{ fromJson(needs.discover.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Prepare case artifact directory
shell: pwsh
env:
AUTOTEST_PLAN: ${{ matrix.plan }}
run: |
$plan = $env:AUTOTEST_PLAN
if ($plan -notmatch '^[a-z0-9]+(?:-[a-z0-9]+)*$') { throw "Invalid AutoTest plan name: $plan" }
$outputDirectory = Join-Path (Join-Path $env:GITHUB_WORKSPACE "test-results") $plan
# AutoTest clears --output at startup; keep pre-run logs outside it.
$stagingDirectory = Join-Path $env:RUNNER_TEMP "autotest-$plan"
New-Item -ItemType Directory -Path $outputDirectory, (Join-Path $outputDirectory "logs") -Force | Out-Null
New-Item -ItemType Directory -Path $stagingDirectory -Force | Out-Null
"AUTOTEST_OUTPUT_DIR=$outputDirectory" >> $env:GITHUB_ENV
"AUTOTEST_STAGING_DIR=$stagingDirectory" >> $env:GITHUB_ENV
if ($plan.Contains("java27")) {
$terminalDirectory = Join-Path $stagingDirectory "terminal"
"JAVA27_DIAGNOSTICS_DIR=$terminalDirectory" >> $env:GITHUB_ENV
}
- name: Clone vscode-java (test projects)
run: git clone --depth 1 https://github.com/redhat-developer/vscode-java.git ../vscode-java
- name: Clone eclipse.jdt.ls (Gradle test projects)
run: git clone --depth 1 https://github.com/eclipse-jdtls/eclipse.jdt.ls.git ../eclipse.jdt.ls
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Install resolved AutoTest CLI
if: always()
run: |
npm install -g "@vscjava/vscode-autotest@${{ needs.discover.outputs.autotest_version }}"
npm list -g @vscjava/vscode-autotest --depth=0
- name: Setup Java 27 (for java27 test plans)
if: contains(matrix.plan, 'java27')
uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 27
- name: Configure JDK 27 path for runner OS
if: contains(matrix.plan, 'java27')
shell: pwsh
run: |
$planFile = "test-plans/${{ matrix.plan }}.yaml"
if ($IsWindows) {
$target = "C:\Program Files\Java\jdk-27"
New-Item -ItemType Junction -Path $target -Target $env:JAVA_HOME -Force | Out-Null
} else {
$target = "/opt/jdk-27"
sudo mkdir -p /opt
sudo ln -sfn $env:JAVA_HOME $target
(Get-Content $planFile -Raw) -replace 'C:\\\\Program Files\\\\Java\\\\jdk-27', $target | Set-Content $planFile
}
"JAVA27_HOME=$target" >> $env:GITHUB_ENV
Write-Host "Java 27 project toolchain: $target"
- name: Setup Java 25 (for java25 test plans)
if: contains(matrix.plan, 'java25')
uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 25-ea
- name: Configure JDK 25 path for runner OS
if: contains(matrix.plan, 'java25')
shell: pwsh
run: |
"JAVA25_HOME=$env:JAVA_HOME" >> $env:GITHUB_ENV
$planFile = "test-plans/${{ matrix.plan }}.yaml"
if ($IsWindows) {
$target = "C:\Program Files\Java\jdk-25"
New-Item -ItemType Junction -Path $target -Target $env:JAVA_HOME -Force | Out-Null
Write-Host "Created junction: $target -> $env:JAVA_HOME"
} else {
# Linux and macOS: symlink JAVA_HOME to a known location and
# rewrite the Windows-style java.jdt.ls.java.home in the plan
# so the language server resolves JDK 25 on this runner.
$target = "/opt/jdk-25"
sudo mkdir -p /opt
sudo ln -sfn $env:JAVA_HOME $target
Write-Host "Created symlink: $target -> $env:JAVA_HOME"
(Get-Content $planFile -Raw) -replace 'C:\\\\Program Files\\\\Java\\\\jdk-25', $target | Set-Content $planFile
Write-Host "Patched $planFile java.jdt.ls.java.home -> $target"
}
- name: Setup Java 21
uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 21
- name: Configure JDK 21 for Gradle import tests
if: matrix.plan == 'java-gradle' || matrix.plan == 'java-gradle-java25'
shell: pwsh
run: |
"JAVA21_HOME=$env:JAVA_HOME" >> $env:GITHUB_ENV
if ("${{ matrix.plan }}" -eq "java-gradle") {
$planFile = "test-plans/${{ matrix.plan }}.yaml"
# JSON escaping also handles Windows installation paths in double-quoted YAML.
$jdkPath = ($env:JAVA_HOME | ConvertTo-Json -Compress).Trim('"')
(Get-Content $planFile -Raw).Replace('C:\\Program Files\\Java\\jdk-21', $jdkPath) | Set-Content $planFile
}
- name: Setup Gradle for import tests
if: matrix.plan == 'java-gradle' || matrix.plan == 'java-gradle-java25' || matrix.plan == 'java-gradle-java27'
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
with:
gradle-version: ${{ matrix.plan == 'java-gradle' && '8.5' || '9.8.1' }}
- name: Bind Gradle for import tests
if: matrix.plan == 'java-gradle' || matrix.plan == 'java-gradle-java25' || matrix.plan == 'java-gradle-java27'
shell: pwsh
env:
GRADLE_TEST_PLAN: ${{ matrix.plan }}
run: |
$ciGradle = (Get-Command gradle -CommandType Application -ErrorAction Stop | Select-Object -First 1).Source
$release = if ($env:GRADLE_TEST_PLAN -eq "java-gradle") { "21" } elseif ($env:GRADLE_TEST_PLAN -eq "java-gradle-java25") { "25" } else { "27" }
if ($release -eq "27") {
$versionLog = Join-Path $env:AUTOTEST_STAGING_DIR "gradle-version.log"
$PSNativeCommandUseErrorActionPreference = $false
$gradleVersion = & $ciGradle --version 2>&1 | Out-String
$versionExit = $LASTEXITCODE
"Command: $ciGradle --version`n$gradleVersion" | Set-Content -LiteralPath $versionLog
if ($versionExit -ne 0) { throw "CI Gradle version probe exited with $versionExit; see diagnostics/ci/gradle-version.log in this case's results artifact." }
if ($gradleVersion -notmatch '(?m)^Gradle 9\.8\.1\s*$') {
throw "CI did not select the provisioned Gradle 9.8.1: $ciGradle; see $versionLog"
}
"JAVA27_CI_GRADLE=$ciGradle" >> $env:GITHUB_ENV
} else {
"ORG_GRADLE_PROJECT_javaRelease=$release" >> $env:GITHUB_ENV
}
"GRADLE_CI_GRADLE=$ciGradle" >> $env:GITHUB_ENV
"GRADLE_CI_JAVA_HOME=$([Environment]::GetEnvironmentVariable("JAVA${release}_HOME"))" >> $env:GITHUB_ENV
Write-Host "Bound CI Gradle: $ciGradle"
- name: Setup virtual display (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
if ! command -v Xvfb >/dev/null 2>&1; then
echo "Xvfb is not preinstalled; installing it with bounded apt operations."
apt_options=(
-o Acquire::Retries=3
-o Acquire::http::Timeout=15
-o Acquire::https::Timeout=15
)
if ! sudo timeout 120s apt-get "${apt_options[@]}" update; then
echo "::error::Timed out while refreshing apt metadata for Xvfb."
exit 1
fi
if ! sudo timeout 120s apt-get "${apt_options[@]}" install -y --no-install-recommends xvfb; then
echo "::error::Timed out while installing Xvfb."
exit 1
fi
fi
Xvfb :99 -screen 0 1920x1080x24 >"$RUNNER_TEMP/xvfb.log" 2>&1 &
xvfb_pid=$!
echo "DISPLAY=:99" >> "$GITHUB_ENV"
# Give Xvfb a moment to start before the autotest CLI launches VS Code.
sleep 2
if ! kill -0 "$xvfb_pid" 2>/dev/null; then
cat "$RUNNER_TEMP/xvfb.log"
echo "::error::Xvfb failed to start."
exit 1
fi
- name: Download vscode-java-pack VSIX (from branch)
if: ${{ github.event_name != 'schedule' }}
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: pack-vsix
path: vsix
- name: Download VSIX files
if: ${{ github.event_name == 'workflow_dispatch' && inputs.vsix_urls != '' }}
shell: pwsh
env:
GITHUB_TOKEN: ${{ github.token }}
VSCODE_JAVA_ARTIFACT_TOKEN: ${{ secrets.VSCODE_JAVA_ARTIFACT_TOKEN }}
run: |
New-Item -ItemType Directory -Path vsix -Force | Out-Null
$urls = "${{ inputs.vsix_urls }}" -split "," | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" }
# Map runner OS/arch to vscode-java platform identifiers
$platformMap = @{ "Windows" = "win32"; "Linux" = "linux"; "macOS" = "darwin" }
$archMap = @{ "X64" = "x64"; "ARM64" = "arm64" }
$platform = $platformMap["${{ runner.os }}"]
$arch = $archMap["${{ runner.arch }}"]
$platformId = "$platform-$arch"
Write-Host "Runner platform: $platformId (${{ runner.os }}/${{ runner.arch }})"
$githubHeaders = @{
Accept = "application/vnd.github+json"
Authorization = "Bearer $env:GITHUB_TOKEN"
"X-GitHub-Api-Version" = "2022-11-28"
"User-Agent" = "vscode-java-pack-autotest"
}
$artifactToken = if ($env:VSCODE_JAVA_ARTIFACT_TOKEN) { $env:VSCODE_JAVA_ARTIFACT_TOKEN } else { $env:GITHUB_TOKEN }
$githubArtifactHeaders = $githubHeaders.Clone()
if ($artifactToken) {
$githubArtifactHeaders.Authorization = "Bearer $artifactToken"
}
function Select-VsixForPlatform {
param(
[Parameter(Mandatory = $true)]
[System.IO.FileInfo[]] $VsixFiles,
[Parameter(Mandatory = $true)]
[string] $PlatformId
)
$platformVsix = $VsixFiles | Where-Object { $_.Name -like "*-$PlatformId-*" } | Sort-Object Name | Select-Object -First 1
if ($platformVsix) {
Write-Host " Found platform-specific VSIX: $($platformVsix.Name)"
return $platformVsix
}
$universalVsix = $VsixFiles | Where-Object { $_.Name -notmatch '-(darwin|linux|win32)-' } | Sort-Object Name | Select-Object -First 1
if ($universalVsix) {
Write-Host " No platform-specific VSIX found, using universal: $($universalVsix.Name)"
return $universalVsix
}
throw "No matching VSIX found for platform $PlatformId. Available VSIX files: $($VsixFiles.Name -join ', ')"
}
function Download-GitHubActionsRunVsix {
param(
[Parameter(Mandatory = $true)]
[string] $Owner,
[Parameter(Mandatory = $true)]
[string] $Repo,
[Parameter(Mandatory = $true)]
[string] $RunId
)
Write-Host "Resolving GitHub Actions run: $Owner/$Repo#$RunId for platform $platformId"
$artifactsUrl = "https://api.github.com/repos/$Owner/$Repo/actions/runs/$RunId/artifacts"
$artifacts = @((Invoke-RestMethod -Uri $artifactsUrl -Headers $githubArtifactHeaders -UseBasicParsing).artifacts | Where-Object { -not $_.expired })
if (-not $artifacts) {
throw "No non-expired artifacts found for GitHub Actions run $Owner/$Repo#$RunId"
}
$artifact = $artifacts | Where-Object { $_.name -eq "vscode-java" } | Select-Object -First 1
if (-not $artifact -and $artifacts.Count -eq 1) {
$artifact = $artifacts | Select-Object -First 1
}
if (-not $artifact) {
throw "No vscode-java artifact found for GitHub Actions run $Owner/$Repo#$RunId. Available artifacts: $($artifacts.name -join ', ')"
}
$safeArtifactName = $artifact.name -replace '[^\w.-]', '_'
$downloadDir = Join-Path "downloaded-artifacts" "$Owner-$Repo-$RunId-$safeArtifactName"
$zipPath = "$downloadDir.zip"
New-Item -ItemType Directory -Path $downloadDir -Force | Out-Null
Write-Host " Downloading artifact: $($artifact.name)"
try {
Invoke-WebRequest -Uri $artifact.archive_download_url -OutFile $zipPath -Headers $githubArtifactHeaders -UseBasicParsing
} catch {
throw "Failed to download artifact $($artifact.name) from $Owner/$Repo#$RunId. Cross-repo artifact downloads may require a VSCODE_JAVA_ARTIFACT_TOKEN secret with actions:read access to the source repository. $($_.Exception.Message)"
}
Expand-Archive -LiteralPath $zipPath -DestinationPath $downloadDir -Force
$vsixFiles = @(Get-ChildItem $downloadDir -Recurse -Filter "*.vsix")
if ($vsixFiles.Count -eq 0) {
throw "Artifact $($artifact.name) from $Owner/$Repo#$RunId does not contain VSIX files"
}
$selectedVsix = Select-VsixForPlatform -VsixFiles $vsixFiles -PlatformId $platformId
Copy-Item -LiteralPath $selectedVsix.FullName -Destination (Join-Path "vsix" $selectedVsix.Name) -Force
}
$resolvedUrls = @()
foreach ($url in $urls) {
if ($url -match '^https://github\.com/([^/]+)/([^/]+)/releases/tag/(.+)$') {
$owner = $Matches[1]; $repo = $Matches[2]; $tag = $Matches[3]
Write-Host "Resolving GitHub release: $owner/$repo@$tag for platform $platformId"
$apiUrl = "https://api.github.com/repos/$owner/$repo/releases/tags/$tag"
$release = Invoke-RestMethod -Uri $apiUrl -Headers $githubHeaders -UseBasicParsing
$platformAsset = $release.assets | Where-Object { $_.name -like "*-$platformId-*" -and $_.name -like "*.vsix" } | Select-Object -First 1
if ($platformAsset) {
Write-Host " Found platform-specific VSIX: $($platformAsset.name)"
$resolvedUrls += $platformAsset.browser_download_url
} else {
$universalAsset = $release.assets | Where-Object { $_.name -notmatch '-(darwin|linux|win32)-' -and $_.name -like "*.vsix" } | Select-Object -First 1
if ($universalAsset) {
Write-Host " No platform-specific VSIX found, using universal: $($universalAsset.name)"
$resolvedUrls += $universalAsset.browser_download_url
} else {
Write-Host "::warning::No matching VSIX found in release $owner/$repo@$tag for platform $platformId"
}
}
} elseif ($url -match '^https://github\.com/([^/]+)/([^/]+)/actions/runs/(\d+)') {
Download-GitHubActionsRunVsix -Owner $Matches[1] -Repo $Matches[2] -RunId $Matches[3]
} elseif ($url -match '^\d+$') {
Download-GitHubActionsRunVsix -Owner "redhat-developer" -Repo "vscode-java" -RunId $url
} else {
$resolvedUrls += $url
}
}
foreach ($url in $resolvedUrls) {
$fileName = [System.IO.Path]::GetFileName(($url -split '\?')[0])
Write-Host "Downloading: $url → vsix/$fileName"
Invoke-WebRequest -Uri $url -OutFile "vsix/$fileName" -UseBasicParsing
}
Write-Host "Downloaded VSIX files:"
Get-ChildItem vsix -Filter "*.vsix" | ForEach-Object { Write-Host " $($_.Name) ($([math]::Round($_.Length/1MB, 1)) MB)" }
- name: Use vscode-java-pack as primary extension for VSIX override runs
if: ${{ github.event_name == 'workflow_dispatch' && inputs.vsix_urls != '' }}
shell: pwsh
run: |
$planFile = "test-plans/${{ matrix.plan }}.yaml"
$content = Get-Content $planFile -Raw
$content = $content -replace '(?m)^(\s*)extension:\s*"?redhat\.java"?\s*$', '$1extension: "vscjava.vscode-java-pack"'
$content = $content -replace '(?m)^(\s*)extensions:\s*\r?\n\1\s*-\s*"vscjava\.vscode-java-pack"\s*\r?\n', ''
Set-Content $planFile $content
Write-Host "Patched $planFile to install vscode-java through vscode-java-pack before applying VSIX overrides."
- name: Record case toolchain diagnostics
if: always()
shell: pwsh
run: |
$identity = [ordered]@{
javaHome = $env:JAVA_HOME
projectJavaHome = $(if ($env:GRADLE_CI_JAVA_HOME) { $env:GRADLE_CI_JAVA_HOME } else { $env:JAVA27_HOME })
gradle = $env:GRADLE_CI_GRADLE
runnerOs = $env:RUNNER_OS
runnerArch = $env:RUNNER_ARCH
path = $env:PATH
}
$PSNativeCommandUseErrorActionPreference = $false
foreach ($probe in @(
@{ Name = "node"; Arguments = @("--version") },
@{ Name = "java"; Arguments = @("-XshowSettings:properties", "-version") }
)) {
$command = Get-Command $probe.Name -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $command) {
Write-Warning "$($probe.Name) unavailable; its CI setup may have failed."
$identity[$probe.Name] = $null
continue
}
$identity[$probe.Name] = $command.Source
$arguments = $probe.Arguments
$version = & $command.Source @arguments 2>&1 | Out-String
$versionExit = $LASTEXITCODE
$identity["$($probe.Name)VersionExitCode"] = $versionExit
$version | Set-Content -LiteralPath (Join-Path $env:AUTOTEST_STAGING_DIR "$($probe.Name)-version.log")
if ($versionExit -ne 0) { Write-Warning "$($probe.Name) version probe failed; see its diagnostic log." }
}
$identity | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath (Join-Path $env:AUTOTEST_STAGING_DIR "ci-toolchain.json")
- name: Run ${{ matrix.plan }}
shell: pwsh
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_DEPLOYMENT }}
run: |
$autotestArgs = @(
"run",
"test-plans/${{ matrix.plan }}.yaml",
"--output",
$env:AUTOTEST_OUTPUT_DIR,
"--logs",
"--log-output",
(Join-Path $env:AUTOTEST_OUTPUT_DIR "logs"),
"--artifacts-config",
(Join-Path "test-plans" "config" "artifacts.yaml"),
"--analysis-mode",
"case"
)
if (Test-Path vsix) {
$vsixFiles = (Get-ChildItem vsix -Filter "*.vsix" |
Sort-Object @{ Expression = { if ($_.Name -like "vscode-java-pack*") { 0 } else { 1 } } }, Name |
ForEach-Object { $_.FullName }) -join ","
if ($vsixFiles) { $autotestArgs += @("--vsix", $vsixFiles) }
}
# PR/manual runs test the branch-built pack VSIX first, then any
# supplied VSIX overrides such as a vscode-java Actions run artifact.
# Case mode always captures the evidence bundle. LLM verification and
# case analysis activate when AZURE_OPENAI_* secrets are available;
# runs without secret access retain the evidence and record the
# unavailable analysis without changing the test verdict.
# Scheduled & manual runs default to --pre-release unless explicitly disabled.
$isPR = "${{ github.event_name }}" -eq "pull_request"
if (-not $isPR -and "${{ inputs.pre_release }}" -ne "false") {
$autotestArgs += "--pre-release"
}
# macOS's default temp path makes the isolated profile's VS Code IPC
# socket exceed 103 characters. Keep the profile unique but its root short.
if ($env:RUNNER_OS -eq "macOS" -and "${{ matrix.plan }}" -in @("localization-en", "localization-zh-cn")) {
if (-not $env:RUNNER_TEMP -or -not (Test-Path -LiteralPath $env:RUNNER_TEMP -PathType Container)) {
throw "The localization run requires an existing RUNNER_TEMP directory."
}
$env:TMPDIR = $env:RUNNER_TEMP
}
Write-Host "Running: autotest $($autotestArgs -join ' ')"
$consoleLog = Join-Path $env:AUTOTEST_STAGING_DIR "console.log"
$PSNativeCommandUseErrorActionPreference = $false
& autotest @autotestArgs *> $consoleLog
$testExit = $LASTEXITCODE
Write-Host "AutoTest exit code: $testExit. Logs and diagnostics are in this case's results artifact."
if ($testExit -ne 0) {
Write-Host "::error::AutoTest exited with code $testExit. See this case's results artifact for logs and diagnostics."
}
exit $testExit
- name: Collect case logs and diagnostics
if: always()
shell: pwsh
run: |
& autotest collect --output $env:AUTOTEST_OUTPUT_DIR --artifacts-config (Join-Path "test-plans" "config" "artifacts.yaml") --plan "test-plans/${{ matrix.plan }}.yaml"
exit $LASTEXITCODE
- name: Upload results
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: results-${{ matrix.plan }}-${{ matrix.os }}
path: test-results/${{ matrix.plan }}/
retention-days: 30
# ── Job 3: Aggregate analysis ───────────────────────────
analyze:
if: ${{ always() && needs.discover.result == 'success' && needs.e2e-test.result != 'skipped' && github.event_name != 'pull_request' && inputs.test_plan == '' }}
needs: [discover, e2e-test]
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Install resolved AutoTest CLI
run: |
npm install -g "@vscjava/vscode-autotest@${{ needs.discover.outputs.autotest_version }}"
npm list -g @vscjava/vscode-autotest --depth=0
- name: Download all results
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: results-*
path: all-results
merge-multiple: false
- name: Organize results
run: |
mkdir -p test-results
# Each artifact is named results-<plan>-<os>; keep that suffix so
# Windows and Linux runs of the same plan don't collide.
for dir in all-results/results-*/; do
artifact=$(basename "$dir") # results-<plan>-<os>
suffix="${artifact#results-}" # <plan>-<os>
if [ -f "$dir/results.json" ]; then
cp -r "$dir" "test-results/$suffix"
else
echo "::warning::No results.json in $artifact; setup/startup logs remain in that artifact."
fi
done
echo "Organized results:"
ls test-results/
- name: Analyze results
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_DEPLOYMENT }}
AUTOTEST_AGGREGATE_ANALYSIS_MAX_TOKENS: "16000"
run: autotest analyze test-results --output test-results --analysis-mode case --report-only
- name: Write Job Summary
if: always()
run: |
if [ -f test-results/summary.md ]; then
cat test-results/summary.md >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload aggregate results
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: e2e-aggregate-summary
path: |
test-results/summary.md
test-results/*/results.json
test-results/*/analysis/
test-results/*/evidence/manifest.json
retention-days: 30