Skip to content

Commit

Permalink
Merge pull request #657 from Automattic/feature/gh-actions-quick-test
Browse files Browse the repository at this point in the history
GH Actions: add "quicktest" stage for non-PR/merge builds
  • Loading branch information
rebeccahum authored Apr 15, 2021
2 parents 2885957 + 59f2b01 commit 6d0525e
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 1 deletion.
90 changes: 90 additions & 0 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Quicktest

on:
# Run on pushes, including merges, to all branches except `master`.
push:
branches-ignore:
- master
paths-ignore:
- '**.md'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
#### QUICK TEST STAGE ####
# This is a much quicker test which only runs the unit tests and linting against the low/high
# supported PHP/PHPCS combinations.
quicktest:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- php: '5.4'
phpcs_version: 'dev-master'
wpcs_version: '2.3.*'
- php: '5.4'
phpcs_version: '3.5.5'
wpcs_version: '2.3.*'

- php: 'latest'
phpcs_version: 'dev-master'
wpcs_version: '2.3.*'
- php: 'latest'
# PHPCS 3.5.7 is the lowest version of PHPCS which supports PHP 8.0.
phpcs_version: '3.5.7'
wpcs_version: '2.3.*'

name: "QTest${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"


steps:
- name: Checkout code
uses: actions/checkout@v2

# On stable PHPCS versions, allow for PHP deprecation notices.
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
- name: Setup ini config
id: set_ini
run: |
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
else
echo '::set-output name=PHP_INI::error_reporting=E_ALL'
fi
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
coverage: none

- name: 'Composer: set PHPCS and WPCS versions for tests'
run: |
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}"
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: ${{ startsWith( matrix.php, '8' ) == false && matrix.php != 'latest' }}
uses: "ramsey/composer-install@v1"

# PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform
# requirements to get PHPUnit 7.x to install on nightly.
- name: Install Composer dependencies - with ignore platform
if: ${{ startsWith( matrix.php, '8' ) || matrix.php == 'latest' }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs

- name: Lint against parse errors
if: matrix.phpcs_version == 'dev-master'
run: ./bin/php-lint

- name: Run the unit tests
run: ./bin/unit-tests

- name: Run the ruleset tests
run: ./bin/ruleset-tests
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Test

on:
# Run on all pushes and on all pull requests.
# Run on pushes to `master` and on all pull requests.
# Prevent the "push" build from running when there are only irrelevant changes.
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
Expand Down

0 comments on commit 6d0525e

Please sign in to comment.