Skip to content

Commit 4f20cc3

Browse files
committed
workflow update
1 parent b60b87b commit 4f20cc3

File tree

8 files changed

+79
-31
lines changed

8 files changed

+79
-31
lines changed

.github/workflows/deptrac.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ on:
1818
- 'depfile.yaml'
1919
- '.github/workflows/deptrac.yml'
2020

21+
permissions:
22+
contents: read
23+
2124
jobs:
2225
build:
2326
name: Dependency Tracing
@@ -32,7 +35,6 @@ jobs:
3235
uses: shivammathur/setup-php@v2
3336
with:
3437
php-version: '8.1'
35-
tools: phive
3638
extensions: intl, json, mbstring, xml
3739
coverage: none
3840
env:
@@ -42,7 +44,7 @@ jobs:
4244
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4345

4446
- name: Cache composer dependencies
45-
uses: actions/cache@v3
47+
uses: actions/cache@v4
4648
with:
4749
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4850
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
@@ -52,7 +54,7 @@ jobs:
5254
run: mkdir -p build/
5355

5456
- name: Cache Deptrac results
55-
uses: actions/cache@v3
57+
uses: actions/cache@v4
5658
with:
5759
path: build
5860
key: ${{ runner.os }}-deptrac-${{ github.sha }}
@@ -68,7 +70,5 @@ jobs:
6870
6971
- name: Trace dependencies
7072
run: |
71-
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
72-
deptrac analyze --cache-file=build/deptrac.cache
73-
env:
74-
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
composer require --dev qossmic/deptrac-shim
74+
vendor/bin/deptrac analyze --cache-file=build/deptrac.cache

.github/workflows/phpcsfixer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
3838

3939
- name: Cache composer dependencies
40-
uses: actions/cache@v3
40+
uses: actions/cache@v4
4141
with:
4242
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4343
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}

.github/workflows/phpstan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
php-versions: ['8.0', '8.1']
29+
php-versions: ['8.0', '8.1', '8.2', '8.3']
3030

3131
steps:
3232
- name: Checkout
@@ -46,7 +46,7 @@ jobs:
4646
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4747

4848
- name: Cache composer dependencies
49-
uses: actions/cache@v3
49+
uses: actions/cache@v4
5050
with:
5151
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
5252
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
@@ -56,7 +56,7 @@ jobs:
5656
run: mkdir -p build/phpstan
5757

5858
- name: Cache PHPStan results
59-
uses: actions/cache@v3
59+
uses: actions/cache@v4
6060
with:
6161
path: build/phpstan
6262
key: ${{ runner.os }}-phpstan-${{ github.sha }}

.github/workflows/phpunit.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,30 @@ on:
2020

2121
jobs:
2222
main:
23-
name: PHP ${{ matrix.php-versions }} Unit Tests
23+
name: PHP ${{ matrix.php-versions }}
2424
runs-on: ubuntu-latest
2525
if: "!contains(github.event.head_commit.message, '[ci skip]')"
2626
strategy:
2727
matrix:
28-
php-versions: ['8.0', '8.1']
28+
php-versions: ['8.0', '8.1', '8.2', '8.3']
2929

3030
steps:
31+
- name: Free Disk Space (Ubuntu)
32+
uses: jlumbroso/free-disk-space@main
33+
with:
34+
# this might remove tools that are actually needed,
35+
# if set to "true" but frees about 6 GB
36+
tool-cache: false
37+
38+
# all of these default to true, but feel free to set to
39+
# "false" if necessary for your workflow
40+
android: true
41+
dotnet: true
42+
haskell: true
43+
large-packages: false
44+
docker-images: true
45+
swap-storage: true
46+
3147
- name: Checkout
3248
uses: actions/checkout@v4
3349

@@ -45,7 +61,7 @@ jobs:
4561
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4662

4763
- name: Cache composer dependencies
48-
uses: actions/cache@v3
64+
uses: actions/cache@v4
4965
with:
5066
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
5167
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
@@ -60,7 +76,7 @@ jobs:
6076
fi
6177
6278
- name: Test with PHPUnit
63-
run: vendor/bin/phpunit --verbose --coverage-text
79+
run: vendor/bin/phpunit --coverage-text
6480
env:
6581
TERM: xterm-256color
6682
TACHYCARDIA_MONITOR_GA: enabled

.github/workflows/psalm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4343

4444
- name: Cache composer dependencies
45-
uses: actions/cache@v3
45+
uses: actions/cache@v4
4646
with:
4747
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4848
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
@@ -52,7 +52,7 @@ jobs:
5252
run: mkdir -p build/psalm
5353

5454
- name: Cache Psalm results
55-
uses: actions/cache@v3
55+
uses: actions/cache@v4
5656
with:
5757
path: build/psalm
5858
key: ${{ runner.os }}-psalm-${{ github.sha }}

.github/workflows/rector.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
php-versions: ['8.0', '8.1']
29+
php-versions: ['8.0', '8.1', '8.2', '8.3']
3030

