mirror of
https://github.com/boostorg/boost-ci.git
synced 2026-02-03 09:02:09 +00:00
gpg by default writes to stderr which is treated as "an error occurred" by PowerShell. Hence write log output to stdout (FD 1) too.
37 lines
1.7 KiB
PowerShell
37 lines
1.7 KiB
PowerShell
# Copyright 2019 - 2021 Alexander Grund
|
|
# Distributed under the Boost Software License, Version 1.0.
|
|
# (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$scriptPath = split-path $MyInvocation.MyCommand.Path
|
|
|
|
# Install uploader
|
|
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
|
|
|
|
# Verify integrity
|
|
if (Get-Command "gpg.exe" -ErrorAction SilentlyContinue){
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc
|
|
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
|
|
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
gpg.exe --logger-fd 1 --import codecov.asc
|
|
if ($LASTEXITCODE -ne 0) { Throw "Importing the key failed." }
|
|
gpg.exe --logger-fd 1 --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
|
|
if ($LASTEXITCODE -ne 0) { Throw "Signature validation of the SHASUM failed." }
|
|
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) {
|
|
echo "SHASUM verified"
|
|
} Else {
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
&"$scriptPath\opencppcoverage.ps1"
|
|
if ($LASTEXITCODE -ne 0) { Throw "Coverage collection failed." }
|
|
|
|
# Upload
|
|
./codecov.exe --name Appveyor --env APPVEYOR_BUILD_WORKER_IMAGE --verbose --nonZero --dir __out --rootDir "${env:BOOST_CI_SRC_FOLDER}"
|
|
if ($LASTEXITCODE -ne 0) { Throw "Upload of coverage data failed." }
|