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