From 51e5016d67c1aafee4710ab2379626ddbadf9790 Mon Sep 17 00:00:00 2001 From: Pieter Maene Date: Mon, 16 Oct 2023 07:26:09 +0200 Subject: [PATCH] Set up Actions cache for PHP_CodeSniffer and PHPStan --- .github/workflows/php.yml | 21 ++++++++++++++++++++- phpstan.neon | 3 ++- phpstan.neon.php | 5 +++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 phpstan.neon.php diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index cf05c4152a..71443b35a2 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -30,6 +30,18 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- + - name: Cache PHP_CodeSniffer intermediates + uses: actions/cache@v3 + with: + path: ${{ runner.temp }}/phpcs + key: ${{ runner.os }}-phpcs + + - name: Cache PHPStan intermediates + uses: actions/cache@v3 + with: + path: ${{ runner.temp }}/phpstan + key: ${{ runner.os }}-phpstan + - name: Install Composer dependencies run: > composer install \ @@ -39,10 +51,17 @@ 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/cache.json \ + --report=checkstyle \ + | cs2pr --graceful-warnings - name: Run PHPStan if: always() + env: + PHPSTAN_TMP_DIR: ${{ runner.temp }}/phpstan run: ./vendor/bin/phpstan analyse --error-format=github --no-progress test: diff --git a/phpstan.neon b/phpstan.neon index 915ee8811e..6c75c7d894 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ parameters: - tmpDir: phpstan/ + includes: + - phpstan.neon.php level: 1 paths: - bin/ diff --git a/phpstan.neon.php b/phpstan.neon.php new file mode 100644 index 0000000000..c46879f0aa --- /dev/null +++ b/phpstan.neon.php @@ -0,0 +1,5 @@ + getenv("PHPSTAN_TMP_DIR", true) ?: "", +];