Skip to content

Commit

Permalink
GitHub Actions: Upload code coverage report to Code Climate as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Deltik committed Dec 28, 2019
1 parent 4ca73da commit 1aff15d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
env:
MYSQL_DATABASE: app
MYSQL_ROOT_PASSWORD: 'Database Password for Continuous Integration'
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

jobs:
test:
Expand Down Expand Up @@ -77,17 +78,35 @@ jobs:
- name: Install the CI test configuration file
run: cp ./e107_tests/lib/ci/config.ci.yml ./e107_tests/config.yml

- name: Download Code Climate test reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
working-directory: ./e107_tests/vendor/bin/
continue-on-error: true

- name: Run unit tests
run: |
if [ $(php -r 'printf(extension_loaded("xdebug") ? 1 : 0);') = '1' ]
then
[ -x ./vendor/bin/cc-test-reporter ] && ./vendor/bin/cc-test-reporter before-build
php ./vendor/bin/codecept run unit --steps --debug --coverage --coverage-xml #--coverage-html
[ -x ./vendor/bin/cc-test-reporter ] &&
./vendor/bin/cc-test-reporter format-coverage \
--input-type clover \
--output ./tests/_output/coverage/codeclimate.json \
./tests/_output/coverage.xml
else
echo "Warning: xdebug not available; skipping coverage..."
php ./vendor/bin/codecept run unit --steps --debug
fi
working-directory: ./e107_tests/

- name: Send code coverage report to Code Climate
run: ./vendor/bin/cc-test-reporter upload-coverage --input ./tests/_output/coverage/codeclimate.json
working-directory: ./e107_tests/
continue-on-error: true

- name: Send code coverage report to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down

0 comments on commit 1aff15d

Please sign in to comment.