Skip to content

Commit

Permalink
CI: switch to GitHub Actions - step 3: quick test stage
Browse files Browse the repository at this point in the history
This commit:
* Adds a GH Actions workflow for the CI checks which were previously run on Travis in the `quicktest` stage.
* Removes that part of the `.travis.yml` configuration.

Notes:
1. Previously, this "stage" would run on all `push` events, except when merging to `master` or `develop`.
    The current set-up still does so, with one exception: pushes to `develop` will now use this quicktest instead of the full test.
    `develop` is a protected branch anyhow, so all merges will already have had the full test run in the pull request.
    For merges to `master`, the full Test run will still be used as that will generally mean we're getting ready to tag a release and some extra safety checking before a release is not a bad thing.
2. This also updates the "high" PHP version for the "quicktest" against PHPCS `dev-master` from PHP 7.4 to PHP 8.0 by using `latest` which translates to "latest stable PHP release".
  • Loading branch information
jrfnl committed Dec 21, 2020
1 parent 137cb1e commit ff6212e
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 24 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Quicktest

on:
# Run on pushes, including merges, to all branches except `master`.
push:
branches-ignore:
- master
paths-ignore:
- '**.md'
- 'docs/**'

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.
# 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', 'latest']
phpcs_version: ['dev-master']

include:
- php: '7.3'
phpcs_version: '2.9.2'
- php: '5.4'
phpcs_version: '2.6.0'

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 version for tests'
run: composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

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

- name: Run the unit tests
run: vendor/bin/phpunit --no-coverage
24 changes: 0 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ env:
# Note: for pull requests, "develop" is the base branch name.
# See: https://docs.travis-ci.com/user/conditions-v1
stages:
- name: quicktest
if: type = push AND branch NOT IN (master, develop)
- name: test
if: branch IN (master, develop)
- name: coverage
Expand All @@ -41,28 +39,6 @@ stages:
jobs:
fast_finish: true
include:
#### 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.
# These are basically the same builds as in the Coverage stage, but then without doing
# the code-coverage.
- stage: quicktest
php: 7.4
env: PHPCS_VERSION="dev-master" LINT=1
- stage: quicktest
php: 7.3
# PHPCS is only compatible with PHP 7.3 as of version 3.3.1/2.9.2.
env: PHPCS_VERSION="2.9.2"

- stage: quicktest
php: 5.4
dist: trusty
env: PHPCS_VERSION="dev-master" LINT=1
- stage: quicktest
php: 5.4
dist: trusty
env: PHPCS_VERSION="2.6.0"

#### TEST STAGE ####
# Additional builds to prevent issues with PHPCS versions incompatible with certain PHP versions.
- stage: test
Expand Down

0 comments on commit ff6212e

Please sign in to comment.