1212 - ' **/*.markdown'
1313
1414jobs :
15- tests :
15+ kill_previous :
16+ name : 0️⃣ Kill previous runs
1617 runs-on : ubuntu-latest
18+ # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch.
1719 if : (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
20+ steps :
21+ - name : Cancel Previous Runs
22+ uses : styfle/cancel-workflow-action@0.11.0
23+ with :
24+ access_token : ${{ github.token }}
25+
26+ php_syntax_errors :
27+ name : 1️⃣ PHP - Syntax errors
28+ runs-on : ubuntu-latest
29+ needs :
30+ - kill_previous
31+ steps :
32+ - name : Set up PHP
33+ uses : shivammathur/setup-php@v2
34+ with :
35+ php-version : 8.0
36+
37+ - name : Checkout code
38+ uses : actions/checkout@v3
39+
40+ - name : Install dependencies
41+ uses : ramsey/composer-install@v2
42+
43+ - name : Check source code for syntax errors
44+ run : vendor/bin/parallel-lint --exclude .git --exclude vendor .
1845
46+ code_style_errors :
47+ name : 2️⃣ PHP - Code Style errors
48+ runs-on : ubuntu-latest
49+ needs :
50+ - php_syntax_errors
51+ steps :
52+ - name : Set up PHP
53+ uses : shivammathur/setup-php@v2
54+ with :
55+ php-version : latest
56+
57+ - name : Checkout code
58+ uses : actions/checkout@v3
59+
60+ - name : Install dependencies
61+ uses : ramsey/composer-install@v2
62+
63+ - name : Check source code for code style errors
64+ run : PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --verbose --diff --dry-run
65+
66+ phpstan :
67+ name : 2️⃣ PHP 8.1 - PHPStan
68+ runs-on : ubuntu-latest
69+ needs :
70+ - php_syntax_errors
71+ steps :
72+ - name : Checkout code
73+ uses : actions/checkout@v3
74+
75+ - name : Setup PHP
76+ uses : shivammathur/setup-php@v2
77+ with :
78+ php-version : 8.0
79+ coverage : none
80+ tools : phpstan
81+
82+ - name : Install Composer dependencies
83+ uses : ramsey/composer-install@v2
84+
85+ - name : Run PHPStan
86+ run : vendor/bin/phpstan analyze
87+
88+ tests :
89+ name : 2️⃣ PHP ${{ matrix.php-version }}
90+ needs :
91+ - php_syntax_errors
92+ runs-on : ubuntu-latest
1993 strategy :
2094 fail-fast : false
2195 matrix :
22- php-versions : ['8.0', '8.1', '8.2']
96+ php-version :
97+ - 8.0
98+ - 8.1
99+ - 8.2
23100
24- name : PHP ${{ matrix.php-versions }}
25-
26101 env :
27102 COMPOSER_NO_INTERACTION : 1
28103 extensions : curl, json, libxml, dom
@@ -32,56 +107,19 @@ jobs:
32107
33108 # Checks out a copy of your repository on the ubuntu machine
34109 - name : Checkout code
35- uses : actions/checkout@v2
110+ uses : actions/checkout@v3
36111
37- - name : Setup cache environment
38- id : extcache
39- uses : shivammathur/cache-extensions@v1
40- with :
41- php-version : ${{ matrix.php-versions }}
42- extensions : ${{ env.extensions }}
43- key : ${{ env.key }}
44-
45- - name : Cache PHP Extensions
46- uses : actions/cache@v2
47- with :
48- path : ${{ steps.extcache.outputs.dir }}
49- key : ${{ steps.extcache.outputs.key }}
50- restore-keys : ${{ steps.extcache.outputs.key }}
51-
52- - name : Cache Composer Dependencies
53- uses : actions/cache@v1
54- with :
55- path : ~/.composer/cache/files
56- key : dependencies-composer-${{ hashFiles('composer.json') }}
57112
58113 - name : Setup PHP Action
59114 uses : shivammathur/setup-php@v2
60115 with :
61- php-version : ${{ matrix.php-versions }}
116+ php-version : ${{ matrix.php-version }}
62117 extensions : ${{ env.extensions }}
63118 coverage : xdebug
64119 tools : pecl, composer
65120
66- - name : Get composer cache directory
67- id : composer-cache
68- run : echo "::set-output name=dir::$(composer config cache-files-dir)"
69-
70- - name : Cache dependencies
71- uses : actions/cache@v2
72- with :
73- path : ${{ steps.composer-cache.outputs.dir }}
74- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
75- restore-keys : ${{ runner.os }}-composer-
76-
77121 - name : Install Composer dependencies
78- run : composer install --no-interaction
122+ uses : ramsey/ composer-install@v2
79123
80- - name : Validate files
81- run : composer validate-files
82-
83- - name : Run PHPStan
84- run : composer phpstan
85-
86124 - name : Run tests
87125 run : composer run-tests
0 commit comments