Making GH actions happy #53
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Check Gitignored files | |
run: if [[ ! -z $(git ls-files -i --exclude-standard) ]]; then exit 1; fi | |
- 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 | |
distribution: 'mysql' | |
root-password: root | |
user: wp_cli_test | |
password: password1 | |
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 |