ci: fail appveyor build if artifacts are missing (#39210)
This commit is contained in:
parent
1231f0a734
commit
e543126957
2 changed files with 52 additions and 22 deletions
|
@ -203,16 +203,28 @@ for:
|
||||||
on_finish:
|
on_finish:
|
||||||
# Uncomment this lines to enable RDP
|
# Uncomment this lines to enable RDP
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
- cd C:\projects\src
|
- ps: |
|
||||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
cd C:\projects\src
|
||||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
$missing_artifacts = $false
|
||||||
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
|
$artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')
|
||||||
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
foreach($artifact_name in $artifacts_to_upload) {
|
||||||
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
if ($artifact_name -eq 'ffmpeg.zip') {
|
||||||
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
$artifact_file = "out\ffmpeg\ffmpeg.zip"
|
||||||
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
} elseif ($artifact_name -eq 'node_headers.zip') {
|
||||||
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
$artifact_file = $artifact_name
|
||||||
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
} else {
|
||||||
|
$artifact_file = "out\Default\$artifact_name"
|
||||||
|
}
|
||||||
|
if (Test-Path $artifact_file) {
|
||||||
|
appveyor-retry appveyor PushArtifact $artifact_file
|
||||||
|
} else {
|
||||||
|
Write-warning "$artifact_name is missing and cannot be added to artifacts"
|
||||||
|
$missing_artifacts = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($missing_artifacts) {
|
||||||
|
throw "Build failed due to missing artifacts"
|
||||||
|
}
|
||||||
- ps: >-
|
- ps: >-
|
||||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||||
appveyor-retry appveyor PushArtifact pdb.zip
|
appveyor-retry appveyor PushArtifact pdb.zip
|
||||||
|
@ -245,7 +257,7 @@ for:
|
||||||
# Download build artifacts
|
# Download build artifacts
|
||||||
$apiUrl = 'https://ci.appveyor.com/api'
|
$apiUrl = 'https://ci.appveyor.com/api'
|
||||||
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
||||||
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','pdb.zip','electron.lib')
|
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib')
|
||||||
foreach ($job in $build_info.build.jobs) {
|
foreach ($job in $build_info.build.jobs) {
|
||||||
if ($job.name -eq "Build Arm on X64 Windows") {
|
if ($job.name -eq "Build Arm on X64 Windows") {
|
||||||
$jobId = $job.jobId
|
$jobId = $job.jobId
|
||||||
|
@ -257,10 +269,13 @@ for:
|
||||||
}
|
}
|
||||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||||
}
|
}
|
||||||
|
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
|
||||||
|
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
|
||||||
|
# 7z x -y -osrc pdb.zip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
- ps: |
|
- ps: |
|
||||||
$out_default_zips = @('dist.zip','pdb.zip')
|
$out_default_zips = @('dist.zip')
|
||||||
foreach($zip_name in $out_default_zips) {
|
foreach($zip_name in $out_default_zips) {
|
||||||
7z x -y -osrc\out\Default $zip_name
|
7z x -y -osrc\out\Default $zip_name
|
||||||
}
|
}
|
||||||
|
|
35
appveyor.yml
35
appveyor.yml
|
@ -201,16 +201,28 @@ for:
|
||||||
on_finish:
|
on_finish:
|
||||||
# Uncomment this lines to enable RDP
|
# Uncomment this lines to enable RDP
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
- cd C:\projects\src
|
- ps: |
|
||||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
cd C:\projects\src
|
||||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
$missing_artifacts = $false
|
||||||
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
|
$artifacts_to_upload = @('dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip')
|
||||||
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
foreach($artifact_name in $artifacts_to_upload) {
|
||||||
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
if ($artifact_name -eq 'ffmpeg.zip') {
|
||||||
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
$artifact_file = "out\ffmpeg\ffmpeg.zip"
|
||||||
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
} elseif ($artifact_name -eq 'node_headers.zip') {
|
||||||
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
$artifact_file = $artifact_name
|
||||||
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
} else {
|
||||||
|
$artifact_file = "out\Default\$artifact_name"
|
||||||
|
}
|
||||||
|
if (Test-Path $artifact_file) {
|
||||||
|
appveyor-retry appveyor PushArtifact $artifact_file
|
||||||
|
} else {
|
||||||
|
Write-warning "$artifact_name is missing and cannot be added to artifacts"
|
||||||
|
$missing_artifacts = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($missing_artifacts) {
|
||||||
|
throw "Build failed due to missing artifacts"
|
||||||
|
}
|
||||||
- ps: >-
|
- ps: >-
|
||||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||||
appveyor-retry appveyor PushArtifact pdb.zip
|
appveyor-retry appveyor PushArtifact pdb.zip
|
||||||
|
@ -253,6 +265,9 @@ for:
|
||||||
}
|
}
|
||||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||||
}
|
}
|
||||||
|
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
|
||||||
|
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
|
||||||
|
# 7z x -y -osrc pdb.zip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
- ps: |
|
- ps: |
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue