From 9e18a97e6ee93481089fe0afb76430f3196eded0 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 27 May 2024 07:31:31 +1000 Subject: [PATCH] Added coverage for CircleCI. --- .circleci/config.yml | 31 ++++++++++++++++++++----------- .github/workflows/test.yml | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d4de9a3..eb54899 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,6 +30,13 @@ job-test: &job-test sudo ldconfig echo "export LD_LIBRARY_PATH=/usr/local/lib" >> $BASH_ENV + - run: + name: Install PCOV + command: | + sudo pecl install pcov + echo "extension=pcov.so" | sudo tee -a /usr/local/etc/php/conf.d/pcov.ini + echo "pcov.enabled=1" | sudo tee -a /usr/local/etc/php/conf.d/pcov.ini + - run: name: Assemble the codebase command: .devtools/assemble.sh @@ -72,20 +79,22 @@ job-test: &job-test command: vendor/bin/phpunit || [ "${CI_TEST_IGNORE_FAILURE:-0}" -eq 1 ] working_directory: build - - run: - name: Process artifacts - command: | - if [ -d "build/web/sites/simpletest/browser_output" ]; then - mkdir -p /tmp/artifacts/simpletest - cp -Rf "build/web/sites/simpletest/browser_output/." /tmp/artifacts/simpletest - fi - when: always - - store_test_results: - path: /tmp/test_results + path: .logs/test_results - store_artifacts: - path: /tmp/artifacts + path: build/web/sites/simpletest/browser_output + + - store_artifacts: + path: .logs/coverage + + - run: + name: Upload code coverage reports to Codecov + command: | + if [ -n "${CODECOV_TOKEN}" ] && [ -d .logs/coverage/phpunit ]; then + curl -Os https://cli.codecov.io/latest/linux/codecov && sudo chmod +x codecov + ./codecov --verbose upload-process --fail-on-error -n "circleci-$CIRCLE_JOB" -s .logs/coverage + fi jobs: test-php-8.2: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce00c69..42ecfa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,7 +106,7 @@ jobs: working-directory: build run: vendor/bin/phpunit || [ "${CI_TEST_IGNORE_FAILURE:-0}" -eq 1 ] - - name: Process artifacts + - name: Upload test results as an artifact uses: actions/upload-artifact@v4 with: name: Artifacts (${{ matrix.name }})