Skip to content

Commit

Permalink
Merge pull request #113 from Brain-WP/feature/ghactions-adjust-matrix
Browse files Browse the repository at this point in the history
GH Actions: mixed bag of improvements
  • Loading branch information
gmazzap authored Nov 11, 2021
2 parents 48ebfa1 + 843d7cd commit a31c845
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions .github/workflows/php-qa.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
name: PHP Quality Assurance
on: [push]
on:
push:
# 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:
qa:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: true
matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
dependency-versions: ['lowest', 'highest']

include:
- php-versions: '8.2'
dependency-versions: 'highest'

continue-on-error: ${{ matrix.php-versions == '8.2' }}

Expand All @@ -18,32 +33,45 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: error_reporting=-1, display_errors=On
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: ${{ ( matrix.php-versions == '7.4' && 'xdebug' ) || 'none' }}
tools: parallel-lint

- name: Check syntax error in sources
run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l
if: ${{ matrix.dependency-versions == 'highest' }}
run: parallel-lint ./src/ ./tests/

- name: Install dependencies - normal
if: ${{ matrix.php-versions != '8.2' }}
run: composer install -q -n -a --no-progress --prefer-dist
uses: "ramsey/composer-install@v1"
with:
dependency-versions: ${{ matrix.dependency-versions }}

- name: Install dependencies - ignore-platform-reqs
if: ${{ matrix.php-versions == '8.2' }}
run: composer install -q -n -a --no-progress --prefer-dist --ignore-platform-reqs
uses: "ramsey/composer-install@v1"
with:
dependency-versions: ${{ matrix.dependency-versions }}
composer-options: "--ignore-platform-reqs"

- name: Check cross-version PHP compatibility
if: ${{ matrix.php-versions == '7.4' }} # results is same across versions, do it once
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }} # results is same across versions, do it once
run: composer phpcompat

- name: Migrate test configuration (>= 7.3)
if: ${{ matrix.php-versions >= 7.3 }}
if: ${{ matrix.php-versions >= 7.3 && matrix.dependency-versions == 'highest' }}
run: ./vendor/bin/phpunit --migrate-configuration

- name: Run unit tests
- name: Run unit tests (without code coverage)
if: ${{ matrix.php-versions != '7.4' || matrix.dependency-versions != 'highest' }}
run: ./vendor/bin/phpunit

- name: Run unit tests with code coverage
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }}
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Update codecov.io
uses: codecov/codecov-action@v1
if: ${{ matrix.php-versions == '7.4' }} # upload coverage once is enough
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }} # upload coverage once is enough
with:
file: ./coverage.xml

0 comments on commit a31c845

Please sign in to comment.