3131
steps:
3232
- name: Checkout
@@ -46,7 +46,7 @@ jobs:
4646
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4747

4848
- name: Cache composer dependencies
49-
uses: actions/cache@v3
49+
uses: actions/cache@v4
5050
with:
5151
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
5252
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
@@ -60,7 +60,14 @@ jobs:
6060
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
6161
fi
6262
63+
- name: Rector Cache
64+
uses: actions/cache@v4
65+
with:
66+
path: /tmp/rector
67+
key: ${{ runner.os }}-rector-${{ github.run_id }}
68+
restore-keys: ${{ runner.os }}-rector-
69+
70+
- run: mkdir -p /tmp/rector
71+
6372
- name: Analyze for refactoring
64-
run: |
65-
composer global require --dev rector/rector:^0.15.1
66-
rector process --dry-run --no-progress-bar
73+
run: vendor/bin/rector process --dry-run --no-progress-bar

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
},
1818
"require-dev": {
1919
"codeigniter4/devkit": "^1.0",
20-
"codeigniter4/framework": "^4.4",
21-
"rector/rector": "0.18.5"
20+
"codeigniter4/framework": "^4.4"
2221
},
2322
"minimum-stability": "dev",
2423
"prefer-stable": true,

rector.php

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
11
<?php
22

3+
declare(strict_types=1);
4+
5+
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
36
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
47
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
8+
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
59
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
610
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
711
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
812
use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
913
use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector;
14+
use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector;
1015
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
1116
use Rector\CodeQuality\Rector\If_\CombineIfRector;
17+
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
1218
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
1319
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
1420
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
21+
use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
1522
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
1623
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
1724
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
1825
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
26+
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
1927
use Rector\Config\RectorConfig;
20-
use Rector\Core\ValueObject\PhpVersion;
2128
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
2229
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
2330
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
2431
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
2532
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
2633
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
27-
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
2834
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
35+
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
36+
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
2937
use Rector\PHPUnit\Set\PHPUnitSetList;
3038
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
3139
use Rector\Set\ValueObject\LevelSetList;
3240
use Rector\Set\ValueObject\SetList;
41+
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
42+
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
43+
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
3344
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
45+
use Rector\ValueObject\PhpVersion;
3446

3547
return static function (RectorConfig $rectorConfig): void {
3648
$rectorConfig->sets([
@@ -42,6 +54,12 @@
4254

4355
$rectorConfig->parallel();
4456

57+
// Github action cache
58+
$rectorConfig->cacheClass(FileCacheStorage::class);
59+
if (is_dir('/tmp')) {
60+
$rectorConfig->cacheDirectory('/tmp/rector');
61+
}
62+
4563
// The paths to refactor (can also be supplied with CLI arguments)
4664
$rectorConfig->paths([
4765
__DIR__ . '/src/',
@@ -70,14 +88,12 @@
7088

7189
// Are there files or rules you need to skip?
7290
$rectorConfig->skip([
73-
__DIR__ . '/app/Views',
74-
__DIR__ . '/src/Language/en',
75-
76-
JsonThrowOnErrorRector::class,
7791
StringifyStrNeedlesRector::class,
92+
YieldDataProviderRector::class,
7893

7994
// Note: requires php 8
8095
RemoveUnusedPromotedPropertyRector::class,
96+
AnnotationWithValueToAttributeRector::class,
8197

8298
// May load view files directly when detecting classes
8399
StringClassNameToClassConstantRector::class,
@@ -105,15 +121,25 @@
105121
$rectorConfig->rule(FuncGetArgsToVariadicParamRector::class);
106122
$rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
107123
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
124+
$rectorConfig->rule(SimplifyEmptyCheckOnEmptyArrayRector::class);
125+
$rectorConfig->rule(TernaryEmptyArrayArrayDimFetchToCoalesceRector::class);
126+
$rectorConfig->rule(EmptyOnNullableObjectToInstanceOfRector::class);
127+
$rectorConfig->rule(DisallowedEmptyRuleFixerRector::class);
108128
$rectorConfig
109129
->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [
110130
/**
111-
* The INLINE_PUBLIC value is default to false to avoid BC break, if you use for libraries and want to preserve BC break, you don't need to configure it, as it included in LevelSetList::UP_TO_PHP_74
131+
* The INLINE_PUBLIC value is default to false to avoid BC break,
132+
* if you use for libraries and want to preserve BC break, you don't
133+
* need to configure it, as it included in LevelSetList::UP_TO_PHP_74
112134
* Set to true for projects that allow BC break
113135
*/
114136
TypedPropertyFromAssignsRector::INLINE_PUBLIC => false,
115137
]);
116138
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
117139
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
118140
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
141+
$rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class);
142+
$rectorConfig->rule(SingleInArrayToCompareRector::class);
143+
$rectorConfig->rule(VersionCompareFuncCallToConstantRector::class);
144+
$rectorConfig->rule(ExplicitBoolCompareRector::class);
119145
};

0 commit comments

Comments
 (0)