diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index cf05c4152a..dddd589319 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -30,6 +30,20 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- + - name: Restore PHP_CodeSniffer cache + uses: actions/cache@v3 + with: + path: ${{ runner.temp }}/phpcs + key: ${{ runner.os }}-phpcs-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-phpcs- + + - name: Restore PHPStan cache + uses: actions/cache@v3 + with: + path: ${{ runner.temp }}/phpcs + key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-phpstan- + - name: Install Composer dependencies run: > composer install \ @@ -39,12 +53,33 @@ jobs: - name: Run PHP_CodeSniffer if: always() - run: ./vendor/bin/phpcs -q --report=checkstyle | cs2pr --graceful-warnings + run: > + ./vendor/bin/phpcs \ + -q \ + --cache=${{ runner.temp }}/phpcs \ + --report=checkstyle \ + | cs2pr --graceful-warnings + + - name: Save PHP_CodeSniffer cache + uses: actions/cache/save@v3 + if: always() + with: + path: ${{ runner.temp }}/phpcs + key: ${{ runner.os }}-phpcs-${{ hashFiles('**/composer.lock') }} - name: Run PHPStan if: always() + env: + PHPSTAN_TMP_DIR: ${{ runner.temp }}/phpstan run: ./vendor/bin/phpstan analyse --error-format=github --no-progress + - name: Save PHPStan cache + uses: actions/cache/save@v3 + if: always() + with: + path: ${{ runner.temp }}/phpstan + key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }} + test: name: Test runs-on: ubuntu-latest diff --git a/phpstan.neon b/phpstan.neon index 915ee8811e..3701b56348 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,7 @@ +includes: + - phpstan.neon.php + parameters: - tmpDir: phpstan/ level: 1 paths: - bin/ diff --git a/phpstan.neon.php b/phpstan.neon.php new file mode 100644 index 0000000000..729f121811 --- /dev/null +++ b/phpstan.neon.php @@ -0,0 +1,7 @@ + array( + 'tmpDir' => getenv("PHPSTAN_TMP_DIR", true) ?: "", + ), +);