Skip to content

Commit 52ffbb2

Browse files
committed
Chore: Enhancement
- Normalized composer.json file; - Added phpmd, phpcs and phpunit to dev dependencies in composer.json file; - Added ci.yaml and static.yaml GitHub actions; - Added composer.json conflict with micro/autowire<1.1 - Removed micro/autowire from required and added it to suggest section; Signed-off-by: Oleksii Bulba <oleksii_bulba@epam.com>
1 parent 887b4b9 commit 52ffbb2

File tree

4 files changed

+141
-10
lines changed

4 files changed

+141
-10
lines changed

.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.1', '8.2' ]
17+
dependency-versions: [ 'highest' ]
18+
include:
19+
# testing lowest PHP version with the lowest dependencies
20+
- php-version: '8.1'
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: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
on: [pull_request]
2+
name: Static analysis
3+
4+
jobs:
5+
composer-validate:
6+
name: Composer validate & normalize
7+
runs-on: ubuntu-22.04
8+
9+
steps:
10+
- name: Setup PHP
11+
uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: 8.2
14+
coverage: none
15+
tools: composer-normalize
16+
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Validate
21+
run: composer validate --strict
22+
23+
- name: Normalize
24+
run: composer-normalize --dry-run
25+
26+
phpcs:
27+
name: PHP_CodeSniffer
28+
runs-on: ubuntu-22.04
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v2
33+
34+
- name: Setup PHP
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: 8.2
38+
coverage: none
39+
tools: squizlabs/php_codesniffer:^3.7
40+
41+
- name: Download dependencies
42+
uses: ramsey/composer-install@v2
43+
44+
- name: PHP_CodeSniffer
45+
run: ./vendor/bin/phpcs --standard=phpcs.xml ./src/
46+
47+
phpmd:
48+
name: Mess Detector
49+
runs-on: ubuntu-22.04
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v2
53+
54+
- name: Setup PHP
55+
uses: shivammathur/setup-php@v2
56+
with:
57+
php-version: 8.2
58+
coverage: none
59+
tools: phpmd/phpmd:^2.13
60+
61+
- name: Download dependencies
62+
uses: ramsey/composer-install@v2
63+
64+
- name: Mess Detector
65+
run: ./vendor/bin/phpmd ./src/ github ./phpmd.xml

composer.json

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
11
{
22
"name": "micro/dependency-injection",
33
"description": "Dependency injection service container",
4-
"type": "library",
54
"license": "MIT",
6-
"version": "1.1",
7-
"autoload": {
8-
"psr-4": {
9-
"Micro\\Component\\DependencyInjection\\": "src/"
10-
}
11-
},
5+
"type": "library",
126
"authors": [
137
{
148
"name": "Stanislau.Komar",
159
"email": "stanislau_komar@epam.com"
1610
}
1711
],
1812
"require": {
19-
"php": ">=8.0",
20-
"psr/container": "^2.0",
21-
"micro/autowire": "^1"
13+
"php": "^8.1 || ^8.2",
14+
"psr/container": "^2.0"
15+
},
16+
"require-dev": {
17+
"ergebnis/composer-normalize": "^2.29",
18+
"phpmd/phpmd": "^2.13",
19+
"phpunit/phpunit": "^9.5",
20+
"squizlabs/php_codesniffer": "^3.7"
21+
},
22+
"conflict": {
23+
"micro/autowire": "<1.1"
24+
},
25+
"suggest": {
26+
"micro/autowire": "Autowire helper for dependency injection"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"Micro\\Component\\DependencyInjection\\": "src/"
31+
}
32+
},
33+
"config": {
34+
"allow-plugins": {
35+
"ergebnis/composer-normalize": true
36+
}
37+
},
38+
"extra": {
39+
"branch-alias": {
40+
"dev-master": "1.x-dev"
41+
}
2242
}
2343
}

0 commit comments

Comments
 (0)