qa: improve cache and performances of Github actions

This commit is contained in:
Romain Canon 2022-08-31 01:03:20 +02:00
parent 3c4d29901a
commit bf7af18d37
4 changed files with 18 additions and 8 deletions

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
php-version: '8.1' php-version: '8.1'
php-extensions: xdebug, yaml php-extensions: pcov, yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -29,6 +29,12 @@ jobs:
- name: Creating var directory - name: Creating var directory
run: mkdir -p var/cache run: mkdir -p var/cache
- name: Cache Mutation results
uses: actions/cache@v3.0.8
with:
path: var/cache
key: ${{ runner.os }}-qa-${{ hashFiles('composer.lock') }}-${{ hashFiles('.github/workflows/mutation.yml') }}
- name: Running mutation tests - name: Running mutation tests
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
run: php vendor/bin/infection --threads=$(nproc) run: php vendor/bin/infection --threads=$(nproc)

View File

@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
php-version: '8.1' php-version: '8.1'
php-extensions: xdebug, yaml php-extensions: yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -18,18 +18,18 @@ jobs:
extensions: ${{ env.php-extensions }} extensions: ${{ env.php-extensions }}
ini-values: zend.assertions=1 ini-values: zend.assertions=1
- name: Creating var directory
run: mkdir -p var/cache
- name: Cache QA results - name: Cache QA results
uses: actions/cache@v3.0.8 uses: actions/cache@v3.0.8
with: with:
path: var/cache path: var/cache
key: qa-${{ hashFiles('composer.lock') }} key: ${{ runner.os }}-qa-${{ hashFiles('composer.lock') }}-${{ hashFiles('.github/workflows/quality-assurance.yml') }}
- name: Checking Composer - name: Checking Composer
run: composer validate --strict run: composer validate --strict
- name: Creating var directory
run: mkdir -p var/cache
- uses: "ramsey/composer-install@v2" - uses: "ramsey/composer-install@v2"
- name: Running PHPStan - name: Running PHPStan

View File

@ -17,7 +17,7 @@ jobs:
- "8.1" - "8.1"
env: env:
php-extensions: xdebug, yaml php-extensions: yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@ -2,6 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig; use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option; use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector; use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
@ -14,7 +15,10 @@ return static function (RectorConfig $config): void {
__DIR__ . '/tests', __DIR__ . '/tests',
]); ]);
$config->parameters()->set(Option::CACHE_DIR, 'var/cache/rector'); $config->parameters()->set(Option::CACHE_DIR, './var/cache/rector');
// @see https://github.com/rectorphp/rector/issues/7341
$config->parameters()->set(Option::CACHE_CLASS, FileCacheStorage::class);
$config->sets([ $config->sets([
LevelSetList::UP_TO_PHP_74, LevelSetList::UP_TO_PHP_74,