Release #5291
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: | |
types: [opened, synchronize, ready_for_review] | |
jobs: | |
phplint: | |
name: Phplint | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v1 | |
with: | |
php-version: "7.2" | |
extensions: simplexml | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install composer | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Run PHPCS | |
run: composer run lint | |
phpstan: | |
name: PHPStan | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
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@v4 | |
- name: Install composer | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: PHPStan Static Analysis | |
run: composer phpstan | |
unit: | |
name: UnitTests | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: "npm" | |
# run composer install | |
- name: Install composer | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Create License File | |
run: | | |
printf "{\"key\":\"${{ secrets.OTTER_PRO_LICENSE }}\"}" > license.json | |
# setup the node cache (node_modules) with github actions cache | |
- name: Cache Node - npm | |
uses: actions/cache@v1 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-cache- | |
- name: npm ci | |
run: | | |
npm ci | |
- name: npm run build | |
run: | | |
npm run build | |
- name: Setup WP Env | |
run: | | |
npm run test:unit:php:setup | |
- name: Run PHP Unit Tests | |
run: | | |
npm run test:unit:php:base |