Skip to content

Commit

Permalink
Revert "Rework the codecov support: deprecate codecov-token add hash …
Browse files Browse the repository at this point in the history
…checks for uploader"

This reverts commit 833ceeb. Needs to
go through review
  • Loading branch information
j-rivero committed Apr 28, 2021
1 parent 833ceeb commit 00af42f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 30 deletions.
13 changes: 1 addition & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,10 @@ inputs:
description: 'Dependencies to apt install'
required: false
default: ''
codecov-enabled:
description: 'Prepare the build for coverage and execute codecov'
required: false
default: ''
codecov-token-private-repos:
description: 'Token to upload to codecov in private repositories. Public repos do not need it'
required: false
default: ''
codecov-token:
description: 'DEPRECATED: use codecov-token-private if using private repositories'
description: 'Token to upload to Codecov'
required: false
default: ''
deprecationMessage: 'Public repositories do not need codecov-token, use codecov-enabled to run codecov on Public repositories. To facilitate transition codecov is enabled but not using any token'
cmake-args:
description: 'Additional CMake arguments to use when building package under test'
required: false
Expand All @@ -47,7 +38,5 @@ runs:
image: 'Dockerfile'
args:
- ${{ inputs.apt-dependencies }}
- ${{ inputs.codecov-enabled }}
- ${{ inputs.codecov-token-private-repos }}
- ${{ inputs.codecov-token }}
- ${{ inputs.cmake-args }}
25 changes: 7 additions & 18 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ set -x
set -e

OLD_APT_DEPENDENCIES=$1
CODECOV_ENABLED=$2
CODECOV_TOKEN_PRIVATE_REPOS=$3
DEPRECATED_CODECOV_TOKEN=$4
CMAKE_ARGS=$5

# keep the previous behaviour of running codecov if old token is set
[ -n "${DEPRECATED_CODECOV_TOKEN}" ] && CODECOV_ENABLED=1
CODECOV_TOKEN=$2
CMAKE_ARGS=$3

export DEBIAN_FRONTEND="noninteractive"

Expand Down Expand Up @@ -118,7 +113,7 @@ if [ -f "$SCRIPT_BEFORE_CMAKE" ] || [ -f "$SCRIPT_BEFORE_CMAKE_VERSIONED" ] ; th
fi

echo ::group::cmake
if [ -n "$CODECOV_ENABLED" ] && ${CODECOV_ENABLED} ; then
if [ ! -z "$CODECOV_TOKEN" ] ; then
cmake .. $CMAKE_ARGS -DCMAKE_BUILD_TYPE=coverage
else
cmake .. $CMAKE_ARGS
Expand Down Expand Up @@ -180,19 +175,13 @@ if [ -f "$SCRIPT_AFTER_MAKE_TEST" ] || [ -f "$SCRIPT_AFTER_MAKE_TEST_VERSIONED"
echo ::endgroup::
fi

if [ -n "$CODECOV_ENABLED" ] && ${CODECOV_ENABLED} ; then
if [ ! -z "$CODECOV_TOKEN" ] ; then
echo ::group::codecov
make coverage VERBOSE=1

# Download codecov, check hash
curl -s https://codecov.io/bash > codecov
curl -s https://codecov.io/env > env # needed to make the checksum work
VERSION=$(grep 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2)
curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA512SUM" > hash_file
shasum -a 512 -c hash_file
curl -v -f https://codecov.io/bash > codecov.sh

# disable gcov output with `-X gcovout -X gcov`
private_repo_token=
[ -n "${CODECOV_TOKEN}" ] && private_repo_token="-t $CODECOV_TOKEN"
bash codecov ${private_repo_token} -X gcovout -X gcov
bash codecov.sh -t $CODECOV_TOKEN -X gcovout -X gcov
echo ::endgroup::
fi

0 comments on commit 00af42f

Please sign in to comment.