Bläddra i källkod

2.4 Travis and CS backport

Sullivan SENECHAL 9 år sedan
förälder
incheckning
3504156852
5 ändrade filer med 96 tillägg och 18 borttagningar
  1. 2 0
      .gitignore
  2. 32 0
      .php_cs
  3. 52 15
      .travis.yml
  4. 6 0
      Makefile
  5. 4 3
      composer.json

+ 2 - 0
.gitignore

@@ -2,10 +2,12 @@ build
 phpunit.xml
 Resources/doc/_build/*
 nbproject
+.idea
 coverage
 composer.lock
 /vendor
 composer.phar
+.php_cs.cache
 
 # clean up some non bower ready package
 Resources/public/vendor/AdminLTE/ajax

+ 32 - 0
.php_cs

@@ -0,0 +1,32 @@
+<?php
+
+$header = <<<EOF
+This file is part of the Sonata Project package.
+
+(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
+
+For the full copyright and license information, please view the LICENSE
+file that was distributed with this source code.
+EOF;
+
+Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
+
+$finder = Symfony\CS\Finder\DefaultFinder::create()
+    ->in(array(__DIR__))
+    ->exclude(array('Tests/Fixtures'))
+;
+
+return Symfony\CS\Config\Config::create()
+    ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
+    ->fixers(array(
+        'header_comment',
+        '-unalign_double_arrow',
+        '-unalign_equals',
+        'align_double_arrow',
+        'newline_after_open_tag',
+        'ordered_use',
+        'long_array_syntax',
+    ))
+    ->setUsingCache(true)
+    ->finder($finder)
+;

+ 52 - 15
.travis.yml

@@ -5,26 +5,63 @@ php:
   - 5.4
   - 5.5
   - 5.6
+  - 7.0
   - hhvm
 
-env:
-  - SYMFONY_VERSION=2.3.*
-  - SYMFONY_VERSION=2.4.*
-  - SYMFONY_VERSION=2.5.*
-  - SYMFONY_VERSION=2.6.*
-  - SYMFONY_VERSION=2.7.*@dev
-
-before_script:
-  - composer require symfony/symfony:${SYMFONY_VERSION} --no-update
-  - composer install --dev --prefer-source
-  - sudo pip install -r Resources/doc/requirements.txt
+sudo: false
 
-script: make test
+cache:
+  directories:
+    - $HOME/.composer/cache
+    - $HOME/.cache/pip
 
-notifications:
-    webhooks: http://sonata-project.org/bundles/admin/master/travis
+env:
+  global:
+    - PATH="$HOME/.composer/vendor/bin:$PATH"
+    - SYMFONY_DEPRECATIONS_HELPER=weak
 
 matrix:
+  fast_finish: true
+  include:
+    - php: 5.6
+      env: CS_FIXER=run
+    - php: 5.3
+      env: COMPOSER_FLAGS="--prefer-lowest"
+    - php: 5.6
+      env: SYMFONY_VERSION=2.3.*
+    - php: 5.6
+      env: SYMFONY_VERSION=2.4.*
+    - php: 5.6
+      env: SYMFONY_VERSION=2.5.*
+    - php: 5.6
+      env: SYMFONY_VERSION=2.6.*
+    - php: 5.6
+      env: SYMFONY_VERSION=2.7.*
+    - php: 5.6
+      env: SYMFONY_VERSION=2.8.*@dev
+    - php: 5.6
+      env: SYMFONY_VERSION="3.0.x-dev as 2.8"
   allow_failures:
+    - php: 7.0
     - php: hhvm
-    - env: SYMFONY_VERSION=2.7.*@dev
+    - env: SYMFONY_VERSION=2.8.*@dev
+    - env: SYMFONY_VERSION="3.0.x-dev as 2.8"
+
+before_script:
+  - mkdir -p ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d && echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
+  - composer selfupdate
+  - composer config -q -g github-oauth.github.com $GITHUB_OAUTH_TOKEN
+  - composer global require phpunit/phpunit fabpot/php-cs-fixer --no-update
+  - composer global update --prefer-dist --no-interaction
+  - if [ "$SYMFONY_VERSION" = "2.8.*@dev" ] || [ "$SYMFONY_VERSION" = "3.0.x-dev as 2.8" ]; then SYMFONY_DEPRECATIONS_HELPER=strict; fi;
+  - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
+  - travis_wait composer update --prefer-dist --no-interaction $COMPOSER_FLAGS
+  - export PATH=$HOME/.local/bin:$PATH
+  - pip install -r Resources/doc/requirements.txt --user `whoami`
+
+script:
+ - if [ "$CS_FIXER" = "run" ]; then make cs_dry_run ; fi;
+ - make test
+
+notifications:
+  webhooks: https://sonata-project.org/bundles/admin/master/travis

+ 6 - 0
Makefile

@@ -1,3 +1,9 @@
+cs:
+	php-cs-fixer fix --verbose
+
+cs_dry_run:
+	php-cs-fixer fix --verbose --dry-run
+
 test:
 	phpunit
 	cd Resources/doc && sphinx-build -W -b html -d _build/doctrees . _build/html

+ 4 - 3
composer.json

@@ -3,13 +3,13 @@
     "type": "symfony-bundle",
     "description": "Symfony SonataAdminBundle",
     "keywords": ["Admin Generator", "admin", "sonata", "bootstrap"],
-    "homepage": "http://sonata-project.org/bundles/admin",
+    "homepage": "https://sonata-project.org/bundles/admin",
     "license": "MIT",
     "authors": [
         {
             "name": "Thomas Rabaix",
             "email": "thomas.rabaix@sonata-project.org",
-            "homepage": "http://sonata-project.org"
+            "homepage": "https://sonata-project.org"
         },
         {
             "name": "Sonata Community",
@@ -40,7 +40,8 @@
     "require-dev": {
         "jms/translation-bundle": "~1.1",
         "symfony/yaml": "~2.3",
-        "sonata-project/intl-bundle": "~2.1"
+        "sonata-project/intl-bundle": "~2.1",
+        "symfony/phpunit-bridge": "~2.7|~3.0"
     },
     "suggest": {
         "jms/translation-bundle": "Extract message keys from Admins",