Skip to content

Merge pull request #195 from 10up/dependabot/npm_and_yarn/npm_and_yar… #1782

Merge pull request #195 from 10up/dependabot/npm_and_yarn/npm_and_yar…

Merge pull request #195 from 10up/dependabot/npm_and_yarn/npm_and_yar… #1782

Workflow file for this run

name: PHPUnit Tests
on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
permissions:
contents: read
jobs:
phpunit:
name: Test PHP ${{ matrix.php }} WP ${{ matrix.wp }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.4', '8.3', '8.2', '8.1', '8.0', '7.4' ]
wp: [ latest, trunk ]
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}
steps:
- name: Configure environment variables
run: |
echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV"
echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
##
# This allows Composer dependencies to be installed using a single step.
#
# Since the tests are currently run within the Docker containers where the PHP version varies,
# the same PHP version needs to be configured for the action runner machine so that the correct
# dependency versions are installed and cached.
##
- name: Set up PHP
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4
with:
php-version: '${{ matrix.php }}'
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: Install NPM dependencies
run: npm ci
- name: Start the Docker testing environment
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
with:
timeout_minutes: 10
max_attempts: 3
command: |
npm run env:start
- name: Log versions
run: |
npm run env -- run cli php -- -v
npm run env -- run cli wp core version
- name: Run PHPUnit tests
id: phpunit
run: |
npm run test:php