Merge pull request #4160 from Codeinwp/fix/submenu-observer #7008
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: PHP Tests | |
on: | |
push: | |
branches-ignore: | |
- 'master' | |
env: | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true | |
CYPRESS_INSTALL_BINARY: 0 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
phplint: | |
name: PHP Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.1' | |
extensions: simplexml | |
tools: composer:v2.1 | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Setup Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer | |
run: COMPOSER=composer-dev.json composer install --prefer-dist --no-progress --no-suggest | |
- name: Run PHPCS | |
run: composer run lint | |
phpunit: | |
name: PHPUnit | |
runs-on: ubuntu-latest | |
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: '7.1' | |
extensions: simplexml, mysql | |
tools: phpunit-polyfills | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- 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: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Setup Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer | |
run: COMPOSER=composer-dev.json composer install --prefer-dist --no-progress --no-suggest --no-dev | |
- name: Run phpunit | |
run: phpunit | |
themecheck: | |
name: Theme Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
- run: ./bin/envs/init.sh theme-check latest yes | |
phpstan: | |
name: PHPStan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
extensions: simplexml, mysql | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Setup Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer | |
run: COMPOSER=composer-dev.json composer install | |
- name: PHPStan Static Analysis | |
run: COMPOSER=composer-dev.json composer phpstan |