From a5f95d87e5b7135d36e0c4d2b485d7f60f997e0a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 24 Mar 2024 17:13:10 +0700 Subject: [PATCH 1/4] chore: Add rector cache to workflows and template rector.php --- .github/workflows/rector.yml | 9 +++++++++ src/Template/rector.php | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index fdb7bdb..7af27d1 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -60,5 +60,14 @@ jobs: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader fi + - name: Rector Cache + uses: actions/cache@v4 + with: + path: /tmp/rector + key: ${{ runner.os }}-rector-${{ github.run_id }} + restore-keys: ${{ runner.os }}-rector- + + - run: mkdir -p /tmp/rector + - name: Analyze for refactoring run: vendor/bin/rector process --dry-run --no-progress-bar diff --git a/src/Template/rector.php b/src/Template/rector.php index 62e0146..ebd6ffa 100644 --- a/src/Template/rector.php +++ b/src/Template/rector.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Rector\Caching\ValueObject\Storage\FileCacheStorage; use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector; use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector; @@ -50,6 +51,12 @@ $rectorConfig->parallel(); + // Github action cache + $rectorConfig->cacheClass(FileCacheStorage::class); + if (is_dir('/tmp')) { + $rectorConfig->cacheDirectory('/tmp/rector'); + } + // The paths to refactor (can also be supplied with CLI arguments) $rectorConfig->paths([ __DIR__ . '/app/', From db8a7df439f8a89084baa78bc2ba6ea20ef71476 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 24 Mar 2024 17:13:42 +0700 Subject: [PATCH 2/4] chore: Add rector cache to workflows and template rector.php --- rector.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rector.php b/rector.php index 5c456ad..84cf87a 100644 --- a/rector.php +++ b/rector.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Rector\Caching\ValueObject\Storage\FileCacheStorage; use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector; use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector; @@ -50,6 +51,12 @@ $rectorConfig->parallel(); + // Github action cache + $rectorConfig->cacheClass(FileCacheStorage::class); + if (is_dir('/tmp')) { + $rectorConfig->cacheDirectory('/tmp/rector'); + } + // The paths to refactor (can also be supplied with CLI arguments) $rectorConfig->paths([ __DIR__ . '/src/', From 7f640048068ca4d0e296bbb107517085a0523c0c Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 24 Mar 2024 17:15:19 +0700 Subject: [PATCH 3/4] chore: Add rector cache to workflows and template rector.php --- src/Template/.github/workflows/rector.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Template/.github/workflows/rector.yml b/src/Template/.github/workflows/rector.yml index 60d159d..8040769 100644 --- a/src/Template/.github/workflows/rector.yml +++ b/src/Template/.github/workflows/rector.yml @@ -60,5 +60,14 @@ jobs: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader fi + - name: Rector Cache + uses: actions/cache@v4 + with: + path: /tmp/rector + key: ${{ runner.os }}-rector-${{ github.run_id }} + restore-keys: ${{ runner.os }}-rector- + + - run: mkdir -p /tmp/rector + - name: Analyze for refactoring run: vendor/bin/rector process --dry-run --no-progress-bar From 6d890ed349d01cb80208c4357878bd4175456849 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 24 Mar 2024 17:16:19 +0700 Subject: [PATCH 4/4] cs fix --- rector.php | 10 +++++----- src/Template/rector.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rector.php b/rector.php index 84cf87a..b4ec593 100644 --- a/rector.php +++ b/rector.php @@ -51,11 +51,11 @@ $rectorConfig->parallel(); - // Github action cache - $rectorConfig->cacheClass(FileCacheStorage::class); - if (is_dir('/tmp')) { - $rectorConfig->cacheDirectory('/tmp/rector'); - } + // Github action cache + $rectorConfig->cacheClass(FileCacheStorage::class); + if (is_dir('/tmp')) { + $rectorConfig->cacheDirectory('/tmp/rector'); + } // The paths to refactor (can also be supplied with CLI arguments) $rectorConfig->paths([ diff --git a/src/Template/rector.php b/src/Template/rector.php index ebd6ffa..d67af9d 100644 --- a/src/Template/rector.php +++ b/src/Template/rector.php @@ -51,7 +51,7 @@ $rectorConfig->parallel(); - // Github action cache + // Github action cache $rectorConfig->cacheClass(FileCacheStorage::class); if (is_dir('/tmp')) { $rectorConfig->cacheDirectory('/tmp/rector');