Skip to content

Commit

Permalink
Split CI workflow into multiple jobs (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
MidnightDesign authored Oct 11, 2023
1 parent 9d9b19a commit 7531eaa
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 19 deletions.
203 changes: 185 additions & 18 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
name: Continuous Integration PHP
name: QA

on: [ pull_request ]

jobs:
qa:
check-dependencies:
name: Composer Require Checker - ${{ matrix.php }} ${{ matrix.dependencies }}

strategy:
fail-fast: false
matrix:
php:
- "8.2"
dependencies:
- ""
- "--prefer-lowest"

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -24,39 +28,182 @@ jobs:
extensions: ctype
coverage: pcov

- name: Prepare environment
run: echo "COMPOSER_CACHE=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Composer Cache
uses: actions/cache@v3
with:
path: |
${{ env.COMPOSER_CACHE }}
vendor
key: ${{ runner.os }}-composer

- name: Install dependencies
run: |
composer update --no-progress --no-interaction > /dev/null
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}

- name: Check Dependencies
run: composer check-deps

code-style:
name: PHP CS Fixer - ${{ matrix.php }} ${{ matrix.dependencies }}

strategy:
fail-fast: false
matrix:
php:
- "8.2"
dependencies:
- ""
- "--prefer-lowest"

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ctype

- name: Install dependencies
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}

- name: Check Code Style
run: composer cs-check

phpstan:
name: PHPStan - ${{ matrix.php }} ${{ matrix.dependencies }}

strategy:
fail-fast: false
matrix:
php:
- "8.2"
dependencies:
- ""
- "--prefer-lowest"

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ctype

- name: Install dependencies
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}

- name: PHPStan
run: composer phpstan -- --no-progress

psalm:
name: Psalm - ${{ matrix.php }} ${{ matrix.dependencies }}

strategy:
fail-fast: false
matrix:
php:
- "8.2"
dependencies:
- ""
- "--prefer-lowest"

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ctype

- name: Install dependencies
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}

- name: Psalm
run: composer psalm

phpunit:
name: PHPUnit - ${{ matrix.php }} ${{ matrix.dependencies }}

strategy:
fail-fast: false
matrix:
php:
- "8.2"
dependencies:
- ""
- "--prefer-lowest"

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ctype
coverage: pcov

- name: Install dependencies
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}

- name: PHPUnit
run: |
vendor/bin/phpunit \
--coverage-xml=build/coverage/coverage-xml \
--log-junit=build/coverage/junit.xml \
--coverage-clover=coverage.xml
--coverage-clover=build/coverage/clover.xml
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.php }}
path: build/coverage/

infection:
name: Infection - ${{ matrix.php }} ${{ matrix.dependencies }}

needs: phpunit

strategy:
fail-fast: false
matrix:
php:
- "8.2"
dependencies:
- ""
- "--prefer-lowest"

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ctype
coverage: pcov

- name: Install dependencies
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}

- name: Download coverage
uses: actions/download-artifact@v3
with:
name: coverage-${{ matrix.php }}
path: build/coverage/

- name: Infection coverage of changed lines
if: "!contains(github.event.pull_request.labels.*.name, 'skip-infection')"
Expand All @@ -79,5 +226,25 @@ jobs:
name: infection-log-${{ matrix.php }}.txt
path: infection-log.txt

bc-breaks:
name: Backward Compatibility

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: ctype

- name: Install dependencies
run: composer update --no-progress --no-interaction

- name: "Check for BC breaks"
run: vendor/bin/roave-backward-compatibility-check
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"infection/infection": "^0.27.0",
"maglnet/composer-require-checker": "^4.6",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^1.10.34",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "^10.2",
Expand Down

0 comments on commit 7531eaa

Please sign in to comment.