2021-02-01 02:24:11 +00:00
|
|
|
name: Run PHP unit tests
|
|
|
|
on: [pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test-php:
|
|
|
|
env:
|
|
|
|
WP_CORE_DIR: '/tmp/wordpress'
|
|
|
|
COMPOSER_DEV: 1
|
|
|
|
|
2021-03-12 01:14:35 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2021-02-01 02:24:11 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php: ['7.1', '7.2', '7.3']
|
2021-02-18 22:22:56 +00:00
|
|
|
wordpress: ['5.4', '5.6']
|
2021-02-01 02:24:11 +00:00
|
|
|
woocommerce: ['4.8.0', '4.9.1']
|
|
|
|
phpunit: ['7.5.20']
|
|
|
|
composer: ['2.0.6']
|
|
|
|
include:
|
|
|
|
- php: '7.0'
|
2021-10-26 17:27:37 +00:00
|
|
|
wordpress: '5.6'
|
2021-02-01 02:24:11 +00:00
|
|
|
woocommerce: 'latest'
|
|
|
|
phpunit: '6.5.9'
|
|
|
|
composer: '1.10.19'
|
|
|
|
- php: '7.0'
|
|
|
|
wordpress: '5.6'
|
|
|
|
woocommerce: '4.9.1'
|
|
|
|
phpunit: '6.5.9'
|
|
|
|
composer: '2.0.6'
|
2021-04-07 17:28:03 +00:00
|
|
|
- php: '8.0'
|
|
|
|
wordpress: '5.6'
|
|
|
|
woocommerce: '5.1.0'
|
|
|
|
phpunit: '7.5.20'
|
|
|
|
composer: '2.0.6'
|
2021-02-01 02:24:11 +00:00
|
|
|
steps:
|
|
|
|
- name: Cancel Previous Runs
|
|
|
|
uses: styfle/cancel-workflow-action@0.7.0
|
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@2.9.0
|
|
|
|
with:
|
|
|
|
php-version: ${{matrix.php}}
|
|
|
|
tools: phpunit:${{matrix.phpunit}}
|
|
|
|
extensions: mysqli
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v2-beta
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
|
|
|
- name: Set up the tests
|
|
|
|
env:
|
|
|
|
WP_VERSION: ${{matrix.wordpress}}
|
|
|
|
WC_VERSION: ${{matrix.woocommerce}}
|
|
|
|
PHP_UNIT: ${{matrix.phpunit}}
|
|
|
|
COMPOSER_VERSION: ${{matrix.composer}}
|
|
|
|
run: |
|
|
|
|
sudo /etc/init.d/mysql start
|
|
|
|
bash bin/ci/gh-install-wp-tests.sh wc_admin_test root 'root' localhost
|
|
|
|
cd "$WP_CORE_DIR/wp-content/plugins/woocommerce-admin/"
|
|
|
|
npm run build:feature-config
|
2021-09-23 10:01:52 +00:00
|
|
|
composer install
|
2021-02-01 02:24:11 +00:00
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
timedatectl
|
2021-04-07 17:28:03 +00:00
|
|
|
- name: Add PHP8 Compatibility.
|
|
|
|
run: |
|
|
|
|
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
|
|
|
cd "$WP_CORE_DIR/wp-content/plugins/woocommerce-admin/"
|
|
|
|
composer install
|
|
|
|
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
|
|
|
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
|
|
|
composer bin phpunit config --unset platform
|
|
|
|
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
|
|
|
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
2021-09-23 10:01:52 +00:00
|
|
|
rm -rf ./vendor/phpunit/
|
|
|
|
composer dump-autoload
|
2021-04-07 17:28:03 +00:00
|
|
|
fi
|
2021-02-01 02:24:11 +00:00
|
|
|
- name: Run the PHP unit tests
|
|
|
|
run: bin/phpunit.sh
|
|
|
|
shell: bash
|