Skip to content

Commit

Permalink
Using a matrix for GH workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RadoslavGeorgiev committed Oct 26, 2023
1 parent b2c0f8b commit d35db34
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions bin/run-ci-tests-check-coverage.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d35db34

Please sign in to comment.