Skip to content

Merge pull request #214 from szepeviktor/patch-2 #195

Merge pull request #214 from szepeviktor/patch-2

Merge pull request #214 from szepeviktor/patch-2 #195

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: Test
on:
push:
branches:
- 'develop'
- 'trunk'
pull_request:
branches:
- '**'
jobs:
build:
strategy:
matrix:
php: ['8.2','8.1','8.0','7.4']
wp: ['6.2','6.1','6.0','5.6']
exclude:
- php: '8.0'
wp: '5.6'
- php: '8.1'
wp: '5.6'
fail-fast: false
name: WP ${{ matrix.wp }} / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Composer cache
uses: actions/cache@v3
env:
cache-name: composer
with:
path: ~/.composer/cache
key: ${{ matrix.php }}-${{ env.cache-name }}-${{ hashFiles('composer.json') }}
- name: PHPCS and PHPStan cache
if: matrix.php == '7.4'
uses: actions/cache@v3
env:
cache-name: phpcs
with:
path: tests/cache
# This uses the hash of extended-cpts.php in its cache key because Actions doesn't support
# always pulling in a cache file and simultaneously always updating it, unlike Travis.
# This way we always pull in a cache file and refresh it with each new version of the plugin.
key: ${{ matrix.php }}-${{ env.cache-name }}-${{ hashFiles('extended-cpts.php') }}
- name: Install PHP
uses: shivammathur/setup-php@2.25.2
with:
php-version: ${{ matrix.php }}
extensions: mysqli, xmlwriter
coverage: none
- name: Install dependencies
run: |
mysql --version
sudo systemctl start mysql.service
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress-full="~${{ matrix.wp }}.0"
mysqladmin -uroot -proot create wordpress_test
- name: Run the integration tests
run: composer test:integration
- name: Run the code sniffers
if: matrix.php == '7.4'
run: |
composer test:cs
composer test:analyze