11name : E2E AutoTest
22
33on :
4+ schedule :
5+ # Every weekday (Mon–Fri) at 13:00 Shanghai time (05:00 UTC)
6+ - cron : ' 0 5 * * 1-5'
47 workflow_dispatch :
58 inputs :
69 test_plan :
912 default : " "
1013 type : string
1114 vsix_urls :
12- description : " VSIX URLs to install , comma-separated (e.g. https://host /redhat.java-1.42.0.vsix ,https://host/vscode-java-debug-0.58.0.vsix)"
15+ description : " VSIX URLs or GitHub release tag URLs , comma-separated (e.g. https://github.com /redhat-developer/vscode-java/releases/tag/v1.54.0 ,https://host/vscode-java-debug-0.58.0.vsix). Release tag URLs auto-resolve to the platform-specific VSIX for the runner OS. "
1316 required : false
1417 default : " "
1518 type : string
19+ pre_release :
20+ description : " Install pre-release versions of marketplace extensions"
21+ required : false
22+ default : true
23+ type : boolean
1624
1725jobs :
1826 # ── Job 1: Discover test plans ──────────────────────────
8694 run : |
8795 New-Item -ItemType Directory -Path vsix -Force | Out-Null
8896 $urls = "${{ inputs.vsix_urls }}" -split "," | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" }
97+
98+ # Map runner OS/arch to vscode-java platform identifiers
99+ $platformMap = @{ "Windows" = "win32"; "Linux" = "linux"; "macOS" = "darwin" }
100+ $archMap = @{ "X64" = "x64"; "ARM64" = "arm64" }
101+ $platform = $platformMap["${{ runner.os }}"]
102+ $arch = $archMap["${{ runner.arch }}"]
103+ $platformId = "$platform-$arch"
104+ Write-Host "Runner platform: $platformId (${{ runner.os }}/${{ runner.arch }})"
105+
106+ $resolvedUrls = @()
89107 foreach ($url in $urls) {
108+ if ($url -match '^https://github\.com/([^/]+)/([^/]+)/releases/tag/(.+)$') {
109+ $owner = $Matches[1]; $repo = $Matches[2]; $tag = $Matches[3]
110+ Write-Host "Resolving GitHub release: $owner/$repo@$tag for platform $platformId"
111+ $apiUrl = "https://api.github.com/repos/$owner/$repo/releases/tags/$tag"
112+ $release = Invoke-RestMethod -Uri $apiUrl -Headers @{ Accept = "application/vnd.github.v3+json" } -UseBasicParsing
113+ $platformAsset = $release.assets | Where-Object { $_.name -like "*-$platformId-*" -and $_.name -like "*.vsix" } | Select-Object -First 1
114+ if ($platformAsset) {
115+ Write-Host " Found platform-specific VSIX: $($platformAsset.name)"
116+ $resolvedUrls += $platformAsset.browser_download_url
117+ } else {
118+ $universalAsset = $release.assets | Where-Object { $_.name -notmatch '-(darwin|linux|win32)-' -and $_.name -like "*.vsix" } | Select-Object -First 1
119+ if ($universalAsset) {
120+ Write-Host " No platform-specific VSIX found, using universal: $($universalAsset.name)"
121+ $resolvedUrls += $universalAsset.browser_download_url
122+ } else {
123+ Write-Host "::warning::No matching VSIX found in release $owner/$repo@$tag for platform $platformId"
124+ }
125+ }
126+ } else {
127+ $resolvedUrls += $url
128+ }
129+ }
130+
131+ foreach ($url in $resolvedUrls) {
90132 $fileName = [System.IO.Path]::GetFileName(($url -split '\?')[0])
91133 Write-Host "Downloading: $url → vsix/$fileName"
92134 Invoke-WebRequest -Uri $url -OutFile "vsix/$fileName" -UseBasicParsing
@@ -106,6 +148,7 @@ jobs:
106148 $vsixFiles = (Get-ChildItem vsix -Filter "*.vsix" | ForEach-Object { $_.FullName }) -join ","
107149 if ($vsixFiles) { $autotestArgs += @("--vsix", $vsixFiles) }
108150 }
151+ if ("${{ inputs.pre_release }}" -ne "false") { $autotestArgs += "--pre-release" }
109152 Write-Host "Running: autotest $($autotestArgs -join ' ')"
110153 & autotest @autotestArgs
111154
@@ -166,11 +209,47 @@ jobs:
166209 run : |
167210 New-Item -ItemType Directory -Path vsix -Force | Out-Null
168211 $urls = "${{ inputs.vsix_urls }}" -split "," | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" }
212+
213+ # Map runner OS/arch to vscode-java platform identifiers
214+ $platformMap = @{ "Windows" = "win32"; "Linux" = "linux"; "macOS" = "darwin" }
215+ $archMap = @{ "X64" = "x64"; "ARM64" = "arm64" }
216+ $platform = $platformMap["${{ runner.os }}"]
217+ $arch = $archMap["${{ runner.arch }}"]
218+ $platformId = "$platform-$arch"
219+ Write-Host "Runner platform: $platformId (${{ runner.os }}/${{ runner.arch }})"
220+
221+ $resolvedUrls = @()
169222 foreach ($url in $urls) {
223+ if ($url -match '^https://github\.com/([^/]+)/([^/]+)/releases/tag/(.+)$') {
224+ $owner = $Matches[1]; $repo = $Matches[2]; $tag = $Matches[3]
225+ Write-Host "Resolving GitHub release: $owner/$repo@$tag for platform $platformId"
226+ $apiUrl = "https://api.github.com/repos/$owner/$repo/releases/tags/$tag"
227+ $release = Invoke-RestMethod -Uri $apiUrl -Headers @{ Accept = "application/vnd.github.v3+json" } -UseBasicParsing
228+ $platformAsset = $release.assets | Where-Object { $_.name -like "*-$platformId-*" -and $_.name -like "*.vsix" } | Select-Object -First 1
229+ if ($platformAsset) {
230+ Write-Host " Found platform-specific VSIX: $($platformAsset.name)"
231+ $resolvedUrls += $platformAsset.browser_download_url
232+ } else {
233+ $universalAsset = $release.assets | Where-Object { $_.name -notmatch '-(darwin|linux|win32)-' -and $_.name -like "*.vsix" } | Select-Object -First 1
234+ if ($universalAsset) {
235+ Write-Host " No platform-specific VSIX found, using universal: $($universalAsset.name)"
236+ $resolvedUrls += $universalAsset.browser_download_url
237+ } else {
238+ Write-Host "::warning::No matching VSIX found in release $owner/$repo@$tag for platform $platformId"
239+ }
240+ }
241+ } else {
242+ $resolvedUrls += $url
243+ }
244+ }
245+
246+ foreach ($url in $resolvedUrls) {
170247 $fileName = [System.IO.Path]::GetFileName(($url -split '\?')[0])
171248 Write-Host "Downloading: $url → vsix/$fileName"
172249 Invoke-WebRequest -Uri $url -OutFile "vsix/$fileName" -UseBasicParsing
173250 }
251+ Write-Host "Downloaded VSIX files:"
252+ Get-ChildItem vsix -Filter "*.vsix" | ForEach-Object { Write-Host " $($_.Name) ($([math]::Round($_.Length/1MB, 1)) MB)" }
174253
175254 - name : Run ${{ inputs.test_plan }}
176255 shell : pwsh
@@ -184,6 +263,7 @@ jobs:
184263 $vsixFiles = (Get-ChildItem vsix -Filter "*.vsix" | ForEach-Object { $_.FullName }) -join ","
185264 if ($vsixFiles) { $autotestArgs += @("--vsix", $vsixFiles) }
186265 }
266+ if ("${{ inputs.pre_release }}" -ne "false") { $autotestArgs += "--pre-release" }
187267 Write-Host "Running: autotest $($autotestArgs -join ' ')"
188268 & autotest @autotestArgs
189269
0 commit comments