Created
March 23, 2018 22:06
-
-
Save tuantranf/926c5caae8afd79e0e439aa279221692 to your computer and use it in GitHub Desktop.
Nice setup for testing using Circle CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine: | |
php: | |
version: 7.1.3 | |
dependencies: | |
pre: | |
- mkdir -p ~/.composer/cache | |
- mkdir -p ~/.php-cs-fixer | |
- echo "memory_limit = 256M" > /opt/circleci/php/$(phpenv global)/etc/conf.d/memory.ini | |
override: | |
- composer install --prefer-dist --optimize-autoloader --no-interaction --no-scripts | |
- vendor/bin/php-cs-fixer fix --config=.php_cs.dist --cache-file ~/.php-cs-fixer/.php_cs.cache --diff --verbose | |
cache_directories: | |
- ~/.composer/cache | |
- ~/.php-cs-fixer | |
test: | |
override: | |
- mkdir -p $CIRCLE_TEST_REPORTS/phpunit | |
- vendor/bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit.xml | |
- mkdir -p $CIRCLE_TEST_REPORTS/behat | |
- vendor/bin/behat --out $CIRCLE_TEST_REPORTS/behat/test.log | |
post: | |
- FILES_WITHOUT_LF_AT_EOF=$(for file in $(git grep --cached -Il ''); do test $(tail -c 1 $file) && echo $file; done); if [[ -n $FILES_WITHOUT_LF_AT_EOF ]]; then echo -e "Some files have missing LF at EOF:\n$FILES_WITHOUT_LF_AT_EOF" && exit 1; fi; | |
- FILES_WITH_TRAILING_WHITESPACES=$(git grep --cached -Il " $"); if [[ $FILES_WITH_TRAILING_WHITESPACES ]]; then echo -e "Some files have trailing whitespaces at line endings:\n$FILES_WITH_TRAILING_WHITESPACES" && exit 1; fi; | |
- vendor/bin/phpmd src/ text phpmd.xml.dist --ignore-violations-on-exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="My project PHPMD rule set" | |
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> | |
My project rule set | |
</description> | |
<!-- Import the entire cyclomatic complexity rule --> | |
<rule ref="rulesets/controversial.xml/Superglobals" /> | |
<rule ref="rulesets/design.xml/ExitExpression" /> | |
<rule ref="rulesets/design.xml/EvalExpression" /> | |
<rule ref="rulesets/design.xml/GotoStatement" /> | |
<rule ref="rulesets/naming.xml/ConstantNamingConventions" /> | |
<rule ref="rulesets/unusedcode.xml" /> | |
</ruleset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" | |
backupGlobals="false" | |
backupStaticAttributes="false" | |
colors="true" | |
convertErrorsToExceptions="true" | |
convertNoticesToExceptions="true" | |
convertWarningsToExceptions="true" | |
processIsolation="false" | |
stopOnFailure="false" | |
syntaxCheck="false" | |
bootstrap="vendor/autoload.php" | |
> | |
<php> | |
<ini name="error_reporting" value="-1" /> | |
</php> | |
<testsuites> | |
<testsuite name="My project test suite"> | |
<directory>./tests</directory> | |
</testsuite> | |
</testsuites> | |
<filter> | |
<whitelist> | |
<directory>src</directory> | |
</whitelist> | |
</filter> | |
</phpunit> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment