78 lines
2.4 KiB
YAML
78 lines
2.4 KiB
YAML
name: Run CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- trunk
|
|
- 'release/**'
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
test:
|
|
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-20.04
|
|
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php: [ '7.2', '7.3', '7.4', '8.0' ]
|
|
wp: [ 'latest' ]
|
|
include:
|
|
- wp: nightly
|
|
php: '7.4'
|
|
- wp: '5.9'
|
|
php: 7.2
|
|
- wp: '5.8'
|
|
php: 7.2
|
|
services:
|
|
database:
|
|
image: mysql:5.6
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: root
|
|
ports:
|
|
- 3306:3306
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup WooCommerce Monorepo
|
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
|
with:
|
|
build-filters: woocommerce
|
|
|
|
- name: Tool versions
|
|
run: |
|
|
php --version
|
|
composer --version
|
|
|
|
- name: Build Admin feature config
|
|
working-directory: plugins/woocommerce
|
|
run: pnpm run build:feature-config
|
|
|
|
- name: Add PHP8 Compatibility.
|
|
run: |
|
|
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
|
cd plugins/woocommerce
|
|
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
|
|
rm -rf ./vendor/phpunit/
|
|
composer dump-autoload
|
|
fi
|
|
|
|
- name: Init DB and WP
|
|
working-directory: plugins/woocommerce
|
|
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
|
|
|
- name: Run tests
|
|
working-directory: plugins/woocommerce
|
|
run: pnpm run test --color
|