Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run travis on application #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
dist: xenial

language: php

branches:
only:
- master
- /^\d+\.\d+$/

php:
- 7.1.26

env:
- COMPOSER=travis.json

cache:
directories:
- $HOME/.composer

before_script:
- phpenv config-rm xdebug.ini
- phpenv config-add travis.php.ini
- composer self-update
- cp dev.json travis.json # avoid dev.lock file and composer.json with a stable version
- travis_retry travis_wait composer install --prefer-dist --optimize-autoloader --no-interaction --no-suggest
- set +e; DIFF=$(git diff --name-only --diff-filter=ACMR $TRAVIS_COMMIT_RANGE | grep -e ".*\.php$"); set -e;

script:
- ./bin/phpunit
- ./bin/phpcs ./src -p --encoding=utf-8 --extensions=php --standard=PSR2
- ./bin/php-cs-fixer fix --dry-run --config=./build/.php_cs --path-mode=intersection ./src
- if [[ $DIFF ]]; then ./vendor/bin/phpmd ${DIFF//$'\n'/,} text ./build/phpmd.xml --suffixes php; fi
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
OroPlatform Application
=======================

[![Travis CI build status](https://travis-ci.org/reiser/platform-application.svg?branch=master)](https://https://travis-ci.org/reiser/platform-application)

What is OroPlatform?
--------------------

Expand Down
53 changes: 53 additions & 0 deletions build/.php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php

$finder = PhpCsFixer\Finder::create()
->in([__DIR__.'/../..'])
->notPath('doctrine-extensions')
->files()
->name('*.php')
->notName('*.php.twig')
->notName('OroKernel.php');

// https://github.com/mlocati/php-cs-fixer-configurator
return PhpCsFixer\Config::create()
->setRules(
[
// generic PSRs
'@PSR1' => true,
'@PSR2' => true,
'psr0' => true,
'psr4' => true,

// imports
'ordered_imports' => true,
'no_unused_imports' => true,
'no_extra_consecutive_blank_lines' => ['use'],
'php_unit_namespaced' => ['target' => '6.0'],
'php_unit_expectation' => true,

// Symfony, but exclude Oro cases
// '@Symfony' => true,
// '@Symfony:risky' => true,
// 'yoda_style' => false,

// '@DoctrineAnnotation' => true,
// 'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
// 'array_syntax' => ['syntax' => 'short'],
// 'binary_operator_spaces' => false,
// 'blank_line_before_return' => true,
// 'declare_strict_types' => false,
// 'increment_style' => false,
// 'list_syntax' => ['syntax' => 'short'],
// 'multiline_comment_opening_closing' => false,
// 'space_after_semicolon' => true,
// 'no_empty_statement' => true,
// 'phpdoc_add_missing_param_annotation' => true,
// 'phpdoc_align' => ['tags' => ['param']],
// 'phpdoc_order' => true,
// 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
]
)
->setFinder($finder)
->setRiskyAllowed(true)
->setCacheFile(__DIR__.DIRECTORY_SEPARATOR.'.php_cs.cache');
40 changes: 40 additions & 0 deletions build/phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0"?>
<ruleset name="Custom rule set for Oro Projects"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Custom rule set that is used to check the code of the Oro Projects...
</description>
<rule ref="rulesets/codesize.xml">
<exclude name="CyclomaticComplexity"/>
<exclude name="TooManyMethods"/>
<exclude name="TooManyPublicMethods"/>
<exclude name="TooManyFields"/>
</rule>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<priority>1</priority>
<properties>
<property name="reportLevel" value="15"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyMethods">
<priority>1</priority>
<properties>
<property name="maxmethods" value="50"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
<priority>1</priority>
<properties>
<property name="maxmethods" value="50"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyFields">
<priority>1</priority>
<properties>
<property name="maxfields" value="25"/>
</properties>
</rule>
</ruleset>
1 change: 1 addition & 0 deletions travis.php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
memory_limit = -1