Skip to content

Commit 7731d6b

Browse files
authored
Refactor workflows (#335)
1 parent 9d6bbe0 commit 7731d6b

File tree

6 files changed

+38
-133
lines changed

6 files changed

+38
-133
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,11 @@ jobs:
8282
- name: Update composer.
8383
run: composer self-update
8484

85-
- name: Set environment variables pull request linux.
86-
uses: yiisoft/actions/db/environment-linux@master
87-
8885
- name: Install db.
89-
uses: yiisoft/actions/db/subpackage-install@master
86+
uses: yiisoft/actions/install-packages@master
9087
with:
91-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
92-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
93-
CURRENT_PACKAGE: db
94-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
95-
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
88+
packages: >-
89+
['db']
9690
9791
- name: Run tests with phpunit with code coverage.
9892
run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always --display-warnings --display-deprecations

.github/workflows/composer-require-checker.yml

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ on:
44
- 'src/**'
55
- '.github/workflows/composer-require-checker.yml'
66
- 'composer.json'
7+
- 'composer-require-checker.json'
78

89
push:
910
branches: ['master']
1011
paths:
1112
- 'src/**'
1213
- '.github/workflows/composer-require-checker.yml'
1314
- 'composer.json'
15+
- 'composer-require-checker.json'
1416

1517
name: Composer require checker
1618

@@ -20,48 +22,9 @@ concurrency:
2022

2123
jobs:
2224
composer-require-checker:
23-
name: PHP ${{ matrix.php }}
24-
25-
env:
26-
COMPOSER_ROOT_VERSION: 1.0.0
27-
28-
runs-on: ${{ matrix.os }}
29-
30-
strategy:
31-
matrix:
32-
os:
33-
- ubuntu-latest
34-
35-
php:
36-
- 8.1
37-
- 8.2
38-
- 8.3
39-
- 8.4
40-
41-
steps:
42-
- name: Checkout.
43-
uses: actions/checkout@v4
44-
45-
- name: Install PHP with extensions.
46-
uses: shivammathur/setup-php@v2
47-
with:
48-
php-version: ${{ matrix.php }}
49-
coverage: none
50-
51-
- name: Update composer.
52-
run: composer self-update
53-
54-
- name: Set environment variables pull request linux.
55-
uses: yiisoft/actions/db/environment-linux@master
56-
57-
- name: Install db.
58-
uses: yiisoft/actions/db/subpackage-install@master
59-
with:
60-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
61-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
62-
CURRENT_PACKAGE: db
63-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
64-
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
65-
66-
- name: Check dependencies.
67-
run: vendor/bin/composer-require-checker
25+
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
26+
with:
27+
php: >-
28+
['8.1', '8.2', '8.3', '8.4']
29+
required-packages: >-
30+
['db']

.github/workflows/mutation.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,11 @@ jobs:
6666
ini-values: memory_limit=-1
6767
coverage: pcov
6868

69-
- name: Set environment variables pull request linux.
70-
uses: yiisoft/actions/db/environment-linux@master
71-
7269
- name: Install db.
73-
uses: yiisoft/actions/db/subpackage-install@master
70+
uses: yiisoft/actions/install-packages@master
7471
with:
75-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
76-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
77-
CURRENT_PACKAGE: db
78-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
79-
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
72+
packages: >-
73+
['db']
8074
8175
- name: Run infection.
8276
run: |

.github/workflows/rector.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
on:
2-
pull_request:
2+
pull_request_target:
33
paths:
44
- 'src/**'
5+
- 'tests/**'
56
- '.github/workflows/rector.yml'
67
- 'composer.json'
78
- 'rector.php'
89

9-
name: rector
10+
name: Rector
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.ref }}
@@ -15,8 +16,11 @@ concurrency:
1516
jobs:
1617
rector:
1718
uses: yiisoft/actions/.github/workflows/rector.yml@master
19+
secrets:
20+
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
1821
with:
19-
os: >-
20-
['ubuntu-latest']
22+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2123
php: >-
2224
['8.4']
25+
required-packages: >-
26+
['db']

.github/workflows/static.yml

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,57 +14,17 @@ on:
1414
- 'psalm*.xml'
1515
- 'composer.json'
1616

17-
name: static analysis
17+
name: Static analysis
1818

1919
concurrency:
2020
group: ${{ github.workflow }}-${{ github.ref }}
2121
cancel-in-progress: true
2222

2323
jobs:
2424
psalm:
25-
name: PHP ${{ matrix.php }}
26-
27-
env:
28-
COMPOSER_ROOT_VERSION: 1.0.0
29-
30-
runs-on: ${{ matrix.os }}
31-
32-
strategy:
33-
matrix:
34-
os:
35-
- ubuntu-latest
36-
37-
php:
38-
- 8.1
39-
- 8.2
40-
- 8.3
41-
- 8.4
42-
43-
steps:
44-
- name: Checkout.
45-
uses: actions/checkout@v4
46-
47-
- name: Install PHP with extensions.
48-
uses: shivammathur/setup-php@v2
49-
with:
50-
php-version: ${{ matrix.php }}
51-
coverage: none
52-
tools: cs2pr
53-
54-
- name: Update composer.
55-
run: composer self-update
56-
57-
- name: Set environment variables pull request linux.
58-
uses: yiisoft/actions/db/environment-linux@master
59-
60-
- name: Install db.
61-
uses: yiisoft/actions/db/subpackage-install@master
62-
with:
63-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
64-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
65-
CURRENT_PACKAGE: db
66-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
67-
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
68-
69-
- name: Static analysis.
70-
run: vendor/bin/psalm --config=${{ inputs.psalm-config }} --shepherd --stats --output-format=github --php-version=${{ matrix.php }}
25+
uses: yiisoft/actions/.github/workflows/psalm.yml@master
26+
with:
27+
php: >-
28+
['8.1', '8.2', '8.3', '8.4']
29+
required-packages: >-
30+
['db']

rector.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,19 @@
88
use Rector\Php73\Rector\String_\SensitiveHereNowDocRector;
99
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
1010
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
11-
use Rector\Set\ValueObject\LevelSetList;
1211

13-
return static function (RectorConfig $rectorConfig): void {
14-
$rectorConfig->paths([
12+
return RectorConfig::configure()
13+
->withPaths([
1514
__DIR__ . '/src',
16-
/**
17-
* Disabled ./tests directory due to different branches with main package when testing
18-
*/
19-
// __DIR__ . '/tests',
20-
]);
21-
22-
// register a single rule
23-
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
24-
25-
// define sets of rules
26-
$rectorConfig->sets([
27-
LevelSetList::UP_TO_PHP_81,
28-
]);
29-
30-
$rectorConfig->skip([
15+
__DIR__ . '/tests',
16+
])
17+
->withPhpSets(php81: true)
18+
->withRules([
19+
InlineConstructorDefaultToPropertyRector::class,
20+
])
21+
->withSkip([
3122
NullToStrictStringFuncCallArgRector::class,
3223
ReadOnlyPropertyRector::class,
3324
SensitiveHereNowDocRector::class,
3425
RemoveParentCallWithoutParentRector::class,
3526
]);
36-
};

0 commit comments

Comments
 (0)