Skip to content

Misc fixes

Misc fixes #47

Workflow file for this run

name: Testing
on: pull_request
jobs:
tests:
name: "WP: ${{ matrix.wp_version }} - PHP: ${{ matrix.php }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
wp_version: ['latest']
mysql: [8.0]
include:
- php: '7.4'
wp_version: '6.1'
env:
WP_VERSION: ${{ matrix.wp_version }}
steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Check out source code
uses: actions/checkout@v3
- name: Check Gitignored files
run: if [[ ! -z $(git ls-files -i --exclude-standard) ]]; then exit 1; fi
- name: Check existence of composer.json & behat.yml files
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "composer.json, behat.yml"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, imagick, mysql, zip
coverage: none
tools: composer:v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Setup MySQL Server
id: setup-mysql
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql }}
auto-start: true
root-password: root
user: wp_cli_test
password: password1
my-cnf: |
default_authentication_plugin=mysql_native_password
- name: Configure DB environment
run: |
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
echo "MYSQL_TCP_PORT=3306" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $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=127.0.0.1:3306" >> $GITHUB_ENV
- name: Prepare tests
env:
WP_VERSION: '${{ matrix.wp_version }}'
WP_CLI_TEST_DBTYPE: 'mysql'
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
run: composer prepare-tests
- name: Run Behat
env:
WP_VERSION: '${{ matrix.wp_version }}'
WP_CLI_TEST_DBTYPE: 'mysql'
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
run: composer behat || composer behat-rerun