Skip to content

Commit 2a660ee

Browse files
authored
Merge pull request #2 from faissaloux/workflows
workflows
2 parents 45fd517 + 1fc1622 commit 2a660ee

File tree

7 files changed

+291
-4
lines changed

7 files changed

+291
-4
lines changed

Diff for: .github/workflows/static.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Static Analysis
2+
3+
on: ['push', 'pull_request']
4+
5+
jobs:
6+
static:
7+
name: Static Tests
8+
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
dependency-version: [prefer-lowest, prefer-stable]
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.1
22+
tools: composer:v2
23+
coverage: none
24+
25+
- name: Install Dependencies
26+
run: composer update --prefer-stable --no-interaction --no-progress --ansi
27+
28+
- name: Refactor
29+
run: composer test:refactor
30+
31+
- name: Types
32+
run: composer test:types
33+
34+
- name: Style
35+
run: composer test:lint

Diff for: .github/workflows/tests.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Tests
2+
3+
on: ['push', 'pull_request']
4+
5+
jobs:
6+
ci:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-latest]
11+
php: ['8.1', '8.2', '8.3']
12+
dependency-version: [prefer-lowest, prefer-stable]
13+
14+
name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
tools: composer:v2
25+
coverage: none
26+
27+
- name: Install PHP dependencies
28+
run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress --ansi
29+
30+
- name: Unit Tests
31+
run: composer test:unit

Diff for: composer.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
"pestphp/pest-plugin": "^2.1.1"
3737
},
3838
"require-dev": {
39-
"pestphp/pest": "^2.33.0"
39+
"pestphp/pest": "^2.33.0",
40+
"phpstan/phpstan": "^1.11.0",
41+
"rector/rector": "^1.2.0",
42+
"laravel/pint": "^1.16.0"
4043
},
4144
"minimum-stability": "dev",
4245
"prefer-stable": true,
@@ -48,8 +51,16 @@
4851
}
4952
},
5053
"scripts": {
54+
"refactor": "rector",
55+
"lint": "pint",
56+
"test:refactor": "rector --dry-run",
57+
"test:lint": "pint --test",
58+
"test:types": "phpstan analyse --ansi",
5159
"test:unit": "pest --colors=always",
5260
"test": [
61+
"@test:refactor",
62+
"@test:lint",
63+
"@test:types",
5364
"@test:unit"
5465
]
5566
}

Diff for: composer.lock

+184-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: phpstan.neon

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
level: max
3+
paths:
4+
- src
5+
6+
ignoreErrors:
7+
- "#Undefined variable: \\$this#"
8+
- "#Anonymous function should return Pest\\\\Expectation but returns Pest\\\\Mixins\\\\Expectation#"

Diff for: rector.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Set\ValueObject\SetList;
7+
8+
return RectorConfig::configure()
9+
->withPaths([
10+
__DIR__.'/src',
11+
__DIR__.'/tests',
12+
])
13+
->withSets([
14+
SetList::CODE_QUALITY,
15+
SetList::DEAD_CODE,
16+
SetList::EARLY_RETURN,
17+
SetList::TYPE_DECLARATION,
18+
SetList::PRIVATIZATION,
19+
]);

Diff for: tests/toBeDivisibleBy.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
use PHPUnit\Framework\ExpectationFailedException;
44

5-
it('passes', function(int $dividend, int $divisor) {
5+
it('passes', function (int $dividend, int $divisor): void {
66
expect($dividend)->toBeDivisibleBy($divisor);
77
})->with([
88
'even' => [8, 4],
99
'odd' => [6, 3],
1010
]);
1111

12-
test('failures', function () {
12+
test('failures', function (): void {
1313
expect(8)->toBeDivisibleBy(3);
1414
})->throws(ExpectationFailedException::class);

0 commit comments

Comments
 (0)