-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5cf2042
Showing
52 changed files
with
4,574 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
service_name: travis-ci | ||
coverage_clover: var/phpunit/clover.xml | ||
json_path: var/phpunit/coveralls-upload.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM php:7.2-cli | ||
|
||
RUN apt-get update && apt-get install -y git unzip | ||
|
||
RUN set -eux \ | ||
# Installation: Generic | ||
# Type: Built-in extension | ||
&& pecl install ast \ | ||
&& docker-php-ext-enable ast \ | ||
&& true | ||
|
||
# -------------------- Installing PHP Extension: redis -------------------- | ||
RUN set -eux \ | ||
# Installation: Generic | ||
# Type: PECL extension | ||
# Default: Pecl command | ||
&& pecl install redis \ | ||
&& docker-php-ext-enable redis \ | ||
&& true | ||
|
||
# -------------------- Installing PHP Extension: intl -------------------- | ||
RUN set -eux \ | ||
# Installation: Generic | ||
# Type: Built-in extension | ||
&& apt install -y libicu-dev \ | ||
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) intl \ | ||
&& true | ||
|
||
COPY php.ini /usr/local/etc/php/conf.d/default-php.ini | ||
|
||
ENV COMPOSER_ALLOW_SUPERUSER 1 | ||
ENV COMPOSER_MEMORY_LIMIT -1 | ||
|
||
RUN mkdir /.composer_cache | ||
ENV COMPOSER_CACHE_DIR /.composer_cache | ||
|
||
RUN mkdir /packages | ||
COPY . /packages/Alerting | ||
WORKDIR /packages/Alerting | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
RUN composer -vvv install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; Each PHP flavour (base, mods, prod, work) might have its own php.ini. | ||
; If none is present, the one from the previous flavour is inherited. | ||
|
||
|
||
[PHP] | ||
|
||
; Memory | ||
; Note: "memory_limit" should be larger than "post_max_size" | ||
memory_limit = 512M | ||
|
||
|
||
; Error reporting | ||
; Note: error_log is dynamic and handled during start to set appropriate setting | ||
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED | ||
xmlrpc_errors = Off | ||
report_memleaks = On | ||
display_errors = Off | ||
display_startup_errors = Off | ||
log_errors = On | ||
html_errors = On | ||
|
||
date.timezone=UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.PHONY: build | ||
build: ## build environment and initialize composer and project dependencies | ||
docker build .docker/php$(DOCKER_PHP_VERSION)-dev/ -t $(DOCKER_SERVER_HOST)/$(DOCKER_PROJECT_PATH)/php$(DOCKER_PHP_VERSION)-dev:$(DOCKER_IMAGE_VERSION) \ | ||
--build-arg DOCKER_SERVER_HOST=$(DOCKER_SERVER_HOST) \ | ||
--build-arg DOCKER_PROJECT_PATH=$(DOCKER_PROJECT_PATH) \ | ||
--build-arg DOCKER_PHP_VERSION=$(DOCKER_PHP_VERSION) \ | ||
--build-arg DOCKER_IMAGE_VERSION=$(DOCKER_IMAGE_VERSION) | ||
|
||
.PHONY: stop | ||
stop: | ||
docker-compose stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM php:7.2-cli | ||
|
||
RUN apt-get update && apt-get install -y git unzip | ||
|
||
RUN set -eux \ | ||
# Installation: Generic | ||
# Type: Built-in extension | ||
&& pecl install ast \ | ||
&& docker-php-ext-enable ast \ | ||
&& true | ||
|
||
# -------------------- Installing PHP Extension: intl -------------------- | ||
RUN set -eux \ | ||
# Installation: Generic | ||
# Type: Built-in extension | ||
&& apt install -y libicu-dev \ | ||
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) intl \ | ||
&& true | ||
|
||
# -------------------- Installing PHP Extension: redis -------------------- | ||
RUN set -eux \ | ||
# Installation: Generic | ||
# Type: PECL extension | ||
# Default: Pecl command | ||
&& pecl install redis \ | ||
&& docker-php-ext-enable redis \ | ||
&& true | ||
|
||
COPY php.ini /usr/local/etc/php/conf.d/default-php.ini | ||
|
||
ENV COMPOSER_ALLOW_SUPERUSER 1 | ||
ENV COMPOSER_MEMORY_LIMIT -1 | ||
|
||
RUN mkdir /.composer_cache | ||
ENV COMPOSER_CACHE_DIR /.composer_cache | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
RUN composer -vvv global require ergebnis/composer-normalize | ||
RUN composer -vvv global require pyrech/composer-changelogs | ||
|
||
# -------------------- Installing PHP Extension: xdebug -------------------- | ||
RUN set -eux \ | ||
# Installation: Generic | ||
# Type: PECL extension | ||
# Default: Pecl command | ||
&& pecl install xdebug \ | ||
# Enabling | ||
&& docker-php-ext-enable xdebug \ | ||
&& true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; Each PHP flavour (base, mods, prod, work) might have its own php.ini. | ||
; If none is present, the one from the previous flavour is inherited. | ||
|
||
|
||
[PHP] | ||
|
||
; Memory | ||
; Note: "memory_limit" should be larger than "post_max_size" | ||
memory_limit = 512M | ||
|
||
|
||
; Error reporting | ||
; Note: error_log is dynamic and handled during start to set appropriate setting | ||
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED | ||
xmlrpc_errors = Off | ||
report_memleaks = On | ||
display_errors = Off | ||
display_startup_errors = Off | ||
log_errors = On | ||
html_errors = On | ||
|
||
date.timezone=UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.deptrac.cache | ||
.dockerignore | ||
.editorconfig | ||
.gitignore | ||
.travis.yml | ||
README.md | ||
var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
|
||
# 4 space indentation | ||
[*.php] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Tab indentation (no size specified) | ||
[Makefile] | ||
indent_style = tab | ||
|
||
# Matches the exact files either package.json or .travis.yml | ||
[{*.yml, *.yaml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[composer.json] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is a "template" of which env vars need to be defined for your application | ||
# Copy this file to .env file for development, create environment variables when deploying to production | ||
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration | ||
|
||
ADGALR_COMPOSE_PROJECT_NAME=alerting | ||
|
||
###> common variables ### | ||
DOCKER_SERVER_HOST=docker.local | ||
DOCKER_PROJECT_PATH=adgoal/common/alerting | ||
DOCKER_PHP_VERSION=7.2 | ||
DOCKER_IMAGE_VERSION=master | ||
###< common variables ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
vendor/ | ||
|
||
###> PhpStorm project profile ### | ||
.idea/ | ||
###< PhpStorm project profile ### | ||
|
||
###> phpunit/phpunit ### | ||
phpunit.xml | ||
.phpunit.result.cache | ||
###< phpunit/phpunit ### | ||
|
||
###> friendsofphp/php-cs-fixer ### | ||
.php_cs.cache | ||
###< friendsofphp/php-cs-fixer ### | ||
|
||
###> squizlabs/php_codesniffer ### | ||
.phpcs-cache | ||
###< squizlabs/php_codesniffer ### | ||
|
||
###> sensiolabs-de/deptrac ### | ||
.deptrac.cache | ||
###< sensiolabs-de/deptrac ### | ||
|
||
composer.lock | ||
.env.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.PHONY: composer-install | ||
composer-install: ## Install project dependencies | ||
docker-compose run --rm --no-deps php sh -lc 'composer -vvv install' | ||
|
||
.PHONY: composer-update | ||
composer-update: ## Update project dependencies | ||
docker-compose run --rm --no-deps php sh -lc 'composer -vvv update' | ||
|
||
.PHONY: composer-outdated | ||
composer-outdated: ## Show outdated project dependencies | ||
docker-compose run --rm --no-deps php sh -lc 'composer outdated' | ||
|
||
.PHONY: composer-validate | ||
composer-validate: ## Validate composer config | ||
docker-compose run --rm --no-deps php sh -lc 'composer validate --no-check-publish' | ||
|
||
.PHONY: composer | ||
composer: ## Execute composer command | ||
docker-compose run --rm --no-deps php sh -lc "composer $(RUN_ARGS)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.PHONY: lint layer style coding-standards | ||
static-analysis: lint layer style coding-standards ## Run phpstan, deprac, easycoding standarts code static analysis | ||
|
||
.PHONY: phpstan psalm | ||
style: phpstan psalm ## executes php analizers | ||
|
||
|
||
.PHONY: ecs-fixer | ||
coding-standards-fixer: ecs-fixer | ||
|
||
.PHONY: ecs phpmd | ||
coding-standards: ecs phpmd | ||
|
||
|
||
|
||
|
||
.PHONY: lint | ||
lint: ## checks syntax of PHP files | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/parallel-lint ./ --exclude vendor' | ||
|
||
.PHONY: layer | ||
layer: ## check issues with layers (deptrac tool) | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/deptrac analyze' | ||
|
||
.PHONY: ecs | ||
ecs: | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/ecs check src tests' | ||
|
||
.PHONY: ecs-fixer | ||
ecs-fixer: | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/ecs check src tests --fix' | ||
|
||
.PHONY: phpmd | ||
phpmd: | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/phpmd src/ text phpmd.xml' | ||
|
||
|
||
.PHONY: infection | ||
infection: ## executes mutation framework infection | ||
docker-compose run --rm --no-deps php-fpm sh -lc './vendor/bin/infection --min-msi=70 --min-covered-msi=80 --threads=$(JOBS) --coverage=var/report' | ||
|
||
.PHONY: phpstan | ||
phpstan: ## phpstan - PHP Static Analysis Tool | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/phpstan analyse -l 6 -c phpstan.neon src tests' | ||
|
||
.PHONY: psalm | ||
psalm: ## psalm is a static analysis tool for finding errors in PHP applications | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/psalm --config=psalm.xml' | ||
|
||
.PHONY: psalm-fixer | ||
psalm-fixer: ## psalm is a static analysis tool for finding errors in PHP applications | ||
docker-compose run --rm --no-deps php sh -lc './vendor/bin/psalm --config=psalm.xml --alter --issues=MissingParamType --dry-run' | ||
|
||
.PHONY: phan | ||
phan: ## phan is a static analyzer for PHP that prefers to minimize false-positives. | ||
docker-compose run --rm --no-deps php sh -lc 'PHAN_DISABLE_XDEBUG_WARN=1 PHAN_ALLOW_XDEBUG=1 php -d zend.enable_gc=0 ./vendor/bin/phan --config-file phan.php --require-config-exists' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
dist: focal | ||
sudo: true | ||
|
||
cache: | ||
directories: | ||
- docker_images | ||
|
||
before_install: | ||
- docker load -i docker_images/images.tar || true | ||
|
||
before_cache: | ||
- docker save -o docker_images/images.tar $(docker images -a -q) | ||
|
||
install: | ||
- sudo curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose | ||
- sudo chmod +x /usr/local/bin/docker-compose | ||
- export DOCKER_UID=`id -u` | ||
- export DOCKER_GID=`id -g` | ||
- export DOCKER_IMAGE_VERSION=`echo $TRAVIS_BRANCH | tr "[:upper:]" "[:lower:]" | sed "s/[^a-zA-Z0-9-]/-/g" | sed "s/-$//g" | tr -d '\n' | tr -d '\r'` | ||
- make build | ||
- make composer-install | ||
|
||
script: | ||
- make lint | ||
- make static-analysis | ||
- make coding-standards | ||
- make tests-unit | ||
- git log $(git describe --abbrev=0 --tags)...HEAD --no-merges --pretty=format:"* [%h](http://github.com/${TRAVIS_REPO_SLUG}/commit/%H) %s (%cN)" | ||
|
||
after_success: | ||
- set | grep "TRAVIS" > .env.travis | ||
- eval "docker-compose --env-file .env.travis run --rm php sh -lc 'php ./vendor/bin/php-coveralls -v --config .coveralls.yml'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
include .env | ||
export | ||
|
||
include .make/static-analysis.mk | ||
include .make/composer.mk | ||
include .docker/docker.mk | ||
|
||
sources = bin/console config src | ||
version = $(shell git describe --tags --dirty --always) | ||
build_name = application-$(version) | ||
# use the rest as arguments for "run" | ||
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) | ||
# ...and turn them into do-nothing targets | ||
#$(eval $(RUN_ARGS):;@:) | ||
|
||
.PHONY: fix-permission | ||
fix-permission: ## fix permission for docker env | ||
sudo chown -R $(shell whoami):$(shell whoami) * | ||
sudo chown -R $(shell whoami):$(shell whoami) .docker/* | ||
|
||
|
||
|
||
.PHONY: phpunit | ||
phpunit: ## execute project unit tests | ||
docker-compose run --rm php sh -lc "./vendor/bin/phpunit $(conf)" | ||
|
||
.PHONY: logs | ||
logs: ## look for service logs | ||
docker-compose logs -f $(RUN_ARGS) | ||
|
||
.PHONY: help | ||
help: ## Display this help message | ||
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: php-shell | ||
php-shell: ## PHP shell | ||
docker-compose run --rm php sh -l | ||
|
||
tests-unit: ## Run unit-tests suite | ||
docker-compose run --rm php sh -lc 'XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite unit-tests --configuration phpunit.xml.dist' | ||
|
||
.PHONY: build composer-install | ||
install: build composer-install | ||
|
||
.PHONY: test lint static-analysis phpunit coding-standards tests-unit | ||
test: build lint static-analysis coding-standards tests-unit stop ## Run all test suites |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Adgoal Alerting modules | ||
|
||
[![Build Status](https://travis-ci.com/Adgoal/Alerting.svg?branch=master)](https://travis-ci.com/Adgoal/Alerting) | ||
[![Coverage Status](https://coveralls.io/repos/github/Adgoal/Alerting/badge.svg)](https://coveralls.io/github/Adgoal/Alerting) |
Oops, something went wrong.