From 939d01271c00297bcc5279559b1fcc2e5894801c 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 9f60c7885..19a02fbe5 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,6 +78,17 @@ 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: Code Climate report before build + run: ./e107_tests/vendor/bin/cc-test-reporter before-build + continue-on-error: true + - name: Run unit tests run: | if [ $(php -r 'printf(extension_loaded("xdebug") ? 1 : 0);') = '1' ] @@ -88,6 +100,16 @@ jobs: fi working-directory: ./e107_tests/ + - name: Send code coverage report to Code Climate + run: | + ./e107_tests/vendor/bin/cc-test-reporter format-coverage \ + --input-type clover \ + --output ./e107_tests/tests/_output/coverage/codeclimate.json \ + ./e107_tests/tests/_output/coverage.xml + ./e107_tests/vendor/bin/cc-test-reporter upload-coverage \ + --input ./e107_tests/tests/_output/coverage/codeclimate.json + continue-on-error: true + - name: Send code coverage report to Codecov uses: codecov/codecov-action@v1 with: