Skip to content

Commit 525868b

Browse files
authored
Refactor workflows (#367)
1 parent d5eae39 commit 525868b

File tree

6 files changed

+40
-141
lines changed

6 files changed

+40
-141
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,11 @@ jobs:
5959
- name: Update composer.
6060
run: composer self-update
6161

62-
- name: Set environment variables pull request linux.
63-
if: matrix.os == 'ubuntu-latest'
64-
uses: yiisoft/actions/db/environment-linux@master
65-
66-
- name: Set environment variables pull request windows.
67-
if: matrix.os == 'windows-latest'
68-
uses: yiisoft/actions/db/environment-windows@master
69-
7062
- name: Install db.
71-
uses: yiisoft/actions/db/subpackage-install@master
63+
uses: yiisoft/actions/install-packages@master
7264
with:
73-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
74-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
75-
CURRENT_PACKAGE: db
76-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
77-
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
65+
packages: >-
66+
['db']
7867
7968
- name: Run tests with phpunit with code coverage.
8069
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
@@ -51,17 +51,11 @@ jobs:
5151
- name: Update composer.
5252
run: composer self-update
5353

54-
- name: Set environment variables pull request linux.
55-
uses: yiisoft/actions/db/environment-linux@master
56-
5754
- name: Install db.
58-
uses: yiisoft/actions/db/subpackage-install@master
55+
uses: yiisoft/actions/install-packages@master
5956
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 }}
57+
packages: >-
58+
['db']
6559
6660
- name: Run infection.
6761
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: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,18 @@
66
use Rector\Config\RectorConfig;
77
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
88
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
9-
use Rector\Set\ValueObject\LevelSetList;
109

11-
return static function (RectorConfig $rectorConfig): void {
12-
$rectorConfig->disableParallel();
13-
14-
$rectorConfig->paths([
10+
return RectorConfig::configure()
11+
->withPaths([
1512
__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([
13+
__DIR__ . '/tests',
14+
])
15+
->withPhpSets(php81: true)
16+
->withRules([
17+
InlineConstructorDefaultToPropertyRector::class,
18+
])
19+
->withSkip([
3120
NullToStrictStringFuncCallArgRector::class,
3221
ReadOnlyPropertyRector::class,
33-
]);
34-
};
22+
])
23+
->withoutParallel();

0 commit comments

Comments
 (0)