Skip to content

Commit 146b08d

Browse files
authored
Code transferred from original repository (#2)
1 parent 38d4f09 commit 146b08d

File tree

81 files changed

+4621
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4621
-99
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.{yml, yaml, sh, conf, neon*}]
12+
indent_size = 2
13+
14+
[Makefile]
15+
indent_style = tab
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
labels: type:bug
5+
assignees: tarampampam
6+
7+
---
8+
9+
## Describe the bug
10+
11+
> A clear and concise description of what the bug is.
12+
13+
### Expected behaviour
14+
15+
> Tell us what should happen.
16+
17+
### Actual behaviour
18+
19+
> Tell us what happens instead.
20+
21+
### Steps to reproduce the behavior:
22+
23+
> Put some code example:
24+
>
25+
> ```php
26+
> $some = new \stdClass();
27+
> echo $some;
28+
>
29+
> PHP Catchable fatal error: Object of class stdClass could not be converted to string in Command line code on line 2
30+
> PHP Stack trace:
31+
> PHP 1. {main}() Command line code:0
32+
> ```
33+
34+
## System information
35+
36+
> Please, complete the following information:
37+
38+
- PHP version(s): [e.g. `7.2.6`]
39+
- Package version(s): [e.g. `3.3.0`]
40+
41+
## Additional context
42+
43+
> Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this package
4+
labels: type:enhancement
5+
assignees: tarampampam
6+
7+
---
8+
9+
### Is your feature request related to a problem?
10+
11+
> A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
### Describe the solution you'd like
14+
15+
> A clear and concise description of what you want to happen.
16+
17+
## Additional context
18+
19+
> Add any other context about the feature request here.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: Question
3+
about: Ask anything
4+
labels: type:question
5+
assignees: tarampampam
6+
7+
---
8+
9+
> If you have any questions feel free to ask

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
| Q | A
2+
| ------------- | ---
3+
| Bug fix? | Yes or No
4+
| New feature? | Yes or No
5+
6+
## Description
7+
8+
<!--
9+
10+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
11+
12+
-->
13+
14+
Fixes # (issue)
15+
16+
## Checklist
17+
18+
- [ ] My code follows the style guidelines of this project
19+
- [ ] I have performed a self-review of my own code
20+
- [ ] I have commented my code, particularly in hard-to-understand areas
21+
- [ ] I wrote unit tests for my code _(if tests is required for my changes)_
22+
- [ ] I have made changes in `CHANGELOG.md` file
23+
24+
<!--
25+
26+
About your changes in `CHANGELOG.md`:
27+
28+
* Add version header `## UNRELEASED`, if it does not exists
29+
* Add description under `Added`/`Changed`/`Fixed` sections
30+
* Add reference to closed issues `[#000]`
31+
* Add link to issue in the end of document
32+
33+
-->

.github/workflows/main.yml

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,71 @@ on:
88
- '**'
99
pull_request:
1010

11-
jobs:
12-
test:
11+
jobs: # Docs: <https://help.github.com/en/articles/workflow-syntax-for-github-actions>
12+
tests:
1313
name: PHP ${{ matrix.php }}, ${{ matrix.setup }} setup
1414
runs-on: ubuntu-latest
15+
timeout-minutes: 10
1516
strategy:
1617
fail-fast: false
1718
matrix:
1819
setup: ['basic', 'lowest']
19-
php-versions: ['7.1', '7.2', '7.3', '7.4']
20-
- name: Check out code
21-
uses: actions/checkout@v2
22-
with:
23-
fetch-depth: 1
20+
php: ['7.1', '7.2', '7.3', '7.4']
21+
include:
22+
- php: '7.1'
23+
setup: 'basic'
24+
coverage: 'true'
25+
- php: '7.4'
26+
setup: 'basic'
27+
coverage: 'true'
28+
steps:
29+
- name: Check out code
30+
uses: actions/checkout@v2
31+
with:
32+
fetch-depth: 1
2433

25-
- name: Setup PHP, with composer and extensions
26-
uses: shivammathur/setup-php@master # Action page: <https://github.com/shivammathur/setup-php>
27-
with:
28-
php-version: ${{ matrix.php }}
29-
extensions: mbstring, pdo, pdo_sqlite, sqlite3 # definition is required for php 7.4
34+
- name: Setup PHP, with composer and extensions
35+
uses: shivammathur/setup-php@master # Action page: <https://github.com/shivammathur/setup-php>
36+
with:
37+
php-version: ${{ matrix.php }}
38+
extensions: mbstring, pdo, pdo_sqlite, sqlite3 # definition is required for php 7.4
3039

31-
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
32-
id: composer-cache
33-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
40+
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
41+
id: composer-cache
42+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
3443

35-
- name: Cache dependencies # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
36-
uses: actions/cache@v1
37-
with:
38-
path: ${{ steps.composer-cache.outputs.dir }}
39-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
40-
restore-keys: ${{ runner.os }}-composer-
44+
- name: Cache dependencies # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
45+
uses: actions/cache@v1
46+
with:
47+
path: ${{ steps.composer-cache.outputs.dir }}
48+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
49+
restore-keys: ${{ runner.os }}-composer-
4150

42-
- name: Install Composer 'hirak/prestissimo' package
43-
run: composer global require hirak/prestissimo --update-no-dev
51+
- name: Install Composer 'hirak/prestissimo' package
52+
run: composer global require hirak/prestissimo --update-no-dev
4453

45-
- name: Install lowest Composer dependencies
46-
if: matrix.setup == 'lowest'
47-
run: composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest
54+
- name: Install lowest Composer dependencies
55+
if: matrix.setup == 'lowest'
56+
run: composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest
4857

49-
- name: Install basic Composer dependencies
50-
if: matrix.setup == 'basic'
51-
run: composer update --prefer-dist --no-interaction --no-suggest
58+
- name: Install basic Composer dependencies
59+
if: matrix.setup == 'basic'
60+
run: composer update --prefer-dist --no-interaction --no-suggest
5261

53-
- name: Show most important packages versions
54-
run: composer info | grep -e laravel/laravel -e phpunit/phpunit -e phpstan/phpstan
62+
- name: Show most important packages versions
63+
run: composer info | grep -e laravel/laravel -e phpunit/phpunit -e phpstan/phpstan
5564

56-
- name: Execute tests
57-
if: matrix.coverage != 'true'
58-
run: composer test
65+
- name: Execute tests
66+
if: matrix.coverage != 'true'
67+
run: composer test
5968

60-
- name: Execute tests with code coverage
61-
if: matrix.coverage == 'true'
62-
run: composer test-cover
69+
- name: Execute tests with code coverage
70+
if: matrix.coverage == 'true'
71+
run: composer test-cover
6372

