fix: skip artifact validation for doc-only PRs (#39296)

This commit is contained in:
Shelley Vohr 2023-07-31 15:59:51 +02:00 committed by GitHub
parent 724f90a2a7
commit 8e5bb4949b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 34 deletions

View file

@ -74,8 +74,10 @@ for:
- ps: | - ps: |
node script/yarn.js install --frozen-lockfile node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change" Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild Exit-AppveyorBuild
} else { } else {
$global:LASTEXITCODE = 0 $global:LASTEXITCODE = 0
@ -206,25 +208,29 @@ for:
- ps: | - ps: |
cd C:\projects\src cd C:\projects\src
$missing_artifacts = $false $missing_artifacts = $false
$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 ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
foreach($artifact_name in $artifacts_to_upload) { Write-warning "Skipping artifact validation for doc-only PR"
if ($artifact_name -eq 'ffmpeg.zip') { } else {
$artifact_file = "out\ffmpeg\ffmpeg.zip" $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')
} elseif ($artifact_name -eq 'node_headers.zip') { foreach($artifact_name in $artifacts_to_upload) {
$artifact_file = $artifact_name if ($artifact_name -eq 'ffmpeg.zip') {
} else { $artifact_file = "out\ffmpeg\ffmpeg.zip"
$artifact_file = "out\Default\$artifact_name" } elseif ($artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} 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 (Test-Path $artifact_file) { if ($missing_artifacts) {
appveyor-retry appveyor PushArtifact $artifact_file throw "Build failed due to missing artifacts"
} 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

View file

@ -72,8 +72,10 @@ for:
- ps: | - ps: |
node script/yarn.js install --frozen-lockfile node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change" Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild Exit-AppveyorBuild
} else { } else {
$global:LASTEXITCODE = 0 $global:LASTEXITCODE = 0
@ -204,25 +206,30 @@ for:
- ps: | - ps: |
cd C:\projects\src cd C:\projects\src
$missing_artifacts = $false $missing_artifacts = $false
$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')
foreach($artifact_name in $artifacts_to_upload) { if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
if ($artifact_name -eq 'ffmpeg.zip') { Write-warning "Skipping artifact validation for doc-only PR"
$artifact_file = "out\ffmpeg\ffmpeg.zip" } else {
} elseif ($artifact_name -eq 'node_headers.zip') { $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')
$artifact_file = $artifact_name foreach($artifact_name in $artifacts_to_upload) {
} else { if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\Default\$artifact_name" $artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif ($artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} 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 (Test-Path $artifact_file) { if ($missing_artifacts) {
appveyor-retry appveyor PushArtifact $artifact_file throw "Build failed due to missing artifacts"
} 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