Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mazsudo committed Jul 31, 2019
0 parents commit f37c137
Show file tree
Hide file tree
Showing 34 changed files with 1,385 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage_clover: build/phpunit/clover.xml
json_path: build/phpunit/coveralls-upload.json
service_name: travis-ci
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!--
Before you open an issue, make sure this one does not already exist.
Please also read the "guidelines for contributing" link above before posting.
-->

<!--
If you are reporting a bug, please try to fill in the following.
Otherwise remove it.
-->

### Environment

#### Sonata packages

```
$ composer show --latest 'sonata-project/*'
# Put the result here.
```

#### Symfony packages

```
$ composer show --latest 'symfony/*'
# Put the result here.
```

#### PHP version

```
$ php -v
# Put the result here.
```

## Subject

<!--
Give here as many details as possible.
Next sections are for ERRORS only.
-->

## Steps to reproduce

## Expected results

## Actual results

<!--
If it's an error message or piece of code, use code block tags,
and make sure you provide the whole stack trace(s),
not just the first error message you can see.
More details here: https://github.com/ekino/tiny-png-sonata-media-bundle/blob/master/CONTRIBUTING.md#issues
-->
56 changes: 56 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!-- THE PR TEMPLATE IS NOT AN OPTION. DO NOT DELETE IT, MAKE SURE YOU READ AND EDIT IT! -->

<!--
Show us you choose the right branch.
Different branches are used for different things :
- master is for everything backwards compatible, like patches, features and deprecation notices
- 1.x-dev is for deprecation removals and other changes that cannot be done without a BC-break
More details here: https://github.com/ekino/tiny-png-sonata-media-bundle/blob/master/CONTRIBUTING.md#the-base-branch
-->
I am targeting this branch, because {reason}.

<!--
Specify which issues will be fixed/closed.
Remove it if this is not related.
-->

Closes #{put_issue_number_here}

## Changelog

<!-- MANDATORY
Fill the changelog part inside the code block.
Follow this schema: http://keepachangelog.com/
-->

<!-- REMOVE EMPTY SECTIONS -->
```markdown
### Added
- Added some `Class::newMethod` to do great stuff

### Changed

### Deprecated

### Removed

### Fixed

### Security
```

## To do

<!--
If this is a work in progress, COMPLETE and ADD needed tasks.
You can add as many tasks as you want.
If some are not relevant, just REMOVE them.
-->

- [ ] Update the tests
- [ ] Update the documentation
- [ ] Add an upgrade note

## Subject

<!-- Describe your Pull Request content here -->
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/build/
/vendor/
/.php_cs.cache
/composer.lock
.phpunit.result.cache
67 changes: 67 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

/*
* This file is part of the ekino/tiny-png-sonata-media-bundle project.
*
* (c) Ekino
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

$header = <<<EOF
This file is part of the ekino/tiny-png-sonata-media-bundle project.
(c) Ekino
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'declare_strict_types' => true,
'header_comment' => ['header' => $header],
'indentation_type' => true,
'linebreak_after_opening_tag' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'method_separation' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'no_alias_functions' => true,
'no_closing_tag' => true,
'no_extra_consecutive_blank_lines' => [
'tokens' => [
'break',
'continue',
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'throw',
'use',
],
],
'no_short_echo_tag' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'visibility_required' => true,
])
->setUsingCache(true)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
)
;
60 changes: 60 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
branches:
only:
- master

language: php

php:
- '7.1'
- '7.2'
- '7.3'

dist: trusty
sudo: false

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

env:
global:
- TARGET=ci

matrix:
fast_finish: true
include:
- php: '7.3'
env: SYMFONY=3.4.*
- php: '7.3'
env: SYMFONY=^4.2
- php: '7.3'
env: SYMFONY_DEPRECATIONS_HELPER=0
- php: '7.2'
env: SYMFONY=3.4.*
- php: '7.2'
env: SYMFONY=^4.2
- php: '7.2'
env: SYMFONY_DEPRECATIONS_HELPER=0
- php: '7.1'
env: SYMFONY=3.4.*
- php: '7.1'
env: SYMFONY=^4.2
- php: '7.1'
env: SYMFONY_DEPRECATIONS_HELPER=0
allow_failures:
- php: nightly
- php: '7.3'
- env: SYMFONY_DEPRECATIONS_HELPER=0

before_install:
- composer self-update
- if [ -x .travis/before_install_${TARGET}.sh ]; then .travis/before_install_${TARGET}.sh; fi;

install:
- if [ -x .travis/install_${TARGET}.sh ]; then .travis/install_${TARGET}.sh; fi;

script:
- make $TARGET

after_success:
- if [ -x .travis/after_success_${TARGET}.sh ]; then .travis/after_success_${TARGET}.sh; fi;
4 changes: 4 additions & 0 deletions .travis/after_success_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
set -ev

coveralls -v
10 changes: 10 additions & 0 deletions .travis/before_install_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh
set -ev

PHP_INI_DIR="$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/"
TRAVIS_INI_FILE="$PHP_INI_DIR/travis.ini"
echo "memory_limit=3072M" >> "$TRAVIS_INI_FILE"

sed --in-place "s/\"dev-master\":/\"dev-${TRAVIS_COMMIT}\":/" composer.json

if [ "$SYMFONY" != "" ]; then composer require "symfony/symfony:$SYMFONY" --no-update; fi;
6 changes: 6 additions & 0 deletions .travis/check_relevant_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ev

RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.php' '*.yml' '*.xml' '*.twig' '*.js' '*.css' '*.json')

if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi;
16 changes: 16 additions & 0 deletions .travis/install_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env sh
set -ev

mkdir --parents "${HOME}/bin"

# Coveralls client install
wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar --output-document="${HOME}/bin/coveralls"
chmod u+x "${HOME}/bin/coveralls"

# To be removed when these issues are resolved:
# https://github.com/composer/composer/issues/5355
if [ "${COMPOSER_FLAGS}" = '--prefer-lowest' ]; then
composer update --prefer-dist --no-interaction --prefer-stable --quiet
fi

composer update --prefer-dist --no-interaction --prefer-stable ${COMPOSER_FLAGS}
7 changes: 7 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: default

rules:
document-start: disable
line-length:
max: 120
level: warning
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CHANGELOG
=========

master
------

19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) ekino

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.PHONY: app-composer-validate app-cs-check app-cs-fix app-install app-security-check app-static-analysis app-test \
app-test-with-code-coverage ci

default: help

help:
@grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | sort | awk '{split($$0, a, ":"); printf "\033[36m%-30s\033[0m %-30s %s\n", a[1], a[2], a[3]}'

app-composer-validate: ## to validate composer config
composer validate

app-cs-check: ## to show files that need to be fixed
vendor/bin/php-cs-fixer fix --dry-run --diff --verbose

app-cs-fix: ## to fix files that need to be fixed
vendor/bin/php-cs-fixer fix --verbose

app-install: ## to install app
composer install --prefer-dist

app-security-check: ## to check if any security issues in the PHP dependencies
vendor/bin/security-checker security:check

app-static-analysis: ## to run static analysis
php -dmemory_limit=-1 vendor/bin/phpstan analyze . -l 5

app-test: ## to run unit tests
vendor/bin/phpunit

app-test-with-code-coverage: ## to run unit tests with code-coverage
vendor/bin/phpunit --coverage-text --colors=never

ci: ## to run checks during ci
make app-composer-validate app-test-with-code-coverage app-static-analysis app-cs-check app-security-check
Loading

0 comments on commit f37c137

Please sign in to comment.