diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b1401136de9..e3f3dac0043 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -18,9 +18,11 @@ jobs: woocommerce: [ 'latest' ] wordpress: [ 'latest' ] php: [ '7.4' ] + directory: [ 'includes', 'src' ] env: - WP_VERSION: ${{ matrix.wordpress }} - WC_VERSION: ${{ matrix.woocommerce }} + WP_VERSION: ${{ matrix.wordpress }} + WC_VERSION: ${{ matrix.woocommerce }} + COVERAGE_DIR: ${{ matrix.directory }} steps: # clone the repository - uses: actions/checkout@v3 diff --git a/bin/run-ci-tests-check-coverage.bash b/bin/run-ci-tests-check-coverage.bash index cddb5183620..52cf248489d 100644 --- a/bin/run-ci-tests-check-coverage.bash +++ b/bin/run-ci-tests-check-coverage.bash @@ -7,10 +7,19 @@ IFS=$'\n\t' # set environment variables WCPAY_DIR="$GITHUB_WORKSPACE" +# determine whether to test everything, or just src, and what coverage to require +if [ "$COVERAGE_DIR" == "src" ]; then + CONFIGURATION_FILE=phpunit-src.xml.dist + COVERAGE=100 +else + CONFIGURATION_FILE=phpunit.xml.dist + COVERAGE=60 +fi + composer self-update && composer install --no-progress sudo systemctl start mysql.service bash bin/install-wp-tests.sh woocommerce_test root root localhost $WP_VERSION $WC_VERSION false echo 'Running the tests...' -bash bin/phpunit.sh -c phpunit.xml.dist --coverage-clover /tmp/clover.xml -vendor/bin/coverage-check /tmp/clover.xml 60 +bash bin/phpunit.sh -c $CONFIGURATION_FILE --coverage-clover /tmp/clover.xml +vendor/bin/coverage-check /tmp/clover.xml $COVERAGE