Skip to content

Commit

Permalink
Merge implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonlightSentinel committed Oct 25, 2021
1 parent fab5a9a commit 07bbf94
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 104 deletions.
29 changes: 1 addition & 28 deletions .azure-pipelines/windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,34 +134,7 @@ CC="$CC" ./run --environment --jobs=$N "${targets[@]}" "${args[@]}"

if [ "${DMD_TEST_COVERAGE:-0}" = "1" ] ; then
cd $DMD_DIR
# CodeCov gets confused by lst files which it can't match
rm -rf test/runnable/extra-files test/*.lst

# 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
codecov_uploader="codecov.exe"
codecov_url="https://uploader.codecov.io/latest/windows/$codecov_uploader"
download "$codecov_url" "$codecov_uploader"
download "$codecov_url.SHA256SUM" "$codecov_uploader.SHA256SUM"
download "$codecov_url.SHA256SUM.sig" "$codecov_uploader.SHA256SUM.sig"

# Verify the uploader
gpg --verify "$codecov_uploader.SHA256SUM.sig" "$codecov_uploader.SHA256SUM"
shasum -a 256 -c "$codecov_uploader.SHA256SUM"

# Upload the sources
chmod +x "$codecov_uploader"

# -C workaround proposed in https://github.com/codecov/codecov-bash/issues/287
"./$codecov_uploader" -p . -Z -C "$BUILD_SOURCEVERSION"

rm codecov*
OS_NAME=windows source ci/codecov.sh

# Skip druntime & phobos tests
exit 0
Expand Down
31 changes: 3 additions & 28 deletions .circleci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ download() {
local outputfile="$3"
for i in {0..4}; do
if curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$url" -o "$outputfile" ||
{ [ -n "$fallbackurl" ] && curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$fallbackurl" -o "$outputfile"; }
then
curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$fallbackurl" -o "$outputfile" ; then
break
elif [ $i -le 4 ]; then
elif [ $i -ge 4 ]; then
sleep $((1 << $i))
else
echo "Failed to download script ${outputfile}" 1>&2
Expand Down Expand Up @@ -193,31 +192,7 @@ test_cxx()
codecov()
{
# CodeCov gets confused by lst files which it can't match
rm -rf test/runnable/extra-files
# 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
rm codecov*
OS_NAME=linux source ci/codecov.sh
}
case $1 in
Expand Down
49 changes: 1 addition & 48 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,54 +213,7 @@ install_host_compiler() {
# Upload coverage reports
codecov()
{
# CodeCov gets confused by lst files which it can't match
rm -rf test/runnable/extra-files test/*.lst

# No FreeBSD support for the new uploader (yet?)
if [ "$OS_NAME" = "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 || echo "Failed to upload coverage reports!"
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

rm codecov*
source ci/codecov.sh
}

# Define commands
Expand Down
64 changes: 64 additions & 0 deletions ci/codecov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

# Uploads coverage reports to CodeCov

# CodeCov gets confused by lst files which it can't match
rm -rf test/runnable/extra-files test/*.lst

# Save the file from URL passed as $1 to the location in $2
doCurl()
{
curl -fsSL -A "$CURL_USER_AGENT" --connect-timeout 5 --speed-time 30 --speed-limit 1024 --retry 5 --retry-delay 5 "$1" -o "$2"
}

# Determine the correct uploader + url + arguments
UPLOADER="codecov"
UPLOADER_OS="$OS_NAME"
UPLOADER_ARGS=""

case "$UPLOADER_OS" in

windows)
# -C workaround proposed in https://github.com/codecov/codecov-bash/issues/287
UPLOADER_ARGS="-C \"$BUILD_SOURCEVERSION\""

UPLOADER="$UPLOADER.exe"
;;

darwin | osx)
UPLOADER_OS="macos"
;;

# No FreeBSD support for the new uploader (yet?)
freebsd)
doCurl "https://codecov.io/bash" "codecov.sh"
bash ./codecov.sh -p . -Z
rm codecov.sh
return 0
;;
esac

# Determine the host name
for file in "$UPLOADER" "$UPLOADER.SHA256SUM" "$UPLOADER.SHA256SUM.sig"
do
doCurl "https://uploader.codecov.io/latest/$UPLOADER_OS/$file" "$file"
done

# Obtain the key if missing
if ! gpg --list-keys ED779869
then
echo "Importing CodeCov key..."
doCurl "https://keybase.io/codecovsecurity/pgp_keys.asc" "pgp_keys.asc"
gpg --import pgp_keys.asc
rm pgp_keys.asc
fi

# Verify the uploader
gpg --verify "$UPLOADER.SHA256SUM.sig" "$UPLOADER.SHA256SUM"
shasum -a 256 -c "$UPLOADER.SHA256SUM"

# Upload the sources
chmod +x "$UPLOADER"
"./$UPLOADER" -p . -Z $UPLOADER_ARGS

rm codecov*

0 comments on commit 07bbf94

Please sign in to comment.