|
| 1 | + |
| 2 | +name: "PHPStan Static Analysis 12.x " |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + pull_request_target: |
| 7 | + branches: |
| 8 | + - "12.*" |
| 9 | + paths-ignore: |
| 10 | + - 'doc/**' |
| 11 | + - 'bundles/**/public/**' |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - "12.*" |
| 15 | + paths-ignore: |
| 16 | + - 'doc/**' |
| 17 | + - 'bundles/**/public/**' |
| 18 | + |
| 19 | +env: |
| 20 | + PIMCORE_INSTANCE_IDENTIFIER: ${{ secrets.PIMCORE_CI_INSTANCE_IDENTIFIER }} |
| 21 | + PIMCORE_ENCRYPTION_SECRET: ${{ secrets.PIMCORE_CI_ENCRYPTION_SECRET }} |
| 22 | + PIMCORE_PRODUCT_KEY: ${{ secrets.PIMCORE_CI_PRODUCT_KEY }} |
| 23 | + PIMCORE_PROJECT_ROOT: ${{ github.workspace }} |
| 24 | + APP_ENV: test |
| 25 | + PIMCORE_TEST: 1 |
| 26 | + PIMCORE_STORAGE: 'local' |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: read |
| 30 | + |
| 31 | +jobs: |
| 32 | + static-analysis-phpstan: |
| 33 | + name: "Static Analysis with PHPStan" |
| 34 | + runs-on: "ubuntu-22.04" |
| 35 | + continue-on-error: ${{ matrix.experimental }} |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + include: |
| 39 | + - { php-version: "8.4", dependencies: "lowest", experimental: false, symfony: "", composer-options: "" } |
| 40 | + - { php-version: "8.4", dependencies: "highest", experimental: false, symfony: "", composer-options: "" } |
| 41 | + - { php-version: "8.3", dependencies: "lowest", experimental: false, symfony: "", composer-options: "" } |
| 42 | + - { php-version: "8.3", dependencies: "highest", experimental: false, symfony: "", composer-options: "" } |
| 43 | + steps: |
| 44 | + - name: Checkout PR head (only for pull_request_target) |
| 45 | + if: github.event_name == 'pull_request_target' |
| 46 | + uses: "actions/checkout@v5.0.1" |
| 47 | + with: |
| 48 | + ref: "refs/pull/${{ github.event.pull_request.number }}/merge" |
| 49 | + |
| 50 | + - name: Checkout 11.5 branch for scheduled runs |
| 51 | + if: github.event_name == 'schedule' |
| 52 | + uses: "actions/checkout@v5.0.1" |
| 53 | + with: |
| 54 | + ref: "12.3" |
| 55 | + |
| 56 | + - name: Checkout PR head (for push or workflow_dispatch) |
| 57 | + if: github.event_name != 'pull_request_target' && github.event_name != 'schedule' |
| 58 | + uses: "actions/checkout@v5.0.1" |
| 59 | + |
| 60 | + - name: "Install PHP" |
| 61 | + uses: "shivammathur/setup-php@v2" |
| 62 | + with: |
| 63 | + coverage: "none" |
| 64 | + php-version: "${{ matrix.php-version }}" |
| 65 | + |
| 66 | + - name: "Setup Pimcore environment" |
| 67 | + run: | |
| 68 | + .github/ci/scripts/setup-pimcore-environment.sh |
| 69 | +
|
| 70 | + - name: "Set Symfony version constraint in composer.json" |
| 71 | + env: |
| 72 | + SYMFONY_VERSION: "${{ matrix.symfony }}" |
| 73 | + run: | |
| 74 | + if [ ! -z "$SYMFONY_VERSION" ]; then |
| 75 | + .github/ci/scripts/symfony-require-dev.sh |
| 76 | + fi |
| 77 | +
|
| 78 | + - name: "Install dependencies with Composer" |
| 79 | + uses: "ramsey/composer-install@v2" |
| 80 | + with: |
| 81 | + dependency-versions: "${{ matrix.dependencies }}" |
| 82 | + composer-options: "${{ matrix.composer-options }}" |
| 83 | + |
| 84 | + - name: "Run a static analysis with phpstan/phpstan (highest)" |
| 85 | + if: ${{ matrix.dependencies == 'highest' }} |
| 86 | + run: "vendor/bin/phpstan analyse --memory-limit=-1" |
| 87 | + |
| 88 | + - name: "Run a static analysis with phpstan/phpstan (lowest)" |
| 89 | + if: ${{ matrix.dependencies == 'lowest' }} |
| 90 | + run: "vendor/bin/phpstan analyse --memory-limit=-1 -c phpstan-lowest.neon" |
| 91 | + |
| 92 | + - name: "Generate baseline file" |
| 93 | + if: ${{ failure() }} |
| 94 | + run: "vendor/bin/phpstan analyse --memory-limit=-1 --generate-baseline" |
| 95 | + |
| 96 | + - name: "Upload baseline file" |
| 97 | + if: ${{ failure() }} |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: phpstan-baseline.neon |
| 101 | + path: phpstan-baseline.neon |
0 commit comments