Skip to content

Commit 55e25be

Browse files
committed
Feature: Symfony Runtime, Psr17Kernel, Router for Assets
1 parent 2433d94 commit 55e25be

33 files changed

+991
-0
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "composer"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/integration.yaml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: Integration
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- 'docs/**'
12+
- 'examples/**'
13+
- 'README.md'
14+
15+
jobs:
16+
static-analysis:
17+
name: Static Code Analysis
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Install PHP with extensions
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php }}
27+
tools: 'composer:v2, flex'
28+
29+
- name: Install Package Deps
30+
uses: ramsey/composer-install@v2
31+
with:
32+
dependency-versions: stable
33+
composer-options: --prefer-dist
34+
35+
- name: Install Psalm
36+
uses: ramsey/composer-install@v2
37+
with:
38+
composer-options: --prefer-dist
39+
working-directory: tools/psalm
40+
41+
- name: Run static code analysis
42+
env:
43+
MARKDOWN_LINK_BRANCH: ${{ github.head_ref || github.ref_name }}
44+
run: |
45+
tools/psalm/vendor/bin/psalm
46+
47+
- name: Publish report in PR
48+
uses: mshick/add-pr-comment@v2
49+
with:
50+
message-path: ./psalm-report.md
51+
message-id: psalm
52+
53+
54+
codestyle:
55+
name: Code Style
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v2
60+
61+
- name: Install PHP with extensions
62+
uses: shivammathur/setup-php@v2
63+
with:
64+
coverage: xdebug
65+
php-version: ${{ matrix.php }}
66+
tools: 'composer:v2, flex'
67+
68+
- name: Install Package Deps
69+
uses: ramsey/composer-install@v2
70+
with:
71+
dependency-versions: stable
72+
composer-options: --prefer-dist
73+
74+
- name: Install PHP-CS-Fixer
75+
uses: ramsey/composer-install@v2
76+
with:
77+
dependency-versions: stable
78+
composer-options: --prefer-dist
79+
working-directory: tools/php-cs-fixer
80+
81+
- name: PHP-CS-Fixer
82+
run: PHP_CS_FIXER_IGNORE_ENV=1 tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=dots --ansi --verbose
83+
84+
tests:
85+
name: Test ${{ matrix.php }}, symfony=${{ matrix.symfony }}, deps=${{ matrix.deps }}
86+
runs-on: ubuntu-latest
87+
needs: [ codestyle, static-analysis ]
88+
env:
89+
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=0'
90+
strategy:
91+
matrix:
92+
include:
93+
- php: 8.1
94+
deps: lowest
95+
symfony: ^6.4
96+
97+
- php: 8.2
98+
deps: stable
99+
symfony: ^7.1
100+
101+
- php: 8.3
102+
deps: latest
103+
symfony: ^7.2
104+
105+
- php: 8.4
106+
deps: latest
107+
symfony: ^7.2
108+
109+
steps:
110+
- name: Checkout code
111+
uses: actions/checkout@v4
112+
113+
- name: Install PHP with extensions
114+
uses: shivammathur/setup-php@v2
115+
with:
116+
php-version: ${{ matrix.php }}
117+
tools: 'composer:v2, flex'
118+
119+
- name: Configure Symfony version
120+
run: echo SYMFONY_REQUIRE="${{ matrix.symfony }}" >> $GITHUB_ENV
121+
122+
- name: Set up problem matchers for PHP
123+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
124+
125+
- name: Set up problem matchers for phpunit
126+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
127+
128+
- name: Install Package Deps
129+
uses: ramsey/composer-install@v2
130+
with:
131+
dependency-versions: ${{ matrix.deps }}
132+
composer-options: --prefer-dist
133+
134+
- name: Install PHPUnit
135+
uses: ramsey/composer-install@v2
136+
with:
137+
dependency-versions: ${{ matrix.deps }}
138+
composer-options: --prefer-dist
139+
working-directory: tools/phpunit
140+
141+
- name: Run tests
142+
run: tools/phpunit/vendor/bin/phpunit --colors=always --testdox
143+
144+
coverage:
145+
name: Coverage Report
146+
runs-on: ubuntu-latest
147+
needs: [ codestyle, static-analysis, tests ]
148+
steps:
149+
- name: Checkout code
150+
uses: actions/checkout@v2
151+
152+
- name: Install PHP with extensions
153+
uses: shivammathur/setup-php@v2
154+
with:
155+
coverage: xdebug
156+
php-version: ${{ matrix.php }}
157+
tools: 'composer:v2, flex'
158+
159+
- name: Install Package Deps
160+
uses: ramsey/composer-install@v2
161+
with:
162+
dependency-versions: stable
163+
composer-options: --prefer-dist
164+
165+
- name: Install PHPUnit
166+
uses: ramsey/composer-install@v2
167+
with:
168+
composer-options: --prefer-dist
169+
working-directory: tools/phpunit
170+
171+
- name: Create Coverage Report
172+
run: tools/phpunit/vendor/bin/phpunit --colors=always --coverage-text --coverage-clover=./clover.xml
173+
174+
- name: Publish Coverage Report
175+
uses: codecov/codecov-action@v3.1.5
176+
with:
177+
files: ./clover.xml
178+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Get previous tag
18+
id: previousTag
19+
run: |
20+
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
21+
echo "previousTag: $name"
22+
echo "previousTag=$name" >> $GITHUB_ENV
23+
24+
- name: Generate Changelog
25+
id: changelog
26+
uses: requarks/changelog-action@v1
27+
with:
28+
token: ${{ github.token }}
29+
fromTag: ${{ github.ref_name }}
30+
toTag: ${{ env.previousTag }}
31+
writeToFile: false
32+
33+
- name: Create Release
34+
uses: ncipollo/release-action@v1.12.0
35+
with:
36+
allowUpdates: true
37+
draft: true
38+
makeLatest: true
39+
name: ${{ github.ref_name }}
40+
body: ${{ steps.changelog.outputs.changes }}
41+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/vendor/
2+
/var
3+
/.DS_Store
4+
/.idea/
5+
/.phpunit*
6+
/composer.lock
7+
/.php-cs-fixer.cache
8+
/.phpunit.result.cache
9+
/psalm-report.sarif
10+
/psalm-report.md
11+
/test-results

