version 1.6.1 #64
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: PHPUnit | |
on: | |
pull_request: | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
continue-on-error: ${{ matrix.can_fail }} | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.2, 7.4] | |
wp_version: ["latest"] | |
can_fail: [false] | |
multisite: [0,1] | |
name: WordPress ${{ matrix.wp_version }} @ PHP ${{ matrix.php }} (WP_MULTISITE=${{ matrix.multisite }}) | |
env: | |
CACHEDIR: /tmp/test-cache | |
WP_CORE_DIR: /tmp/wordpress/ | |
WP_TESTS_DIR: /tmp/wordpress-tests-lib | |
WP_VERSION: ${{ matrix.wp_version }} | |
WP_MULTISITE: ${{ matrix.multisite }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Set up Composer caching | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-composer-dependencies | |
with: | |
path: | | |
${{ steps.composer-cache.outputs.dir }} | |
/tmp/test-cache | |
/tmp/wordpress | |
key: ${{ runner.os }}-composer-${{ matrix.php }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd | |
tools: composer:v2 | |
coverage: none | |
- name: Install Composer dependencies | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer install | |
new_command_on_retry: composer install --ignore-platform-reqs | |
- name: Install WordPress and copy project | |
shell: bash | |
run: | | |
bash <(curl -s "https://raw.githubusercontent.com/wp-cli/sample-plugin/master/bin/install-wp-tests.sh") wordpress_test root '' 127.0.0.1 latest | |
rm -rf "${WP_CORE_DIR}wp-content/plugins" | |
mkdir -p "${WP_CORE_DIR}wp-content/plugins/wordpress-fieldmanager" | |
rsync -a --exclude=.git . "${WP_CORE_DIR}wp-content/plugins/wordpress-fieldmanager" | |
- name: Run tests | |
shell: bash | |
run: | | |
cd ${WP_CORE_DIR}wp-content/plugins/wordpress-fieldmanager | |
composer run phpunit |