Skip to content

Commit

Permalink
Merge pull request #10 from Clivern/feature/ci
Browse files Browse the repository at this point in the history
Feature/ci
  • Loading branch information
Clivern authored Feb 25, 2019
2 parents 5194042 + 2491a21 commit 59ff254
Show file tree
Hide file tree
Showing 53 changed files with 2,531 additions and 1,157 deletions.
23 changes: 23 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php">
<php>
<ini name="error_reporting" value="-1" />
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/vendor
.phpintel/
coverage.clover
build/
index.php
.env
.php_cs.cache
build
39 changes: 39 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
$fileHeaderComment = <<<COMMENT
This file is part of the Imap PHP package.
(c) Clivern <[email protected]>
COMMENT;
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('var')
;
return PhpCsFixer\Config::create()
->setIndent(" ")
->setLineEnding("\n")
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'],
'linebreak_after_opening_tag' => true,
'mb_str_functions' => true,
'no_php4_constructor' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
'phpdoc_add_missing_param_annotation' => true,
'ordered_class_elements'=> true,
'phpdoc_types_order' => true,
'logical_operators' => true,
])
->setFinder($finder)
->setCacheFile(__DIR__.'/.php_cs.cache')
;
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: php
dist: precise

php:
- 5.6
Expand All @@ -16,4 +15,4 @@ before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist

script:
- vendor/bin/phpunit --bootstrap vendor/autoload.php --coverage-text --coverage-clover=coverage.clover
- make ci
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 A. F
Copyright (c) 2017 Cliven

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
COMPOSER ?= composer
PHPUNIT_OPTS =


composer:
$(COMPOSER) install


fix:
./vendor/bin/php-cs-fixer fix


fix-diff:
./vendor/bin/php-cs-fixer fix --diff --dry-run -v


test: composer
vendor/bin/phpunit -c .


lint: lint-php phpcs php-cs lint-composer lint-eol
@echo All good.


lint-eol:
@echo "\n==> Validating unix style line endings of files:files"
@! grep -lIUr --color '^M' src/ composer.json composer.lock || ( echo '[ERROR] Above files have CRLF line endings' && exit 1 )
@echo All files have valid line endings


lint-composer:
@echo "\n==> Validating composer.json and composer.lock:"
$(COMPOSER) validate --strict


lint-php:
@echo "\n==> Validating all php files:"
@find src tests -type f -name \*.php | while read file; do php -l "$$file" || exit 1; done


phpcs:
vendor/bin/phpcs


php-cs:
vendor/bin/php-cs-fixer fix --diff --dry-run -v


coverage: composer
vendor/bin/phpunit -c .


ci: composer lint test
@echo "All quality checks passed"


.PHONY: test composer coverage phpcs php-cs lint lint-php ci
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Imap
====
:mailbox_with_mail: Access Mailbox Using PHP IMAP.

*Current Version: 1.0.4*
*Current Version: 1.0.5*

[![Build Status](https://travis-ci.org/Clivern/Imap.svg?branch=master)](https://travis-ci.org/Clivern/Imap)

Expand Down Expand Up @@ -265,6 +265,12 @@ Misc

Changelog
---------
Version 1.0.5:
```
Enhance code style.
Automate code fixes and linting.
```

Version 1.0.4:
```
Fix for plain text messages.
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "Access Mailbox Using PHP IMAP",
"keywords": ["clivern", "imap"],
"license": "MIT",
"type": "project",
"homepage": "https://github.com/clivern/imap",
"authors": [
{
Expand All @@ -17,7 +16,9 @@
"php": ">=5.6.4"
},
"require-dev": {
"phpunit/phpunit": "~5.7"
"phpunit/phpunit": "~5.7",
"friendsofphp/php-cs-fixer": "^2.14",
"squizlabs/php_codesniffer": "^3.4"
},
"autoload": {
"psr-4": {
Expand All @@ -32,4 +33,4 @@
"scripts": {
"test": "phpunit"
}
}
}
Loading

0 comments on commit 59ff254

Please sign in to comment.