Some minor changes #452
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: Test | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
acf_version: | |
- 5.9.9 | |
- 5.10.2 | |
- 5.11.4 | |
wp_docker_tag: | |
- 5.0-php7.0-apache | |
- 5.1-php7.1-apache | |
- 5.2-php7.1-apache | |
- 5.3-php7.1-apache | |
- 5.4-php7.2-apache | |
- 5.5-php7.2-apache | |
- 5.6-php7.2-apache | |
- 5.7-php7.3-apache | |
- 5.8-php7.4-apache | |
- 5.9-php7.4-apache | |
include: | |
- wp_docker_tag: 5.0-php7.0-apache | |
xdebug_version: xdebug-2.7.2 | |
php_version: '7.0' | |
- wp_docker_tag: 5.1-php7.1-apache | |
xdebug_version: xdebug-2.7.2 | |
php_version: '7.1' | |
- wp_docker_tag: 5.2-php7.1-apache | |
xdebug_version: xdebug-2.7.2 | |
php_version: '7.1' | |
- wp_docker_tag: 5.3-php7.1-apache | |
xdebug_version: xdebug-2.7.2 | |
php_version: '7.1' | |
- wp_docker_tag: 5.4-php7.2-apache | |
xdebug_version: xdebug-2.7.2 | |
php_version: '7.2' | |
- 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.4-apache | |
xdebug_version: xdebug-3.0.4 | |
php_version: '7.4' | |
- wp_docker_tag: 5.9-php7.4-apache | |
xdebug_version: xdebug-3.0.4 | |
php_version: '7.4' | |
exclude: | |
- acf_version: 5.9.9 | |
wp_docker_tag: 5.9-php7.4-apache | |
- acf_version: 5.10.2 | |
wp_docker_tag: 5.9-php7.4-apache | |
fail-fast: false | |
env: | |
ACF_VERSION: ${{ matrix.acf_version }} | |
WP_DOCKER_TAG: ${{ matrix.wp_docker_tag }} | |
XDEBUG_VERSION: ${{ matrix.xdebug_version }} | |
PHP_VERSION: ${{ matrix.php_version }} | |
DOCKER_BUILDKIT: 1 | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
CACHE_IMAGE: joppuyo/acf-image-aspect-ratio-crop | |
PARCEL_WORKER_BACKEND: process | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Log in to docker hub | |
run: docker login -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_PASS }} | |
- name: Install PHP | |
uses: shivammathur/setup-php@verbose | |
with: | |
php-version: ${{ matrix.php_version }} | |
extensions: zip | |
- name: Set Node Version | |
uses: actions/setup-node@v2 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- run: docker-compose pull | |
- name: Docker build | |
run: docker-compose build --build-arg BUILDKIT_INLINE_CACHE=1 | |
- name: Docker up | |
run: docker-compose up -d | |
- name: Create config file | |
run: touch .env.testing | |
- name: Check running containers | |
run: docker ps -a | |
- name: Test | |
run: npx wait-on http://localhost/wp-login.php --verbose --timeout 60000 && docker exec -w /var/www/html acf-image-aspect-ratio-crop_wordpress.test_1 bash -c "php -i" | |
- name: Run test suite | |
run: | | |
npx wait-on http-get://localhost/wp-login.php --verbose --timeout 60000 && docker exec -w /var/www/html acf-image-aspect-ratio-crop_wordpress.test_1 bash -c "sudo chown -R www-data:www-data /var/www/html && sudo chmod -R 775 /var/www/html" && | |
docker exec -u www-data -w /var/www/html/wp-content/plugins/acf-image-aspect-ratio-crop -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 -e ACF_VERSION -e C3_URL -e WORDPRESS_DEBUG acf-image-aspect-ratio-crop_wordpress.test_1 bash -c 'export XDEBUG_MODE=coverage; ./vendor/bin/codecept run acceptance -vvv --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 | |
TEST_SITE_WP_DOMAIN: wordpress.test | |
TEST_SITE_ADMIN_EMAIL: [email protected] | |
TEST_SITE_ADMIN_USERNAME: admin | |
TEST_SITE_ADMIN_PASSWORD: admin | |
CHROMEDRIVER_HOST: chromedriver | |
CHROMEDRIVER_PORT: 9515 | |
C3_URL: http://wordpress.test/wp-content/plugins/acf-image-aspect-ratio-crop/acf-image-aspect-ratio-crop.php? | |
WORDPRESS_DEBUG: 1 | |
#- uses: codecov/codecov-action@v2 | |
# with: | |
# files: ./tests/_output/coverage.xml | |
# verbose: true | |
- name: Upload artifact | |
if: failure() | |
uses: actions/[email protected] | |
with: | |
name: Test output ${{ matrix.wp_docker_tag }} ${{ matrix.acf_version }} | |
path: tests/_output/ | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v1 | |
- name: Push to docker hub | |
run: docker push $CACHE_IMAGE:$WP_DOCKER_TAG |