From 1aff15de2ebee653dd434c2915746689fdafa680 Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Sat, 28 Dec 2019 16:03:52 +0100 Subject: [PATCH] GitHub Actions: Upload code coverage report to Code Climate as well --- .github/workflows/test-unit.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 9f60c78859..237ef5b1e0 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -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: @@ -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: