Skip to content

Commit

Permalink
Upload phpunit coverage data to codecov.io [skip appveyor]
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Nov 16, 2018
1 parent 6aad3ba commit c0e7f02
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
28 changes: 14 additions & 14 deletions .ci/after-success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set -e +o pipefail

PROJECT_ROOT=$(readlink -enq "$(dirname $0)/../")
LCOV_REPORT=${PROJECT_ROOT}/unit-tests/output/lcov.info
PHPUNIT_REPORT=${PROJECT_ROOT}/unit-tests/output/lcov.info
PHPUNIT_REPORT=${PROJECT_ROOT}/unit-tests/output/clover.xml

if [[ $(command -v lcov 2>/dev/null) = "" ]]; then
echo -e "lcov does not exist.\nSkip capturing coverage data."
Expand Down Expand Up @@ -39,28 +39,28 @@ else
sed -i.bak s_${PROJECT_ROOT}/kernel_${PROJECT_ROOT}/ext/kernel_g ${LCOV_REPORT}
fi

# Don't install this unless we're actually on travis
if [[ "${TRAVIS}" = "true" ]]; then
gem install coveralls-lcov
fi

if [[ -f "${LCOV_REPORT}" ]]; then
echo -e "Uploading coverage report: ${LCOV_REPORT}...\n"
coveralls-lcov "${LCOV_REPORT}"
fi

# Note: to upload a coverage report, set the CODECOV_TOKEN environment variable
# export CODECOV_TOKEN=<codecov token>

if [[ -z ${CODECOV_TOKEN+x} ]]; then
echo -e "\nThe CODECOV_TOKEN variable is absent or empty.\nSkip uploading reports to Codecov.\n"
exit 0;
else
# Don't install this unless we're actually on travis
if [[ "${TRAVIS}" = "true" ]]; then
gem install coveralls-lcov
fi
fi

curl -sSl https://codecov.io/bash -o codecov.sh
chmod +x codecov.sh

if [[ -f "${LCOV_REPORT}" ]]; then
echo -e "Uploading coverage...\n"
coveralls-lcov "${LCOV_REPORT}"
#./codecov.sh -f "${LCOV_REPORT}"
if [[ -f "${PHPUNIT_REPORT}" ]]; then
echo -e "Uploading coverage report: ${PHPUNIT_REPORT}...\n"
./codecov.sh -f "${PHPUNIT_REPORT}"
fi

#if [[ -f "${PHPUNIT_REPORT}" ]]; then
# ./codecov.sh -f "${PHPUNIT_REPORT}"
#fi
2 changes: 2 additions & 0 deletions .ci/build-test-ext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ if [[ ! -z ${REPORT_COVERAGE+x} ]] && [[ "$REPORT_COVERAGE" = "true" ]]; then
else
# Reset all execution counts to zero
lcov \
--quiet \
--directory ext \
--base-directory=${PROJECT_ROOT} \
--zerocounters

# Capture coverage data
lcov \
--quiet \
--directory ext \
--base-directory=${PROJECT_ROOT} \
--capture \
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ before_install:
- ulimit -c unlimited -S
- mkdir -p ${HOME}/bin
- phpenv config-add .ci/999-default.ini
- phpenv config-rm xdebug.ini || echo "xdebug not available"

install:
- .ci/install-prereqs.sh
Expand All @@ -60,7 +59,7 @@ before_script:

script:
- zephir --ansi
- ./vendor/bin/phpcs
- vendor/bin/phpcs
- php -d extension=ext/modules/test.so unit-tests/phpunit

after_success:
Expand Down
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<ini name="display_startup_errors" value="on"/>
</php>

<!-- logging>
<logging>
<log type="coverage-clover" target="./unit-tests/output/clover.xml"/>
<log type="coverage-html" target="./unit-tests/output"/>
</logging -->
<!-- log type="coverage-html" target="./unit-tests/output/html"/-->
</logging>
</phpunit>

0 comments on commit c0e7f02

Please sign in to comment.