Skip to content

Expand job listing search #1196

Expand job listing search

Expand job listing search #1196

Workflow file for this run

name: PHP Linting and Tests
on:
pull_request:
branches:
- trunk
- 'feature/**'
- 'release/**'
jobs:
lint:
name: PHP Linting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get cached composer directories
uses: actions/cache@v3
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- uses: actions/cache@v3
with:
path: vendor/
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer
coverage: none
- name: Install PHP dependencies
run: composer self-update && composer install --no-ansi --no-interaction --prefer-dist --no-progress
- name: Run PHP Linter
run: npm run lint:php
test:
name: PHP Unit Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
wp: [ 'latest' ]
wpmu: [ 0 ]
php: [ '7.4', '8.0', '8.1' ]
include:
- php: '7.4'
wp: '6.2'
- php: '7.4'
wp: '6.3'
- php: '7.4'
wp: '6.4'
env:
WP_VERSION: ${{ matrix.wp }}
PHP_VERSION: ${{ matrix.php }}
services:
database:
image: mysql:5.6
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get cached composer directories
uses: actions/cache@v3
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- uses: actions/cache@v3
with:
path: vendor/
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysql
tools: composer
coverage: none
- name: Install PHP dependencies
run: composer self-update && composer install --no-ansi --no-interaction --prefer-dist --no-progress
- name: Setup test environment
run: bash ./tests/bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 $WP_VERSION
- name: Run tests
run: npm run test-php
psalm:
name: Psalm
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
php: [ '7.4', '8.2' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get cached composer directories
uses: actions/cache@v3
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- uses: actions/cache@v3
with:
path: vendor/
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
coverage: none
- name: Install
run: composer self-update && composer install --no-ansi --no-interaction --prefer-dist --no-progress
- name: Run Psalm
run: ./vendor/bin/psalm