Skip to content

Commit ec9a084

Browse files
committed
Chore: CI
- Added GitHub workflows for CI and static analysis; - Added Psalm as dev requirement; - Added composer-normalize as dev requirement;
1 parent a8e69c6 commit ec9a084

File tree

6 files changed

+167
-11
lines changed

6 files changed

+167
-11
lines changed

.gitattributes

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/tests export-ignore
1+
/.github export-ignore
2+
/tests export-ignore
23
/phpunit.xml.dist export-ignore
3-
/.gitattributes export-ignore
4-
/.gitignore export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
56

67
*.php diff=php

.github/workflows/.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[{*.yaml,*.yml}]
2+
indent_size = 2

.github/workflows/ci.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Plugin CI
2+
on:
3+
push:
4+
branches: [ 'master' ]
5+
pull_request:
6+
7+
jobs:
8+
tests:
9+
name: "Tests ${{ matrix.php-version }} deps ${{ matrix.dependency-versions }}"
10+
runs-on: ubuntu-22.04
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
# normal, highest, non-dev installs
16+
php-version: [ '8.0', '8.1', '8.2' ]
17+
dependency-versions: [ 'highest' ]
18+
include:
19+
# testing lowest PHP version with the lowest dependencies
20+
- php-version: '8.0'
21+
dependency-versions: 'lowest'
22+
23+
# testing dev versions with the highest PHP
24+
- php-version: '8.2'
25+
dependency-versions: 'highest'
26+
27+
steps:
28+
- name: "Checkout code"
29+
uses: "actions/checkout@v2"
30+
31+
- name: "Install PHP"
32+
uses: "shivammathur/setup-php@v2"
33+
with:
34+
coverage: "none"
35+
php-version: "${{ matrix.php-version }}"
36+
37+
- name: "Composer install"
38+
uses: "ramsey/composer-install@v2"
39+
with:
40+
dependency-versions: "${{ matrix.dependency-versions }}"
41+
composer-options: "--prefer-dist --no-progress"
42+
43+
- name: Run tests
44+
run: ./vendor/bin/phpunit

.github/workflows/static.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
on: [pull_request]
2+
name: Static analysis
3+
4+
jobs:
5+
phpstan:
6+
name: PHPStan
7+
runs-on: ubuntu-22.04
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: 8.1
17+
coverage: none
18+
tools: cs2pr
19+
20+
- name: Download dependencies
21+
uses: ramsey/composer-install@v2
22+
23+
- name: Install PHPStan
24+
uses: ramsey/composer-install@v2
25+
26+
- name: PHPStan
27+
run: ./vendor/bin/phpstan analyze --no-progress --error-format=checkstyle | cs2pr
28+
29+
php-cs-fixer:
30+
name: PHP-CS-Fixer
31+
runs-on: ubuntu-22.04
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v2
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: 8.0
41+
coverage: none
42+
tools: cs2pr
43+
44+
- name: Install php-cs-fixer
45+
uses: ramsey/composer-install@v1
46+
47+
- name: PHP-CS-Fixer
48+
run: ./vendor/bin/php-cs-fixer fix --verbose --dry-run --format=checkstyle --using-cache=no | cs2pr
49+
50+
psalm:
51+
name: Psalm
52+
runs-on: ubuntu-22.04
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v2
56+
57+
- name: Setup PHP
58+
uses: shivammathur/setup-php@v2
59+
with:
60+
php-version: 8.1
61+
coverage: none
62+
tools: vimeo/psalm:4.11.2
63+
64+
- name: Download dependencies
65+
uses: ramsey/composer-install@v2
66+
67+
- name: Install psalm
68+
uses: ramsey/composer-install@v2
69+
70+
- name: Psalm
71+
run: ./vendor/bin/psalm --no-progress
72+
73+
composer-normalize:
74+
name: Composer Normalize
75+
runs-on: ubuntu-22.04
76+
77+
steps:
78+
- name: Setup PHP
79+
uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: 8.1
82+
coverage: none
83+
tools: composer-normalize
84+
85+
- name: Checkout code
86+
uses: actions/checkout@v2
87+
88+
- name: Normalize
89+
run: composer-normalize --dry-run

composer.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
{
22
"name": "boo/webpack-encore-plugin",
33
"description": "This is a Micro plugin for webpack-encore support",
4+
"license": "MIT",
45
"type": "micro-plugin",
56
"version": "0.1",
6-
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Oleksii Bulba",
10+
"email": "[email protected]"
11+
}
12+
],
713
"require": {
814
"micro/plugin-twig": "^0"
915
},
1016
"require-dev": {
17+
"ergebnis/composer-normalize": "^2.29",
1118
"friendsofphp/php-cs-fixer": "^3.13",
12-
"phpunit/phpunit": "^9.5"
19+
"phpunit/phpunit": "^9.5",
20+
"vimeo/psalm": "^5.2"
1321
},
1422
"autoload": {
1523
"psr-4": {
@@ -21,13 +29,10 @@
2129
"Boo\\WebpackEncorePlugin\\Tests\\Unit\\": "tests/unit"
2230
}
2331
},
24-
"authors": [
25-
{
26-
"name": "Oleksii Bulba",
27-
"email": "[email protected]"
28-
}
29-
],
3032
"config": {
33+
"allow-plugins": {
34+
"ergebnis/composer-normalize": true
35+
},
3136
"sort-packages": true
3237
},
3338
"extra": {

psalm.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="2"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
>
9+
<projectFiles>
10+
<directory name="src" />
11+
<ignoreFiles>
12+
<directory name="vendor" />
13+
</ignoreFiles>
14+
</projectFiles>
15+
</psalm>

0 commit comments

Comments
 (0)