Skip to content

Feature: Implement shortcode, block redirects (#6860) #4740

Feature: Implement shortcode, block redirects (#6860)

Feature: Implement shortcode, block redirects (#6860) #4740

Workflow file for this run

name: WordPress Tests
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, develop, epic/** ]
pull_request:
branches: [ master, develop, epic/** ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to use this workflow as part of another workflow
workflow_call:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
strategy:
matrix:
php: [ 7.0, 7.4, 8.0 ]
mysql: [ 'mysql:5.6', 'mysql:8.0' ]
wordpress: [ '5.0', latest ]
exclude:
- php: 7.4
wordpress: '5.0'
- php: 8.0
wordpress: '5.0'
services:
mysql56:
image: mysql:5.6
env:
MYSQL_ROOT_PASSWORD: N0Tweak!@123!
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# This was a total pain to get setup. The default authentication plugin changed in MySQL 8 and is incompatible
# with WordPress. So it needs to be set back to mysql_native_password. The best way to do this is to use the
# command option in docker to apply it once the container is set up... but Github Actions does not support this.
# The workaround is to execute the command in the options, but it is VITAL that it is the LAST option and that any
# environment variables are added via options. DO NOT ADD THE ENV LINE IN YAML. You've been warned.
# @see https://github.com/docker-library/mysql/issues/690
mysql80:
image: mysql:8.0
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -e MYSQL_ROOT_PASSWORD=N0Tweak!@123! --entrypoint sh mysql:8.0 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
# @link https://github.com/spatie/laravel-activitylog/blob/master/.github/workflows/run-tests.yml
- name: Set Up PHP for build
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none
- name: Install composer dependencies
run: composer install --no-progress --no-interaction
- name: Store MySQL details in environment
run: |
case "$MYSQL_VERSION" in
'mysql:5.6')
MYSQL_PORT=${{ job.services.mysql56.ports[3306] }}
MYSQL_PASS=N0Tweak!@123!
;;
'mysql:8.0')
MYSQL_PORT=${{ job.services.mysql80.ports[3306] }}
MYSQL_PASS=N0Tweak!@123!
;;
esac
echo "mysql_port=$MYSQL_PORT" >> $GITHUB_ENV
echo "mysql_pass=$MYSQL_PASS" >> $GITHUB_ENV
env:
MYSQL_VERSION: ${{ matrix.mysql }}
- name: Configure MySQL
run: mysql -uroot --password='${{ env.mysql_pass}}' -h127.0.0.1 --port=${{env.mysql_port}}
- name: Set Up PHP for testing
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none
- name: Reload Composer autoload
run: composer dump-autoload
- name: Set Up Tests
run: bash tests/includes/bin/install.sh wordpress_test root ${{ env.mysql_pass }} 127.0.0.1:${{ env.mysql_port }} ${{ matrix.wordpress }}
- name: Run Tests
run: php -d memory_limit=-1 vendor/bin/phpunit
env:
DB_PORT: ${{ env.mysql_port }}