GHA improvements #1268
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: Test PHP | |
on: [pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
phplint: | |
name: PHPCS on PHP 8.0 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.0' | |
extensions: simplexml | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Run PHPCS | |
run: composer phpcs | |
phpunit: | |
name: Run PHPUnit tests on ${{ matrix.php-versions }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: simplexml, mysql | |
tools: phpunit-polyfills | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install WordPress Test Suite | |
run: | | |
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:${{ job.services.mysql.ports['3306'] }} | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Run phpunit | |
run: vendor/bin/phpunit | |
phpstan: | |
name: PHPStan on PHP 8.0 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.0' | |
extensions: simplexml, mysql | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: PHPStan Static Analysis | |
run: composer phpstan |