Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Improve v2 #17

Merged
merged 9 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
[*.{md,json}]
trim_trailing_whitespace = false

[*.{yml,yaml,sh,conf}]
[*.{yml,yaml,sh,conf,neon*}]
indent_size = 2

[Makefile]
Expand Down
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

/.github export-ignore
/tests export-ignore
/[Dd]ocker* export-ignore
/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/.* export-ignore
/phpunit.xml export-ignore
/phpunit.xml* export-ignore
/phpstan.* export-ignore
/Makefile export-ignore
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @link <https://help.github.com/en/articles/about-code-owners>

* @tarampampam
22 changes: 15 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

## Description

> 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.
<!--

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.

-->

Fixes # (issue)

Expand All @@ -17,9 +21,13 @@ Fixes # (issue)
- [ ] I wrote unit tests for my code
- [ ] I have made changes in [CHANGELOG.md](https://github.com/avto-dev/roadrunner-laravel/blob/master/CHANGELOG.md) file

> About your changes in `CHANGELOG.md`:
>
> * Add new version header like `## v1.x.x`, if it does not exists
> * Add description under `Added` / `Changed` / `Fixed` sections
> * Add reference to closed issues `[#000]`
> * Add link to issue in the end of document
<!--

About your changes in `CHANGELOG.md`:

* Add new version header like `## v1.x.x`, if it does not exists
* Add description under `added`/`changed`/`fixed` sections
* Add reference to closed issues `[#000]`
* Add link to issue in the end of document

-->
34 changes: 0 additions & 34 deletions .scrutinizer.yml

This file was deleted.

67 changes: 40 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,67 @@ language: php

cache:
directories:
- $HOME/.composer/cache
- $HOME/.composer/cache

env:
global:
- setup=basic
- coverage=false
- setup=basic
- coverage=false
- laravel=default

sudo: false

branches:
except:
- gh-pages
- /analysis-.*/
- /analysis-.*/

before_install:
- if [[ $coverage = 'false' ]]; then phpenv config-rm xdebug.ini || true; fi
- if [[ $coverage = 'false' ]]; then phpenv config-rm xdebug.ini || true; fi
- composer global require hirak/prestissimo --update-no-dev

install:
- if [[ $setup = 'basic' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest; fi
- if [[ $setup = 'basic' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest; fi
- if [[ $laravel != 'default' ]]; then travis_retry composer require --dev --update-with-dependencies --prefer-dist --no-interaction --no-suggest laravel/laravel "$laravel"; fi
- composer info | grep -e laravel/laravel -e phpunit/phpunit -e phpstan/phpstan

script:
- composer phpstan
- if [[ $coverage = 'true' ]]; then composer test-cover; else composer test; fi
- if [[ $coverage = 'true' ]]; then composer test-cover; else composer test; fi

after_success:
- if [[ $coverage = 'true' ]]; then bash <(curl -s https://codecov.io/bash); fi
- if [[ $coverage = 'true' ]]; then bash <(curl -s https://codecov.io/bash); fi

matrix:
include:
- php: 7.1.3
env: setup=lowest
- php: 7.1.3
env: laravel=5.5
- php: 7.1.3
env: laravel=5.6
- php: 7.1.3
env: laravel=5.7
- php: 7.1.3
env: coverage=true

- php: 7.1.3
- php: 7.1.3
env: setup=lowest
- php: 7.2
env: setup=lowest
- php: 7.2
env: coverage=true

- php: 7.2
env: coverage=true
- php: 7.2
env: setup=lowest
- php: 7.2
env: setup=stable
- php: 7.3
env: setup=lowest
- php: 7.3
env: laravel=5.5
- php: 7.3
env: laravel=5.6
- php: 7.3
env: laravel=5.7
- php: 7.3
env: coverage=true

- php: 7.3
- php: 7.3
env: setup=lowest

- php: nightly
- php: nightly

allow_failures:
- php: nightly
- php: nightly
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].

## v2.1.0

### Added

- Middleware `SetServerPortMiddleware` for automatic setting `SERVER_PORT` in server parameters bag if it does not set before (value based on request schema; this middleware fixes **empty port value** like `https://127.0.0.1:/` when exposed default port without set `SERVER_PORT`)
- Environment variable `RR_WORKER_CLASS` supports for overriding default worker class (watch in `./bin/rr-worker`)
- Docker-based environment for development
- Project `Makefile`

### Changed

- Allowed RR configuration options (`http.fcgi.*`, `http.http2.*`, `headers.*`) (**do not forget update your existing config files**)
- Minimal `Laravel` version now is `5.5.x`
- Minimal `spiral/roadrunner` version now is `^1.4.6`
- Composer scripts
- Package service-provider automatically register `SetServerPortMiddleware` middleware
- Constant `RULE_METHOD_PREFIX` in `CallbacksInitializer` class now protected
- Constants `BOOL_OPTION_INVERT_LOGIC_NAME_PREFIX` and `OPTIONS_PREFIX` in `StartOptions` class now protected
- Method `start()` must returns `void` in `WorkerInterface` interface

### Removed

- Dev-dependency `avto-dev/dev-tools`

## v2.0.0

### Added
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM composer:1.8.6 AS composer

FROM php:7.1.3-alpine

ENV \
COMPOSER_ALLOW_SUPERUSER="1" \
COMPOSER_HOME="/tmp/composer"

COPY --from=composer /usr/bin/composer /usr/bin/composer

RUN set -xe \
&& apk add --no-cache binutils git curl \
&& apk add --no-cache --virtual .build-deps autoconf pkgconf make g++ gcc \
# install xdebug (for testing with code coverage), but not enable it
&& pecl install xdebug-2.7.2 \
&& apk del .build-deps \
&& mkdir /src ${COMPOSER_HOME} \
&& composer global require 'hirak/prestissimo' --no-interaction --no-suggest --prefer-dist \
&& ln -s /usr/bin/composer /usr/bin/c \
&& chmod -R 777 ${COMPOSER_HOME} \
&& composer --version \
&& php -v \
&& php -m

WORKDIR /src

VOLUME ["/src"]
35 changes: 21 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,40 @@
# Makefile readme (ru): <http://linux.yaroslavl.ru/docs/prog/gnu_make_3-79_russian_manual.html>
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>

docker_bin := $(shell command -v docker 2> /dev/null)
dc_bin := $(shell command -v docker-compose 2> /dev/null)

SHELL = /bin/sh
PHP_IMAGE = composer:1.8
RUN_ARGS = --rm -v "$(shell pwd):/src:cached" -v "/etc/passwd:/etc/passwd:ro" -v "/etc/group:/etc/group:ro" \
--workdir "/src" -u "$(shell id -u):$(shell id -g)"
RUN_INTERACTIVE ?= --tty --interactive
RUN_APP_ARGS = --rm --user "$(shell id -u):$(shell id -g)" app

.PHONY : help install test shell
.SILENT : help install shell test
.PHONY : help build latest install lowest test test-cover shell clean
.DEFAULT_GOAL : help

# This will output the help for each task. thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## Show this help
@printf "\033[33m%s:\033[0m\n" 'Available commands'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install all php dependencies
$(docker_bin) run $(RUN_ARGS) $(RUN_INTERACTIVE) "$(PHP_IMAGE)" composer install --no-interaction --ansi --no-suggest --prefer-dist
build: ## Build docker images, required for current package environment
$(dc_bin) build

latest: clean ## Install latest php dependencies
$(dc_bin) run $(RUN_APP_ARGS) composer update -n --ansi --no-suggest --prefer-dist --prefer-stable

install: clean ## Install regular php dependencies
$(dc_bin) run $(RUN_APP_ARGS) composer update -n --prefer-dist --no-interaction --no-suggest

lowest: clean ## Install lowest php dependencies
$(dc_bin) run $(RUN_APP_ARGS) composer update -n --ansi --no-suggest --prefer-dist --prefer-lowest

test: ## Execute php tests and linters
$(docker_bin) run $(RUN_ARGS) $(RUN_INTERACTIVE) "$(PHP_IMAGE)" bash -c "composer phpstan && composer test"
$(dc_bin) run $(RUN_APP_ARGS) composer test

test-cover: ## Execute php tests with coverage
$(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"'

shell: ## Start shell into container with php
$(docker_bin) run $(RUN_ARGS) $(RUN_INTERACTIVE) \
-e "PS1=\[\033[1;32m\]🐳 \[\033[1;36m\][\u@\h] \[\033[1;34m\]\w\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]" \
"$(PHP_IMAGE)" bash
$(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

clean: ## Remove all dependencies and unimportant files
-rm -Rf ./composer.lock ./vendor
-rm -Rf ./composer.lock ./vendor ./coverage
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
[![Version][badge_php_version]][link_packagist]
[![Build Status][badge_build_status]][link_build_status]
[![Coverage][badge_coverage]][link_coverage]
[![Code quality][badge_code_quality]][link_code_quality]
[![Downloads count][badge_downloads_count]][link_packagist]
[![License][badge_license]][link_license]

Expand All @@ -18,13 +17,13 @@ Easy way for connecting [RoadRunner][roadrunner] and Laravel applications.

Require this package with composer using the one of next commands.

For Laravel versions `5.5.x`..`5.7.x`:
For Laravel versions `5.5.x`..`5.7.x` with minimal PHP version 7.0 (version `1.x` is abandoned):

```shell
$ composer require avto-dev/roadrunner-laravel "^1.4"
```

For Laravel versions `5.8.x` and above:
For Laravel versions `5.5.x`..`5.8.x` with minimal PHP version 7.1.3 and above:

```shell
$ composer require avto-dev/roadrunner-laravel "^2.0"
Expand Down Expand Up @@ -78,6 +77,7 @@ Environment name | Description
`APP_BASE_PATH` | Base path to the application
`APP_BOOTSTRAP_PATH` | Path to the application bootstrap file _(default: `/bootstrap/app.php`)_
`APP_FORCE_HTTPS` | Force `https` schema usage (eg. for links generation)
`RR_WORKER_CLASS` | Worker class name _(default: `\AvtoDev\RoadRunnerLaravel\Worker\Worker`)_

### Additional HTTP-headers

Expand Down Expand Up @@ -118,7 +118,6 @@ This is open-sourced software licensed under the [MIT License][link_license].
[badge_packagist_version]:https://img.shields.io/packagist/v/avto-dev/roadrunner-laravel.svg?maxAge=180
[badge_php_version]:https://img.shields.io/packagist/php-v/avto-dev/roadrunner-laravel.svg?longCache=true
[badge_build_status]:https://travis-ci.org/avto-dev/roadrunner-laravel.svg?branch=master
[badge_code_quality]:https://img.shields.io/scrutinizer/g/avto-dev/roadrunner-laravel.svg?maxAge=180
[badge_coverage]:https://img.shields.io/codecov/c/github/avto-dev/roadrunner-laravel/master.svg?maxAge=60
[badge_downloads_count]:https://img.shields.io/packagist/dt/avto-dev/roadrunner-laravel.svg?maxAge=180
[badge_license]:https://img.shields.io/packagist/l/avto-dev/roadrunner-laravel.svg?longCache=true
Expand All @@ -131,7 +130,6 @@ This is open-sourced software licensed under the [MIT License][link_license].
[link_build_status]:https://travis-ci.org/avto-dev/roadrunner-laravel
[link_coverage]:https://codecov.io/gh/avto-dev/roadrunner-laravel/
[link_changes_log]:https://github.com/avto-dev/roadrunner-laravel/blob/master/CHANGELOG.md
[link_code_quality]:https://scrutinizer-ci.com/g/avto-dev/roadrunner-laravel/
[link_issues]:https://github.com/avto-dev/roadrunner-laravel/issues
[link_create_issue]:https://github.com/avto-dev/roadrunner-laravel/issues/new/choose
[link_commits]:https://github.com/avto-dev/roadrunner-laravel/commits
Expand Down
Loading