.php-cs-fixer.dist.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the ReactBundle package.
7+
*
8+
* (c) Andreas Linden <zlx@gmx.de>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
if (!file_exists(__DIR__.'/src')) {
15+
exit(0);
16+
}
17+
18+
$fileHeaderComment = <<<'EOF'
19+
This file is part of the ReactBundle package.
20+
21+
(c) Andreas Linden <zlx@gmx.de>
22+
23+
For the full copyright and license information, please view the LICENSE
24+
file that was distributed with this source code.
25+
EOF;
26+
27+
return (new PhpCsFixer\Config())
28+
->setRules([
29+
'@PHP71Migration' => true,
30+
'@PHPUnit75Migration:risky' => true,
31+
'@Symfony' => true,
32+
'@Symfony:risky' => true,
33+
'protected_to_private' => false,
34+
'native_constant_invocation' => ['strict' => false],
35+
'no_superfluous_phpdoc_tags' => [
36+
'remove_inheritdoc' => true,
37+
'allow_unused_params' => true, // for future-ready params, to be replaced with https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7377
38+
],
39+
'nullable_type_declaration_for_default_null_value' => true,
40+
'header_comment' => ['header' => $fileHeaderComment],
41+
'modernize_strpos' => true,
42+
'get_class_to_class_keyword' => true,
43+
'nullable_type_declaration' => true,
44+
'ordered_types' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
45+
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'match', 'parameters']],
46+
'declare_strict_types' => true,
47+
])
48+
->setRiskyAllowed(true)
49+
->setFinder(
50+
(new PhpCsFixer\Finder())
51+
->in(__DIR__.'/src')
52+
->in(__DIR__.'/tests')
53+
->append([__FILE__])
54+
)
55+
->setCacheFile('.php-cs-fixer.cache')
56+
;

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM php:8.4-cli-alpine
2+
3+
RUN apk add --no-cache make autoconf build-base linux-headers
4+
5+
RUN pecl channel-update pecl.php.net && \
6+
pecl install xdebug-3.4.0 && \
7+
docker-php-ext-enable xdebug
8+
9+
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
10+
&& php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }" \
11+
&& php composer-setup.php \
12+
&& php -r "unlink('composer-setup.php');" \
13+
&& mv composer.phar /usr/local/bin/composer
14+
15+
WORKDIR /opt/vom
16+
17+
ADD ./ .

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Andreas Linden
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.PHONY: deps deps-test deps-codestyle deps-static-analysis test test-lowest test-stable static-analysis codestyle-fix codestyle help
2+
.DEFAULT_GOAL:=help
3+
4+
deps: ## Install project dependencies
5+
XDEBUG_MODE=off composer update --prefer-dist --no-plugins --no-scripts $(COMPOSER_ARGS)
6+
7+
deps-test: ## Install PHPUnit dependencies
8+
XDEBUG_MODE=off composer update --prefer-dist --no-plugins --no-scripts $(COMPOSER_ARGS) --working-dir=tools/phpunit
9+
10+
deps-codestyle: ## Install PHP-CS-Fixer dependencies
11+
XDEBUG_MODE=off composer update --prefer-dist --no-plugins --no-scripts $(COMPOSER_ARGS) --working-dir=tools/php-cs-fixer
12+
13+
deps-static-analysis: ## Install dependencies for psalm
14+
XDEBUG_MODE=off composer update --prefer-dist --no-plugins --no-scripts $(COMPOSER_ARGS) --working-dir=tools/psalm
15+
16+
test: deps deps-test ## Run the test with locked dependencies
17+
XDEBUG_MODE=coverage tools/phpunit/vendor/bin/phpunit --colors=always --coverage-text --testdox
18+
19+
test-lowest: test ## Run the tests with lowest dependencies
20+
test-lowest: COMPOSER_ARGS=--prefer-lowest
21+
22+
test-stable: test ## Run the tests with stable dependencies
23+
test-stable: COMPOSER_ARGS=--prefer-stable
24+
25+
static-analysis: deps deps-static-analysis ## Run static code analysis
26+
XDEBUG_MODE=off tools/psalm/vendor/bin/psalm --report=psalm-report.sarif
27+
28+
codestyle-fix: deps-codestyle ## Fix Codestyle issues
29+
PHP_CS_FIXER_IGNORE_ENV=1 XDEBUG_MODE=off tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --show-progress=dots --ansi --verbose $(CS_FIXER_ARGS)
30+
31+
codestyle: codestyle-fix ## Show Codestyle issues
32+
codestyle: CS_FIXER_ARGS=--dry-run
33+
34+
help: ## Display this help
35+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

compose.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
test:
3+
build:
4+
dockerfile: Dockerfile
5+
context: .
6+
restart: no
7+
command: make test
8+
volumes:
9+
- ./:/opt/vom
10+
- ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

0 commit comments

Comments
 (0)