Sonata CI пре 9 година
родитељ
комит
f3a30f8d9e

+ 13 - 0
.travis.yml

@@ -2,6 +2,11 @@
 #
 # It's auto-generated by sonata-project/dev-kit package.
 
+branches:
+  only:
+    - master
+    - 3.x
+
 language: php
 
 php:
@@ -24,12 +29,15 @@ env:
     - PATH="$HOME/.local/bin:$PATH"
     - SYMFONY_DEPRECATIONS_HELPER=weak
     - TARGET=test
+    - UPSTREAM_URL=https://github.com/sonata-project/SonataAdminBundle.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'
@@ -40,6 +48,8 @@ matrix:
       env: SYMFONY=2.8.*
     - php: '7.0'
       env: SYMFONY=3.0.*
+    - php: '7.0'
+      env: SYMFONY=3.1.*
     - php: '7.0'
       env: SYMFONY=dev-master@dev
     - php: '7.0'
@@ -61,6 +71,9 @@ matrix:
     - env: SONATA_BLOCK=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:

+ 6 - 0
.travis/check_relevant_docs.sh

@@ -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 - 0
.travis/check_relevant_lint.sh

@@ -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 - 0
.travis/check_relevant_test.sh

@@ -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 - 0
.travis/install_lint.sh

@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+set -ev
+
+composer global require sllh/composer-lint:@stable --prefer-dist --no-interaction

+ 29 - 2
CONTRIBUTING.md

@@ -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,
@@ -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.

+ 3 - 0
Makefile

@@ -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