Wordpress/.github/workflows/php-compatibility.yml
Jonathan Desrosiers e5b9d995a8 Build/Test Tools: Introduce GitHub Action workflows.
This change introduces 6 different workflows accounting for all of the testing and analysis currently performed in Travis CI & Appveyor:

- Checking PHP & JS coding standards are followed
- Running the end-to-end test suite.
- Running QUnit tests on JavaScript files.
- Scanning for PHP compatibility issues with supported version.
- Running the PHPUnit test suite.
- Verifying NPM related tasks do not cause errors on Windows.

Additionally, a seventh workflow is included that will leave a "welcome" comment when a contributor opens their first pull request to the `wordpress-develop` mirror.

These workflows are currently in an experimental phase. For that reason, Travis CI and Appveyor will continue to run until all of the bugs can be worked out.

Props ayeshrajans, helen, ocean90, desrosj.
See #50401.

git-svn-id: https://develop.svn.wordpress.org/trunk@49162 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 19:40:33 +00:00

68 lines
1.9 KiB
YAML

name: PHP Compatibility
on:
push:
branches:
- master
# The PHP compatibility testing was introduced in WordPress 5.5.
- '5.[5-9]'
- '[6-9].*'
pull_request:
jobs:
# Runs PHP compatibility testing.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Configures caching for Composer.
# - Sets up PHP.
# - Logs debug information about the runner container.
# - Installs Composer dependencies (from cache if possible).
# - Logs PHP_CodeSniffer debug information.
# - Runs the PHP compatibility tests.
# - todo: Configure Slack notifications for failing scans.
php-comatibility:
name: Check PHP compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Set up Composer caching
uses: actions/cache@v2
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Log debug information
run: |
php --version
composer --version
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
echo "vendor/bin" >> $GITHUB_PATH
- name: Run PHP compatibility tests
run: vendor/bin/phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr