Revert "Add extra cache key to CI matrix configuration" #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow runs static analysis on the codebase using PHPStan, Psalm and ComposerRequireChecker. | |
| # PHPMD is not included in this workflow, as it is not supported by the PHP 8.4 yet. | |
| # Use this workflow temporarily until PHPMD supports PHP 8.4. | |
| name: Static Analysis | |
| on: | |
| push: | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| workflow_dispatch: | |
| workflow_call: | |
| inputs: | |
| php_version: | |
| required: true | |
| type: string | |
| has_crc_config: | |
| required: false | |
| default: false | |
| type: boolean | |
| description: True if the project has composer_require_checker.json | |
| jobs: | |
| static-analysis-phpstan: | |
| name: PHPStan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ inputs.php_version }} | |
| tools: cs2pr | |
| coverage: none | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| run: composer install --no-interaction --no-progress --prefer-dist | |
| - name: Run PHPStan | |
| run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr | |
| static-analysis-psalm: | |
| name: Psalm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ inputs.php_version }} | |
| tools: cs2pr | |
| coverage: none | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - name: Install dependencies | |
| run: composer install --no-interaction --no-progress --prefer-dist | |
| - name: Run Psalm | |
| run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr | |
| static-analysis-composer-require-checker: | |
| name: ComposerRequireChecker | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ inputs.php_version }} | |
| coverage: none | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - name: Install dependencies | |
| run: | | |
| composer install --no-interaction --no-progress --prefer-dist | |
| - name: Download ComposerRequireChecker PHAR | |
| run: | | |
| curl -L https://github.com/maglnet/ComposerRequireChecker/releases/latest/download/composer-require-checker.phar -o composer-require-checker.phar | |
| chmod +x composer-require-checker.phar | |
| - name: Run composer-require-checker without config | |
| if: ${{ !inputs.has_crc_config }} | |
| run: ./composer-require-checker.phar check ./composer.json | |
| - name: Run composer-require-checker with config | |
| if: ${{ inputs.has_crc_config }} | |
| run: ./composer-require-checker.phar check ./composer.json --config-file=./composer-require-checker.json |