Skip to content

Commit

Permalink
Migrate to PHP 7.1.3 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed Jul 15, 2019
1 parent d11bae6 commit 738ddff
Show file tree
Hide file tree
Showing 50 changed files with 612 additions and 590 deletions.
15 changes: 9 additions & 6 deletions .gitattributes
@@ -1,8 +1,11 @@
* text=auto

/.github export-ignore
/tests export-ignore
/*.md export-ignore
/LICENSE* export-ignore
/.* export-ignore
/phpunit.xml export-ignore
/.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
/phpstan.* export-ignore
/Makefile export-ignore
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -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
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/static-references-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.

79 changes: 43 additions & 36 deletions .travis.yml
Expand Up @@ -2,63 +2,70 @@ 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-stable --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:
- 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: 5.6
env: coverage=true
- php: 5.6
env: setup=lowest
- php: 5.6
env: setup=stable
- php: 7.1.3
- 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.0
- php: 7.0
env: setup=lowest
- php: 7.2
- php: 7.2
env: setup=lowest
- php: 7.2
env: coverage=true

- php: 7.1
- php: 7.1
env: setup=lowest
- php: 7.3
- 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.2
env: coverage=true
- php: 7.2
env: setup=lowest
- php: 7.2
env: setup=stable

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

- php: nightly
- php: nightly

allow_failures:
- php: nightly
- php: nightly
17 changes: 17 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,23 @@ 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].

## v3.0.0

### Added

- Docker-based environment for development
- Project `Makefile`

### Changed

- Minimal `PHP` version now is `^7.1.3`
- Maximal `Laravel` version now is `5.8.x`
- Dependency `laravel/framework` changed to `illuminate/*`
- Composer scripts
- Argument and return types
- Class `\AvtoDev\StaticReferences\StaticReferencesServiceProvider` renamed to `\AvtoDev\StaticReferences\ServiceProvider`
- Service provider dependency `\Illuminate\Contracts\Foundation\Application` changed to `\Illuminate\Contracts\Container\Container`

## v2.4.0

### Changed
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
@@ -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"]
41 changes: 41 additions & 0 deletions Makefile
@@ -0,0 +1,41 @@
#!/usr/bin/make
# 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>

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

SHELL = /bin/sh
RUN_APP_ARGS = --rm --user "$(shell id -u):$(shell id -g)" app

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

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
$(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
$(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 ./coverage
16 changes: 7 additions & 9 deletions README.md
Expand Up @@ -19,21 +19,19 @@
Require this package with composer using the following command:

```shell
$ composer require avto-dev/static-references-laravel "^2.4"
$ composer require avto-dev/static-references-laravel "^3.0"
```

> Installed `composer` is required ([how to install composer][getcomposer]).
> You need to fix the major version of package.
> **Внимание!** Версии 1.x и 2.x имеют кардинальные отличия, поэтому при переходе с версии 1.x на 2.x пожалуйста ознакомьтесь с изменения и в коде.
Если вы используете Laravel версии 5.5 и выше, то сервис-провайдер данного пакета будет зарегистрирован автоматически. В противном случае вам необходимо самостоятельно зарегистрировать сервис-провайдер в секции `providers` файла `./config/app.php`:

```php
'providers' => [
// ...
AvtoDev\StaticReferences\StaticReferencesServiceProvider::class,
AvtoDev\StaticReferences\ServiceProvider::class,
]
```

Expand Down Expand Up @@ -124,12 +122,12 @@ $auto_regions->hasAutoCode(666); // false

### Testing

For package testing we use `phpunit` framework. Just write into your terminal:
For package testing we use `phpunit` framework and `docker-ce` + `docker-compose` as develop environment. So, just write into your terminal after repository cloning:

```shell
$ git clone git@github.com:avto-dev/static-references-laravel.git ./static-references-laravel && cd $_
$ composer install
$ composer test
```bash
$ make build
$ make latest # or 'make lowest'
$ make test
```

## Changes log
Expand Down
31 changes: 23 additions & 8 deletions composer.json
Expand Up @@ -15,15 +15,20 @@
}
],
"require": {
"php": "^5.6 || >=7.0",
"php": "^7.1.3",
"ext-json": "*",
"avto-dev/static-references-data": "^2.3",
"laravel/framework": ">=5.4.0 <5.8.0"
"illuminate/support": ">=5.4.0 <5.9.0",
"illuminate/container": ">=5.4.0 <5.9.0",
"illuminate/contracts": ">=5.4.0 <5.9.0",
"illuminate/cache": ">=5.4.0 <5.9.0",
"illuminate/config": ">=5.4.0 <5.9.0"
},
"require-dev": {
"laravel/laravel": ">=5.4.0 <5.8.0",
"mockery/mockery": "0.9.* || ~1.0",
"phpunit/phpunit": "~5.7.10 || ^6.4 || ~7.0"
"laravel/laravel": ">=5.4.0 <5.9.0",
"mockery/mockery": "^1.0",
"phpstan/phpstan": "^0.11.3",
"phpunit/phpunit": "^6.4 || ~7.5"
},
"autoload": {
"psr-4": {
Expand All @@ -40,13 +45,23 @@
"source": "https://github.com/avto-dev/static-references-laravel"
},
"scripts": {
"test": "@php ./vendor/bin/phpunit --no-coverage",
"test-cover": "@php ./vendor/bin/phpunit --coverage-html='./coverage/html'"
"phpunit": "@php ./vendor/bin/phpunit --no-coverage --colors=always",
"phpunit-feature": "@php ./vendor/bin/phpunit --no-coverage --colors=always",
"phpunit-cover": "@php ./vendor/bin/phpunit --coverage-html='./coverage/html'",
"phpstan": "@php ./vendor/bin/phpstan analyze -c ./phpstan.neon.dist --no-progress --ansi",
"test": [
"@phpstan",
"@phpunit"
],
"test-cover": [
"@phpstan",
"@phpunit-cover"
]
},
"extra": {
"laravel": {
"providers": [
"AvtoDev\\StaticReferences\\StaticReferencesServiceProvider"
"AvtoDev\\StaticReferences\\ServiceProvider"
]
},
"aliases": {
Expand Down

0 comments on commit 738ddff

Please sign in to comment.