Skip to content

Update our GitHub Action Workflows #3

Update our GitHub Action Workflows

Update our GitHub Action Workflows #3

Workflow file for this run

name: PHPUnit Tests
on:
push:
branches:
- develop
- trunk
paths:
- "**.php"
pull_request:
branches:
- develop
paths:
- "**.php"
jobs:
phpunit:
name: ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.0', '8.1' ]
os: [ ubuntu-latest ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
id: cache-composer
uses: actions/cache@v4
env:
cache-name: cache-composer
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
- uses: getong/mariadb-action@v1
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: phpunit-polyfills, composer:v2
- name: Install dependencies
run: composer update -W
- name: Setup WP Tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1
- name: PHPUnit
run: './vendor/bin/phpunit'