Skip to content

Acceptance Tests

Acceptance Tests #188

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: Acceptance Tests
on:
push:
branches:
- 'develop'
- 'trunk'
- 'master'
pull_request:
branches:
- '**'
# Once weekly on Wednesdays at 16:00 UTC.
schedule:
- cron: '0 16 * * 3'
workflow_dispatch:
jobs:
acceptance:
strategy:
matrix:
wp: ['6.3','5.6','nightly']
php: ['8.0','7.4']
include:
- wp: '6.3'
php: '8.1'
- wp: 'nightly'
php: '8.1'
- wp: '6.3'
php: '8.2'
- wp: 'nightly'
php: '8.2'
fail-fast: false
name: WP ${{ matrix.wp }} / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 10
env:
LOCAL_PHP: ${{ matrix.php }}
LOCAL_WP_DEBUG: 1
steps:
- name: Matrix values
run: echo "${{ toJSON(matrix) }}"
- name: Checkout repository
uses: actions/checkout@v3
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Composer cache
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: 8.0-composer-${{ hashFiles('composer.json') }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: composer:2.2
coverage: none
ini-file: development
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debugging
run: |
php --version
composer --version
docker --version
docker-compose --version
- name: Install dependencies
run: |
if [ "${{ matrix.wp }}" == "nightly" ]
then
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="dev-main"
else
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ matrix.wp }}.0"
fi
- name: Start Docker environment
run: composer test:start
- name: Log running Docker containers
run: docker ps -a
- name: Debug WordPress version
run: docker-compose run --rm wpcli wp core version
- name: Run the tests
run: composer test:acceptance
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: acceptance-wp-${{ matrix.wp }}-php-${{ matrix.php }}
path: tests/_output