Skip to content

Update test.yml

Update test.yml #118

Workflow file for this run

name: Test
on: [push, workflow_dispatch]
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- wp_docker_tag: 5.5-php7.2-apache
xdebug_version: xdebug-2.7.2
php_version: '7.2'
- wp_docker_tag: 5.6-php7.2-apache
xdebug_version: xdebug-2.7.2
php_version: '7.2'
- wp_docker_tag: 5.7-php7.3-apache
xdebug_version: xdebug-2.7.2
php_version: '7.3'
- wp_docker_tag: 5.8-php7.3-apache
xdebug_version: xdebug-2.7.2
php_version: '7.3'
- wp_docker_tag: 5.8-php7.4-apache
xdebug_version: xdebug-3.0.4
php_version: '7.4'
- wp_docker_tag: 5.9-php7.3-apache
xdebug_version: xdebug-2.7.2
php_version: '7.3'
- wp_docker_tag: 5.9-php7.4-apache
xdebug_version: xdebug-3.0.4
php_version: '7.4'
- wp_docker_tag: 6.0-php7.4-apache
xdebug_version: xdebug-3.0.4
php_version: '7.4'
- wp_docker_tag: 6.1-php7.4-apache
xdebug_version: xdebug-3.0.4
php_version: '7.4'
- wp_docker_tag: 6.2-php8.0-apache
xdebug_version: xdebug-3.0.4
php_version: '8.0'
- wp_docker_tag: 6.3-php8.0-apache
xdebug_version: xdebug-3.0.4
php_version: '8.0'
- wp_docker_tag: 6.3-php8.1-apache
xdebug_version: xdebug-3.2.1
php_version: '8.1'
- wp_docker_tag: 6.3-php8.2-apache
xdebug_version: xdebug-3.2.1
php_version: '8.2'
fail-fast: false
env:
WP_DOCKER_TAG: ${{ matrix.wp_docker_tag }}
XDEBUG_VERSION: ${{ matrix.xdebug_version }}
PLUGIN_SLUG: disable-drop-cap
steps:
- uses: actions/checkout@v1
- name: Install PHP
uses: shivammathur/setup-php@verbose
with:
php-version: ${{ matrix.php_version }}
extensions: zip
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Setup docker
run: docker-compose --project-name ${{env.PLUGIN_SLUG}} up -d
- name: Create config file
run: touch .env.testing
- name: Check running containers
run: docker ps -a
- name: Run test suite
run: |
npx wait-on http://localhost/wp-login.php --verbose --timeout 60000 && docker exec -w /var/www/html ${{env.PLUGIN_SLUG}}_wordpress_1 bash -c "sudo chown -R www-data:www-data /var/www/html && sudo chmod -R 775 /var/www/html && wp core install --url=wordpress --title=example --admin_user=admin --admin_email=example@example.com --allow-root"
npx wait-on http://localhost/wp-login.php --verbose --timeout 60000 && docker exec -w /var/www/html/wp-content/plugins/${{env.PLUGIN_SLUG}} -e WP_ROOT_FOLDER -e TEST_SITE_WP_ADMIN_PATH -e TEST_SITE_DB_NAME -e TEST_SITE_DB_HOST -e TEST_SITE_DB_USER -e TEST_SITE_DB_PASSWORD -e TEST_SITE_DB_PASSWORD -e TEST_SITE_TABLE_PREFIX -e TEST_SITE_WP_URL -e TEST_SITE_WP_DOMAIN -e TEST_SITE_ADMIN_EMAIL -e TEST_SITE_ADMIN_USERNAME -e TEST_SITE_ADMIN_PASSWORD -e CHROMEDRIVER_HOST -e CHROMEDRIVER_PORT -e WP_VERSION ${{env.PLUGIN_SLUG}}_wordpress_1 bash -c './vendor/bin/codecept run acceptance --fail-fast --debug'
env:
WP_ROOT_FOLDER: /var/www/html
TEST_SITE_WP_ADMIN_PATH: /wp-admin
TEST_SITE_DB_NAME: exampledb
TEST_SITE_DB_HOST: db
TEST_SITE_DB_USER: exampleuser
TEST_SITE_DB_PASSWORD: examplepass
TEST_SITE_TABLE_PREFIX: wp_
TEST_SITE_WP_URL: http://wordpress
TEST_SITE_WP_DOMAIN: wordpress
TEST_SITE_ADMIN_EMAIL: example@example.com
TEST_SITE_ADMIN_USERNAME: admin
TEST_SITE_ADMIN_PASSWORD: admin
CHROMEDRIVER_HOST: chromedriver
CHROMEDRIVER_PORT: 4444
- name: Upload artifact
if: failure()
uses: actions/upload-artifact@v1.0.0
with:
name: Test output ${{ matrix.wp_docker_tag }}
path: tests/_output/