Skip to content

Commit

Permalink
Update CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbestle committed Dec 17, 2021
1 parent 02e888a commit e438796
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
name: CI
on: [ push, pull_request ]
on: [push, pull_request]

jobs:
tests:
name: PHP ${{ matrix.php }} (${{ matrix.dependencies }} deps)

runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
php: [ "7.4", "8.0", "8.1" ]
dependencies: [ "lowest", "locked" ]
php: ["7.4", "8.0", "8.1"]
dependencies: ["lowest", "locked"]
env:
extensions: mbstring, pcov
ini: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""

steps:
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2

- name: Setup PHP cache environment
id: ext-cache
uses: shivammathur/cache-extensions@8828d749a642ae651470bd7713c2266c82cac102 # pin@v1
uses: shivammathur/cache-extensions@2e789925e438042ecda2b83f0fd00bbc016da76e # pin@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
key: php-v1

- name: Cache PHP extensions
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}

- name: Setup PHP environment
uses: shivammathur/setup-php@ed52ff9a52991475b075a4c2144f7276195e8620 # pin@v2
uses: shivammathur/setup-php@e2e76ea34f2059c0d66bf5c54ea75610185397f3 # pin@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
ini-values: ${{ env.ini }}
coverage: pcov
tools: phpunit:9.5.4, psalm:4.7.1
tools: phpunit:9.5.10, psalm:4.11.2

- name: Setup problem matchers
run: |
Expand All @@ -52,7 +53,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: ${{ steps.composerCache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
Expand All @@ -66,7 +67,7 @@ jobs:
- name: Cache analysis data
id: finishPrepare
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: ~/.cache/psalm
key: backend-analysis-${{ matrix.php }}-v1
Expand All @@ -80,7 +81,7 @@ jobs:
run: psalm --output-format=github --php-version=${{ matrix.php }}

- name: Upload coverage results to Codecov
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27 # pin@v1
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # pin@v1
with:
file: ${{ github.workspace }}/clover.xml
flags: backend
Expand All @@ -92,39 +93,40 @@ jobs:
name: Analysis

runs-on: ubuntu-latest
timeout-minutes: 5
env:
php: "8.0"
extensions: mbstring

steps:
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2

- name: Setup PHP cache environment
id: ext-cache
uses: shivammathur/cache-extensions@8828d749a642ae651470bd7713c2266c82cac102 # pin@v1
uses: shivammathur/cache-extensions@2e789925e438042ecda2b83f0fd00bbc016da76e # pin@v1
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
key: php-analysis-v1
key: php-v1

- name: Cache PHP extensions
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}

- name: Setup PHP environment
id: finishPrepare
uses: shivammathur/setup-php@ed52ff9a52991475b075a4c2144f7276195e8620 # pin@v2
uses: shivammathur/setup-php@e2e76ea34f2059c0d66bf5c54ea75610185397f3 # pin@v2
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
coverage: none
tools: |
composer:2.0.13, composer-normalize:2.13.3, composer-require-checker:3.2.0,
composer-unused:0.7.5, phpcpd:6.0.3, phpmd:2.10.0
composer:2.1.10, composer-normalize:2.15.0, composer-require-checker:3.3.0,
composer-unused:0.7.7, phpcpd:6.0.3, phpmd:2.10.2
- name: Validate composer.json/composer.lock
if: always() && steps.finishPrepare.outcome == 'success'
Expand All @@ -142,7 +144,7 @@ jobs:
- name: Cache dependencies
id: composerCache2
if: always() && steps.composerCache1.outcome == 'success'
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: ${{ steps.composerCache1.outputs.dir }}
key: ${{ runner.os }}-composer-locked-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -173,33 +175,29 @@ jobs:
name: Coding Style & Frontend Analysis

runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2

- name: Set up Node.js problem matchers
uses: actions/setup-node@0696555e99b7a8260864ca027af4b004eea59379 # pin@v2
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2

- name: Cache npm dependencies
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
- name: Set up Node.js problem matchers and cache npm dependencies
uses: actions/setup-node@04c56d2f954f1e4c69436aa54cfef261a018f458 # pin@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
cache: 'npm'

- name: Install npm dependencies
run: npm ci

- name: Setup PHP environment
uses: shivammathur/setup-php@ed52ff9a52991475b075a4c2144f7276195e8620 # pin@v2
uses: shivammathur/setup-php@e2e76ea34f2059c0d66bf5c54ea75610185397f3 # pin@v2
with:
coverage: none
tools: php-cs-fixer:3.0.0
tools: php-cs-fixer:3.2.1

- name: Cache analysis data
id: finishPrepare
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
with:
path: ~/.php-cs-fixer
key: coding-style
Expand All @@ -215,7 +213,7 @@ jobs:
if: >
always() && steps.finishPrepare.outcome == 'success' &&
github.event_name == 'pull_request'
uses: reviewdog/action-suggester@5d5b9f8c693e036796f828e47886bd10d368c273 # pin@v1
uses: reviewdog/action-suggester@1b18099af6c3c023256eb87a27aab5623e9b934d # pin@v1
with:
tool_name: ESLint
fail_on_error: 'true'
Expand All @@ -233,7 +231,7 @@ jobs:
if: >
always() && steps.finishPrepare.outcome == 'success' &&
github.event_name == 'pull_request'
uses: reviewdog/action-suggester@5d5b9f8c693e036796f828e47886bd10d368c273 # pin@v1
uses: reviewdog/action-suggester@1b18099af6c3c023256eb87a27aab5623e9b934d # pin@v1
with:
tool_name: PHP-CS-Fixer
fail_on_error: 'true'

0 comments on commit e438796

Please sign in to comment.