11name : Coding standard
22
33on :
4- push :
5- branches-ignore :
6- - ' dependabot/**'
7- pull_request : ~
8- release :
9- types : [created]
10- workflow_dispatch : ~
4+ pull_request : ~
5+ release :
6+ types : [created]
7+ workflow_dispatch : ~
118
129jobs :
13- tests :
14- runs-on : ubuntu-latest
10+ tests :
11+ runs-on : ubuntu-latest
1512
16- name : " Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
13+ name : " Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
1714
18- strategy :
19- fail-fast : false
20- matrix :
21- php : ["8.1", "8.2", "8.3"]
22- symfony : ["^5.4", "^6.4"]
23- sylius : ["^1.12", "^1.13"]
24- node : ["18.x", "20.x"]
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ php : ["8.1", "8.2", "8.3"]
19+ symfony : ["^5.4", "^6.4"]
20+ sylius : ["^1.12", "^1.13"]
21+ node : ["18.x", "20.x"]
2522
26- steps :
27- -
28- uses : actions/checkout@v2
29- -
30- name : Setup PHP
31- uses : shivammathur/setup-php@v2
32- with :
33- php-version : " ${{ matrix.php }}"
34- extensions : intl
35- tools : symfony
36- coverage : none
37- -
38- name : Get Composer cache directory
39- id : composer-cache
40- run : echo "::set-output name=dir::$(composer config cache-files-dir)"
23+ steps :
24+ - uses : actions/checkout@v3
4125
42- -
43- name : Cache Composer
44- uses : actions/cache@v2
45- with :
46- path : ${{ steps.composer-cache.outputs.dir }}
47- key : ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
48- restore-keys : |
49- ${{ runner.os }}-php-${{ matrix.php }}-composer-
50- -
51- name : Restrict Symfony version
52- if : matrix.symfony != ''
53- run : |
54- composer global config --no-plugins allow-plugins.symfony/flex true
55- composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
56- composer config extra.symfony.require "${{ matrix.symfony }}"
57- -
58- name : Restrict Sylius version
59- if : matrix.sylius != ''
60- run : composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
26+ - name : Setup PHP
27+ uses : shivammathur/setup-php@v2
28+ with :
29+ php-version : " ${{ matrix.php }}"
30+ extensions : intl
31+ tools : symfony
32+ coverage : none
33+ - name : Get Composer cache directory
34+ id : composer-cache
35+ run : echo echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
6136
62- -
63- name : Install PHP dependencies
64- run : composer install --no-interaction
37+ - name : Cache Composer
38+ uses : actions/cache@v4
39+ with :
40+ path : ${{ steps.composer-cache.outputs.dir }}
41+ key : ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
42+ restore-keys : |
43+ ${{ runner.os }}-php-${{ matrix.php }}-composer-
6544
66- -
67- name : Run PHPStan
68- run : vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
45+ - name : Restrict Symfony version
46+ if : matrix.symfony != ''
47+ run : |
48+ composer global config --no-plugins allow-plugins.symfony/flex true
49+ composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
50+ composer config extra.symfony.require "${{ matrix.symfony }}"
6951
70- -
71- name : Run ECS
72- run : vendor/bin/ecs check src/
52+ - name : Restrict Sylius version
53+ if : matrix.sylius != ''
54+ run : composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
7355
74- -
75- name : Failed build Slack notification
76- uses : rtCamp/action-slack-notify@v2
77- if : ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
78- env :
79- SLACK_CHANNEL : ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }}
80- SLACK_COLOR : ${{ job.status }}
81- SLACK_ICON : https://github.com/rtCamp.png?size=48
82- SLACK_MESSAGE : ' :x:'
83- SLACK_TITLE : Failed build on ${{ github.event.repository.name }} repository
84- SLACK_USERNAME : ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
85- SLACK_WEBHOOK : ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
56+ - name : Install PHP dependencies
57+ run : composer install --no-interaction
58+ env :
59+ SYMFONY_REQUIRE : ${{ matrix.symfony }}
60+
61+ - name : Run PHPStan src dir
62+ run : vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
63+
64+ - name : Run PHPStan spec dir
65+ run : vendor/bin/phpstan analyse -c phpstan.neon -l 6 spec/
66+
67+ - name : Run ECS
68+ run : vendor/bin/ecs
69+
70+ - name : Failed build Slack notification
71+ uses : rtCamp/action-slack-notify@v2
72+ if : ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
73+ env :
74+ SLACK_CHANNEL : ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }}
75+ SLACK_COLOR : ${{ job.status }}
76+ SLACK_ICON : https://github.com/rtCamp.png?size=48
77+ SLACK_MESSAGE : ' :x:'
78+ SLACK_TITLE : Failed build on ${{ github.event.repository.name }} repository
79+ SLACK_USERNAME : ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
80+ SLACK_WEBHOOK : ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
0 commit comments