Skip to content

Commit

Permalink
GH Actions: introduce a quicktest workflow
Browse files Browse the repository at this point in the history
... which runs only against low/medium/high PHP versions and does not run:
- the tests using custom PHP ini settings
- the tests related to sniffs using external JS/CSS tooling
- test CS check (integration test) using the PHAR

This quick test workflow will now run on pushes to all branches except `master`. For pushes to `master`, the full test build will still be run.

In the fast majority of cases, this quicktest will already surface any issues and it saves a lot of resources when the same builds don't run twice for every PR.
  • Loading branch information
jrfnl committed Dec 9, 2023
1 parent b8a08c9 commit fb7390e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Quicktest

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

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
#### QUICK TEST ####
# This is a much quicker test run which only runs the unit tests against the low/medium/high
# supported PHP versions and skips the PHAR test and the tests for external JS/CSS tooling.
# These are basically the same builds as in the Test->Coverage workflow, but then without doing
# the code-coverage.
quicktest:
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.4', '7.2', 'latest']

name: "QuickTest: PHP ${{ matrix.php }}"

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

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: 'error_reporting=-1, display_errors=On'
coverage: none

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

- name: 'PHPCS: set the path to PHP'
run: php bin/phpcs --config-set php_path php

- name: 'PHPUnit: run the tests'
run: vendor/bin/phpunit tests/AllTests.php

# Note: The code style check is run as an integration test.
- name: 'PHPCS: check code style without cache, no parallel'
run: php bin/phpcs --no-cache --parallel=1
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 build from running when there are only irrelevant changes.
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
Expand Down

0 comments on commit fb7390e

Please sign in to comment.