Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
Merge 8a49573 into 709d941
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Jun 1, 2016
2 parents 709d941 + 8a49573 commit 894e81a
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ env:
- PATH="$HOME/.local/bin:$PATH"
- SYMFONY_DEPRECATIONS_HELPER=weak
- TARGET=test
- UPSTREAM_URL=https://github.com/sonata-project/SonataCacheBundle.git

matrix:
fast_finish: true
include:
- php: '7.0'
env: TARGET=docs
- php: '7.0'
env: TARGET=lint
- php: '5.3'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.0'
Expand All @@ -58,6 +61,9 @@ matrix:
- env: SYMFONY=dev-master@dev

before_install:
- git remote add upstream ${UPSTREAM_URL} && git fetch --all
- if [[ -x .travis/check_relevant_${TARGET}.sh && "$TRAVIS_PULL_REQUEST" != "false" ]]; then export RELEVANT=$(.travis/check_relevant_${TARGET}.sh); fi;
- if [[ ! -z ${RELEVANT} ]];then exit 0; fi;
- if [ -x .travis/before_install_${TARGET}.sh ]; then .travis/before_install_${TARGET}.sh; fi;

install:
Expand Down
6 changes: 6 additions & 0 deletions .travis/check_relevant_docs.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} -- '*.rst')

if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi;
6 changes: 6 additions & 0 deletions .travis/check_relevant_lint.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} -- *.{json})

if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi;
6 changes: 6 additions & 0 deletions .travis/check_relevant_test.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;
4 changes: 4 additions & 0 deletions .travis/install_lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
set -ev

composer global require sllh/composer-lint:@stable --prefer-dist --no-interaction
31 changes: 29 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ All the sonata team will be glad to review your code changes propositions! :smil

But please, read the following before.

### Coding style
### The content

#### Coding style

Each project follows [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/)
and [Symfony Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html) for coding style,
Expand All @@ -64,9 +66,34 @@ and run this command before committing your modifications:
php-cs-fixer fix --verbose
```

#### The documentation

The documentation is mostly written with the `rst` format. You can test the doc rendering with the `make docs` command.

If your PR contains a new feature, you must add documentation for it.

#### The tests

If your PR contains a fix, tests should be added to prove the bug.

If your PR contains an addition, a new feature, this one has to be fully covered by tests.

Some rules have to be respected about the test:

* Annotations about coverage are prohibited. This concerns:
* `@covers`
* `@coversDefaultClass`
* `@coversNothing`
* `@codeCoverageIgnore`
* `@codeCoverageIgnoreStart`
* `codeCoverageIgnoreEnd`
* All test methods should be prefixed by `test`. Example: `public function testItReturnsNull()`.
* As opposed, the `@test` annotation is prohibited.
* Most of the time, the test class should have the same name as the targeted class, suffixed by `Test`.

### Writing a Pull Request

#### The content
#### The subject

Ideally, a Pull Request should concern one and **only one** subject, so that it
remains clear, and independent changes can be merged quickly.
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
all:
@echo "Please choose a task."

lint:
composer validate

test:
phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml

Expand Down

0 comments on commit 894e81a

Please sign in to comment.