Skip to content

Commit

Permalink
Switch to new CodeCov uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonlightSentinel committed Oct 7, 2021
1 parent b4f8658 commit af447bc
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 10 deletions.
31 changes: 26 additions & 5 deletions .circleci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ download() {
local outputfile="$3"
for i in {0..4}; do
if curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$url" -o "$outputfile" ||
curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$fallbackurl" -o "$outputfile" ; then
{ [ -n "$fallbackurl" ] && curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$fallbackurl" -o "$outputfile"; }
then
break
elif [ $i -ge 4 ]; then
elif [ $i -le 4 ]; then
sleep $((1 << $i))
else
echo "Failed to download script ${outputfile}" 1>&2
Expand Down Expand Up @@ -194,9 +195,29 @@ codecov()
{
# CodeCov gets confused by lst files which it can't match
rm -rf test/runnable/extra-files
download "https://codecov.io/bash" "https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov" "codecov.sh"
bash ./codecov.sh -p . -Z || echo "Failed to upload coverage reports!"
rm codecov.sh
# Obtain the key if missing
if ! gpg --list-keys ED779869
then
download https://keybase.io/codecovsecurity/pgp_keys.asc "" pgp_keys.asc
gpg --import pgp_keys.asc
fi
# Obtain the uploader + signatures
local url="https://uploader.codecov.io/latest/linux/codecov"
download "$url" "" "codecov"
download "$url.SHA256SUM" "" "codecov.SHA256SUM"
download "$url.SHA256SUM.sig" "" "codecov.SHA256SUM.sig"
# Verify the uploader
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM
# Upload the sources
chmod +x codecov
./codecov -p . -Z || echo "Failed to upload coverage reports!"
rm codecov*
}
case $1 in
Expand Down
48 changes: 45 additions & 3 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,52 @@ codecov()
{
# CodeCov gets confused by lst files which it can't match
rm -rf test/runnable/extra-files test/*.lst
curl -fsSL -A "$CURL_USER_AGENT" --connect-timeout 5 --speed-time 30 --speed-limit 1024 \

# No FreeBSD support for the new uploader (yet?)
if [ "$OS_NAME" -eq "freebsd"]
then
curl -fsSL -A "$CURL_USER_AGENT" --connect-timeout 5 --speed-time 30 --speed-limit 1024 \
--retry 5 --retry-delay 5 "https://codecov.io/bash" -o "codecov.sh"
bash ./codecov.sh -p . -Z
rm codecov.sh
bash ./codecov.sh -p . -Z
rm codecov.sh
return 0
fi

# Determine the correct uploader url
local os="$OS_NAME";

case $OS_NAME in
darwin | osx) os="macos" ;;
esac

# Determine the host name
for file in "codecov" "codecov.SHA256SUM" "codecov.SHA256SUM.sig"
do
curl -fsSL -A "$CURL_USER_AGENT" --connect-timeout 5 --speed-time 30 --speed-limit 1024 \
--retry 5 --retry-delay 5 "https://uploader.codecov.io/latest/$os/$file" -o "$file"
done

gpg --version

# Obtain the key if missing
if ! gpg --list-keys ED779869
then
echo "Importing CodeCov key..."
curl -fsSL -A "$CURL_USER_AGENT" --connect-timeout 5 --speed-time 30 --speed-limit 1024 \
--retry 5 --retry-delay 5 "https://keybase.io/codecovsecurity/pgp_keys.asc" -o "pgp_keys.asc"
gpg --import pgp_keys.asc
echo "Done"
fi

# Verify the uploader
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM

# Upload the sources
chmod +x codecov
./codecov -p . -Z || echo "Failed to upload coverage reports!"

rm codecov*
}

# Define commands
Expand Down
4 changes: 2 additions & 2 deletions cirrusci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ -z ${HOST_DMD+x} ] ; then echo "Variable 'HOST_DMD' needs to be set."; exit

if [ "$OS_NAME" == "linux" ]; then
export DEBIAN_FRONTEND=noninteractive
packages="git-core make g++ gdb curl libcurl4 tzdata zip unzip xz-utils"
packages="git-core make g++ gdb gnupg curl libcurl4 tzdata zip unzip xz-utils"
if [ "$MODEL" == "32" ]; then
dpkg --add-architecture i386
packages="$packages g++-multilib libcurl4:i386"
Expand All @@ -32,7 +32,7 @@ elif [ "$OS_NAME" == "darwin" ]; then
brew update-reset
brew install gnupg
elif [ "$OS_NAME" == "freebsd" ]; then
packages="git gmake"
packages="git gmake gnupg"
if [ "$HOST_DMD" == "dmd-2.079.0" ] ; then
packages="$packages lang/gcc9"
fi
Expand Down

0 comments on commit af447bc

Please sign in to comment.