64-
- uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action>
65-
if: matrix.coverage == 'true'
66-
with:
67-
token: ${{ secrets.CODECOV_TOKEN }}
68-
file: ./coverage/clover.xml
69-
fail_ci_if_error: false
73+
- uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action>
74+
if: matrix.coverage == 'true'
75+
with:
76+
token: ${{ secrets.CODECOV_TOKEN }}
77+
file: ./coverage/clover.xml
78+
fail_ci_if_error: false

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
6+
7+
## v3.3.0
8+
9+
### Added
10+
11+
- Event `LoopErrorOccurredEvent` (triggered on request processing exception)
12+
- Listener `SendExceptionToStderrListener` for direct exception sending (as a string) into `stderr`
13+
- Listener `StopWorkerListener` for worker stopping
14+
15+
### Changed
16+
17+
- Default package configuration includes `LoopErrorOccurredEvent` event listeners: `SendExceptionToStderrListener` and `StopWorkerListener` [#42]
18+
- When "debug mode" (`app.debug`) is **not** enabled - client will get only `Internal server error` string instead exception with stacktrace [#42]
19+
20+
### Fixed
21+
22+
- Double response sending on request processing error (calling `$psr7_client->respond` and `$psr7_client->getWorker()->error` after that)
23+
24+
[#42]:https://github.com/avto-dev/roadrunner-laravel/issues/42
25+
26+
[keepachangelog]:https://keepachangelog.com/en/1.0.0/
27+
[semver]:https://semver.org/spec/v2.0.0.html

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM composer:1.8.6 AS composer
2+
3+
FROM php:7.2.5-alpine
4+
5+
ENV \
6+
COMPOSER_ALLOW_SUPERUSER="1" \
7+
COMPOSER_HOME="/tmp/composer"
8+
9+
COPY --from=composer /usr/bin/composer /usr/bin/composer
10+
11+
RUN set -xe \
12+
&& apk add --no-cache binutils git curl \
13+
&& apk add --no-cache --virtual .build-deps autoconf pkgconf make g++ gcc \
14+
# install xdebug (for testing with code coverage), but do not enable it
15+
&& pecl install xdebug-2.9.1 \
16+
&& apk del .build-deps \
17+
&& mkdir /src ${COMPOSER_HOME} \
18+
&& composer global require 'hirak/prestissimo' --no-interaction --no-suggest --prefer-dist \
19+
&& ln -s /usr/bin/composer /usr/bin/c \
20+
&& chmod -R 777 ${COMPOSER_HOME} \
21+
&& composer --version \
22+
&& php -v \
23+
&& php -m
24+
25+
WORKDIR /src
26+
27+
VOLUME ["/src"]

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/make
2+
# Makefile readme (ru): <http://linux.yaroslavl.ru/docs/prog/gnu_make_3-79_russian_manual.html>
3+
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>
4+
5+
dc_bin := $(shell command -v docker-compose 2> /dev/null)
6+
7+
SHELL = /bin/sh
8+
RUN_APP_ARGS = --rm --user "$(shell id -u):$(shell id -g)" app
9+
10+
.PHONY : help build latest install lowest test test-cover clean
11+
.DEFAULT_GOAL : help
12+
13+
# This will output the help for each task. thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
14+
help: ## Show this help
15+
@printf "\033[33m%s:\033[0m\n" 'Available commands'
16+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
17+
18+
build: ## Build docker images, required for current package environment
19+
$(dc_bin) build
20+
21+
latest: clean ## Install latest php dependencies
22+
$(dc_bin) run $(RUN_APP_ARGS) composer update -n --ansi --no-suggest --prefer-dist --prefer-stable
23+
24+
install: clean ## Install regular php dependencies
25+
$(dc_bin) run $(RUN_APP_ARGS) composer update -n --prefer-dist --no-interaction --no-suggest
26+
27+
lowest: clean ## Install lowest php dependencies
28+
$(dc_bin) run $(RUN_APP_ARGS) composer update -n --ansi --no-suggest --prefer-dist --prefer-lowest
29+
30+
test: ## Execute php tests and linters
31+
$(dc_bin) run $(RUN_APP_ARGS) composer test
32+
33+
test-cover: ## Execute php tests with coverage
34+
$(dc_bin) run --rm --user "0:0" app sh -c 'docker-php-ext-enable xdebug && su $(shell whoami) -s /bin/sh -c "composer phpunit-cover"'
35+
36+
shell: ## Start shell into container with php
37+
$(dc_bin) run -e "PS1=\[\033[1;32m\]\[\033[1;36m\][\u@docker] \[\033[1;34m\]\w\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]" $(RUN_APP_ARGS) sh
38+
39+
clean: ## Remove all dependencies and unimportant files
40+
-rm -Rf ./composer.lock ./vendor ./coverage

0 commit comments

Comments
 (0)