Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GHA functional tests workflow #60

Merged
merged 4 commits into from Mar 3, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
@@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: Check out source code
@@ -58,35 +58,55 @@ jobs:
run: composer phpunit

functional: #----------------------------------------------------------------------
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }}
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }}
strategy:
fail-fast: false
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
wp: ['latest']
mysql: ['8.0']
test: ["composer behat || composer behat-rerun"]
include:
- php: '5.6'
wp: 'trunk'
mysql: '8.0'
test: "composer behat || composer behat-rerun"
- php: '5.6'
wp: 'trunk'
mysql: '5.7'
test: "composer behat || composer behat-rerun"
- php: '5.6'
wp: 'trunk'
mysql: '5.6'
test: "composer behat || composer behat-rerun"
- php: '7.4'
wp: 'trunk'
mysql: '8.0'
test: "composer behat || composer behat-rerun"
- php: '8.0'
wp: 'trunk'
mysql: '8.0'
test: "composer behat || composer behat-rerun"
- php: '8.0'
wp: 'trunk'
mysql: '5.7'
test: "composer behat || composer behat-rerun"
- php: '8.0'
wp: 'trunk'
mysql: '5.6'
test: "composer behat || composer behat-rerun"
- php: '5.6'
wp: '3.7'
test: "composer behat || composer behat-rerun || true"
runs-on: ubuntu-latest
mysql: '5.6'
test: "composer behat || composer behat-rerun"
runs-on: ubuntu-20.04

services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: wp_cli_test
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
image: mysql:${{ matrix.mysql }}
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp_cli_test --entrypoint sh mysql:${{ matrix.mysql }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"

steps:
- name: Check out source code
@@ -99,6 +119,7 @@ jobs:
files: "composer.json, behat.yml"

- name: Set up PHP envirnoment
if: steps.check_files.outputs.files_exists == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
@@ -127,20 +148,25 @@ jobs:

- name: Start MySQL server
if: steps.check_files.outputs.files_exists == 'true'
run: sudo service mysql start
run: sudo systemctl start mysql

- name: Prepare test database
- name: Configure DB environment
if: steps.check_files.outputs.files_exists == 'true'
run: |
export MYQSL_HOST=127.0.0.1
export MYSQL_HOST=127.0.0.1
export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBHOST=$MYSQL_HOST:$MYSQL_TCP_PORT" >> $GITHUB_ENV
- name: Prepare test database
if: steps.check_files.outputs.files_exists == 'true'
run: composer prepare-tests

- name: Run Behat
if: steps.check_files.outputs.files_exists == 'true'
env:
WP_VERSION: '${{ matrix.wp }}'
run: ${{ matrix.test }}

@@ -1,4 +1,7 @@
default:
paths:
features: features
bootstrap: vendor/wp-cli/wp-cli-tests/features/bootstrap
suites:
default:
contexts:
- WP_CLI\Tests\Context\FeatureContext
paths:
- features
@@ -11,11 +11,11 @@
}
],
"require": {
"wp-cli/wp-cli": "^2"
"wp-cli/wp-cli": "^2.5",
"wp-cli/wp-cli-tests": "^3.0.2"
},
"require-dev": {
"wp-cli/entity-command": "^1.3 || ^2",
"wp-cli/wp-cli-tests": "^2.1"
"wp-cli/entity-command": "^1.3 || ^2"
},
"config": {
"process-timeout": 7200,