mirror of
https://github.com/meteor/meteor.git
synced 2026-01-07 23:04:13 -05:00
refactor CI install script to adapt for CI environment
This commit is contained in:
@@ -4,6 +4,9 @@ If ($env:PLATFORM -Match '^x86|x64$') {
|
||||
$env:PLATFORM = "windows_${env:PLATFORM}"
|
||||
}
|
||||
|
||||
# Check if we're running in a CI environment
|
||||
$isCI = $env:GITHUB_ACTIONS -eq "true"
|
||||
|
||||
$dirCheckout = (Get-Item $PSScriptRoot).parent.parent.parent.FullName
|
||||
$meteorBat = Join-Path $dirCheckout 'meteor.bat'
|
||||
|
||||
@@ -15,9 +18,10 @@ Write-Host "Updating submodules recursively..." -ForegroundColor Magenta
|
||||
# Appveyor suggests -q flag for 'git submodule...' https://goo.gl/4TFAHm
|
||||
& git.exe -C "$dirCheckout" submodule -q update --init --recursive
|
||||
|
||||
# If ($LASTEXITCODE -ne 0) {
|
||||
# throw "Updating submodules failed."
|
||||
# }
|
||||
# Only throw locally
|
||||
If ($LASTEXITCODE -ne 0 -and -not $isCI) {
|
||||
throw "Updating submodules failed."
|
||||
}
|
||||
|
||||
# The `meteor npm install` subcommand should work
|
||||
& "$meteorBat" npm install
|
||||
@@ -25,25 +29,28 @@ If ($LASTEXITCODE -ne 0) {
|
||||
throw "'meteor npm install' failed."
|
||||
}
|
||||
|
||||
# Only `meteor --get-ready` get-ready locally to have better control on CI
|
||||
# The `meteor --get-ready` command is susceptible to EPERM errors, so
|
||||
# we attempt it three times.
|
||||
$attempt = 3
|
||||
$success = $false
|
||||
while ($attempt -gt 0 -and -not $success) {
|
||||
If (-not $isCI) {
|
||||
$attempt = 3
|
||||
$success = $false
|
||||
while ($attempt -gt 0 -and -not $success) {
|
||||
|
||||
Write-Host "Running 'meteor --get-ready'..." -ForegroundColor Magenta
|
||||
# By redirecting error to host, we avoid a shocking/false error color,
|
||||
# since --get-ready and --version can print (anything) to STDERR and
|
||||
# PowerShell will interpret that as something being terribly wrong.
|
||||
# & "$meteorBat" --get-ready
|
||||
Write-Host "Running 'meteor --get-ready'..." -ForegroundColor Magenta
|
||||
# By redirecting error to host, we avoid a shocking/false error color,
|
||||
# since --get-ready and --version can print (anything) to STDERR and
|
||||
# PowerShell will interpret that as something being terribly wrong.
|
||||
& "$meteorBat" --get-ready
|
||||
|
||||
If ($LASTEXITCODE -eq 0) {
|
||||
$success = $true
|
||||
} else {
|
||||
$attempt--
|
||||
If ($LASTEXITCODE -eq 0) {
|
||||
$success = $true
|
||||
} else {
|
||||
$attempt--
|
||||
}
|
||||
}
|
||||
|
||||
If ($LASTEXITCODE -ne 0) {
|
||||
throw "Running .\meteor --get-ready failed three times."
|
||||
}
|
||||
}
|
||||
|
||||
If ($LASTEXITCODE -ne 0) {
|
||||
throw "Running .\meteor --get-ready failed three times."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user