BP CLI: update testing suite #19
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 }} - PHP: ${{ matrix.php }}" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [7.4, 8.0, 8.1, 8.2, 8.3] | |
wp: ['latest'] | |
mysql: [8.0] | |
env: | |
WP_VERSION: ${{ matrix.wp }} | |
services: | |
mysql: | |
image: mysql:${{ matrix.mysql }} | |
ports: | |
- 3306 | |
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: Cancel previous runs of this workflow (pull requests only) | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: styfle/cancel-workflow-action@0.5.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 | |
- name: Install Composer dependencies & cache dependencies | |
uses: ramsey/composer-install@v2 | |
- name: Start MySQL server | |
run: sudo systemctl start mysql | |
- name: Configure DB environment | |
run: | | |
export MYSQL_HOST=127.0.0.1 | |
export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }} | |
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV | |
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV | |
echo "WP_CLI_TEST_DBUSER=root" >> $GITHUB_ENV | |
echo "WP_CLI_TEST_DBPASS=root" >> $GITHUB_ENV | |
echo "WP_CLI_TEST_DBHOST=$MYSQL_HOST:$MYSQL_TCP_PORT" >> $GITHUB_ENV | |
- name: Prepare tests | |
run: composer prepare-tests | |
- name: Run Behat | |
run: composer behat || composer behat-rerun |