Skip to content

Commit

Permalink
ci: Attempting to workaround Clang failures
Browse files Browse the repository at this point in the history
Clang does not always have a Windows build available for the latest release as it takes time for that to get built and uploaded.
So to work around it it will search for a supported previous release to use instead or exit without an error if one cannot be located.

Signed-off-by: Tyler Erickson <[email protected]>
  • Loading branch information
vonericsen committed Oct 15, 2024
1 parent 5d2988c commit 6aed491
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,35 @@ jobs:
if: startsWith(matrix.config.name, 'Windows Clang')
run: |
$headers = @{ Authorization = 'Bearer ${{ secrets.GITHUB_TOKEN }}' }
echo "LLVM_RELID=$((Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases/latest').Content | ConvertFrom-Json | Select-Object -ExpandProperty id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$latestRelease = Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases/latest'
$releaseData = $latestRelease.Content | ConvertFrom-Json
$assets = $releaseData.assets | Where-Object { $_.name -like "*win64.exe" }
if ($assets) {
$downloadUrl = $assets.browser_download_url
echo "LLVM_RELID=$($releaseData.id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "LLVM_DOWNLOAD_URL=$downloadUrl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
Write-Host "No current Windows build available for the latest release. Searching for previous releases..."
$releases = Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases'
$found = $false
foreach ($release in $releases.Content | ConvertFrom-Json) {
$assets = $release.assets | Where-Object { $_.name -like "*win64.exe" }
if ($assets) {
$downloadUrl = $assets.browser_download_url
echo "LLVM_RELID=$($release.id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "LLVM_DOWNLOAD_URL=$downloadUrl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$found = $true
break
}
}
if (-not $found) {
Write-Host "No Windows build available for any recent releases."
exit 0
}
}
- name: Restore LLVM from cache
if: startsWith(matrix.config.name, 'Windows Clang')
Expand Down

0 comments on commit 6aed491

Please sign in to comment.