Remove obsolete code #9863
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: PHP Linting and Tests | |
on: | |
pull_request: | |
workflow_call: | |
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@v4 | |
with: | |
path: ~/.cache/composer/ | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
- uses: actions/cache@v4 | |
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: Set up branches | |
run: git checkout -b trunk refs/remotes/origin/trunk && git checkout - | |
if: github.ref != 'refs/heads/trunk' | |
- name: Install PHP dependencies | |
run: composer self-update && composer install --no-ansi --no-interaction --prefer-dist --no-progress | |
- name: Check for new issues | |
run: ./scripts/linter-ci | |
- name: Check for escaping | |
run: ./vendor/bin/phpcs -s --sniffs=WordPress.WP.I18n,Generic.PHP.Syntax,WordPress.Security.EscapeOutput . | |
- name: Check for nonces | |
run: ./vendor/bin/phpcs -sn --sniffs=WordPress.Security.NonceVerification . | |
- name: Check WPCOM rules | |
run: ./vendor/bin/phpcs -sn --standard=./wpcom-phpcs.xml . | |
test: | |
name: PHP Unit Tests | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.wp == 'nightly' }} | |
strategy: | |
fail-fast: true | |
max-parallel: 10 | |
matrix: | |
wp: ['latest'] | |
wpmu: [0] | |
php: ['7.4', '8.2'] | |
include: | |
- php: 7.4 | |
wp: '6.1' | |
- php: 7.4 | |
wp: '6.2' | |
- php: 7.4 | |
wp: latest | |
wpmu: 1 | |
- php: 7.4 | |
wp: nightly | |
env: | |
WP_VERSION: ${{ matrix.wp }} | |
WP_MULTISITE: ${{ matrix.wpmu }} | |
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@v4 | |
with: | |
path: ~/.cache/composer/ | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
- uses: actions/cache@v4 | |
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: Tool versions | |
run: | | |
php --version | |
composer --version | |
- name: Install PHP dependencies | |
run: composer install --no-ansi --no-interaction --prefer-dist --no-progress --ignore-platform-reqs | |
- 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: ./vendor/bin/phpunit | |
- name: Slack Notification on Failure | |
uses: rtCamp/action-slack-notify@v2 | |
if: ${{ failure() && github.event_name == 'push' }} | |
env: | |
SLACK_CHANNEL: ${{ secrets.SLACK_JANITORIAL_CHANNEL }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_TITLE: 'PHP Testing' | |
SLACK_COLOR: 'error' | |
SLACK_FOOTER: '' |