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