Skip to content

Commit

Permalink
Bare basic setup
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Jan 29, 2016
1 parent f44ad2a commit de03072
Show file tree
Hide file tree
Showing 13 changed files with 1,630 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .dunitconfig
@@ -0,0 +1,13 @@
// the list of docker images to run against
images="vectorface/hhvm";


// a flag indicating whether to run the syntax check
checkSyntax="true";
// the syntax command to execute
syntaxCommand="find /opt/source -type f -name \"*.php\" ! -path \"*/vendor/*\" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v 'No syntax errors'"

// a flag indicating whether to run the phpunit test suite
runTests="true";
// the phpunit command to execute
unitTestsCommand="/opt/source/vendor/bin/phpunit"
8 changes: 8 additions & 0 deletions .gitattributes
@@ -0,0 +1,8 @@
# Ignoring files for distribution archieves
examples/ export-ignore
tests/ export-ignore
.travis.yml export-ignore
.gitignore export-ignore
.gitattributes export-ignore
.scrutinizer.yml export-ignore
phpunit.xml.dist export-ignore
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
composer.phar
vendor/

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
68 changes: 68 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,68 @@
filter:
paths: [src/*]
excluded_paths: [examples/*, tests/*]
tools:
external_code_coverage: true
php_analyzer: true
php_hhvm: true
php_sim: true
php_pdepend: true
sensiolabs_security_checker: true
php_changetracking: true
php_code_sniffer:
enabled: true
config:
tab_width: 0
encoding: utf8
ruleset: ~
standard: "PSR2"
php_cs_fixer:
enabled: true
config:
level: psr2
php_mess_detector:
enabled: true
config:
ruleset: ~
code_size_rules:
cyclomatic_complexity: true
npath_complexity: true
excessive_method_length: true
excessive_class_length: true
excessive_parameter_list: true
excessive_public_count: true
too_many_fields: true
too_many_methods: true
excessive_class_complexity: true
design_rules:
exit_expression: true
eval_expression: true
goto_statement: true
number_of_class_children: true
depth_of_inheritance: true
coupling_between_objects: true
unused_code_rules:
unused_private_field: true
unused_local_variable: true
unused_private_method: true
unused_formal_parameter: true
naming_rules:
short_variable:
minimum: 3
long_variable:
maximum: 20
short_method:
minimum: 3
constructor_conflict: true
constant_naming: true
boolean_method_name: true
controversial_rules:
superglobals: true
camel_case_class_name: true
camel_case_property_name: true
camel_case_method_name: true
camel_case_parameter_name: true
camel_case_variable_name: true
checks:
php:
code_rating: true
48 changes: 48 additions & 0 deletions .travis.yml
@@ -0,0 +1,48 @@
language: php
sudo: false

## Cache composer bits
cache:
directories:
- vendor
- $HOME/.composer/cache

## PHP versions we test against
php:
- 7
- hhvm

## Build matrix for lowest and highest possible targets
matrix:
include:
- php: 7
env: dependencies=lowest
- php: hhvm
env: dependencies=lowest
- php: 7
env: dependencies=highest
- php: hhvm
env: dependencies=highest

## Update composer and run the appropriate composer command
before_script:
- composer self-update
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
- if [ -z "$dependencies" ]; then composer install; fi;
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest -n; fi;
- if [ "$dependencies" = "highest" ]; then composer update -n; fi;
- composer show -i

## Run the actual test
script: make travis

## Gather coverage and set it to coverage servers
after_script: make travis-coverage

notifications:
webhooks:
urls:
- http://wyrihaximus.net/wyri_projects/wyri_projects/webhook/travisci.json
on_success: always
on_failure: always
on_start: true
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,42 @@
# Contributing

Pull requests are highly appreciated. Here's a quick guide.

Fork, then clone the repo:

git clone git@github.com:your-username/php-travis-client.git

Set up your machine:

composer install

Make sure the tests pass:

make unit

Make sure the tests pass on all supported PHP versions (requires docker):

make dunit

Make your change. Add tests for your change. Make the tests pass:

make dunit && make unit

Before committing and submitting your pull request make sure it passes PSR2 coding style, unit tests pass and pass on all supported PHP versions:

make contrib

Push to your fork and [submit a pull request][pr].

[pr]: https://help.github.com/articles/creating-a-pull-request/

At this point you're waiting on me. I like to at least comment on pull requests
within a day or two. I may suggest some changes or improvements or alternatives.

Some things that will increase the chance that your pull request is accepted:

* Write tests.
* Follow PSR2 (travis will also check for this).
* Write a [good commit message][commit].

[commit]: http://chris.beams.io/posts/git-commit/
21 changes: 21 additions & 0 deletions Makefile
@@ -0,0 +1,21 @@
all: cs dunit unit
travis: cs unit-travis
contrib: cs dunit unit

init:
if [ ! -d vendor ]; then composer install; fi;

cs: init
./vendor/bin/phpcs --standard=PSR2 src/

unit: init
./vendor/bin/phpunit

unit-travis: init
./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml

dunit: init
./vendor/bin/dunit

travis-coverage: init
if [ -f ./build/logs/clover.xml ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
24 changes: 24 additions & 0 deletions README.md
@@ -1,2 +1,26 @@
# php-travis-client
TravisCI API Client

# License

The MIT License (MIT)

Copyright (c) 2016 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions composer.json
@@ -0,0 +1,28 @@
{
"name": "wyrihaximus/travis-client",
"license": "MIT",
"authors": [
{
"name": "Cees-Jan Kiewiet",
"email": "ceesjank@gmail.com"
}
],
"require": {
"php": "^7.0",
"guzzlehttp/guzzle": "^5.0|^6.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0",
"vectorface/dunit": "~2.0"
},
"autoload": {
"psr-4": {
"WyriHaximus\\Travis\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"WyriHaximus\\Tests\\Travis\\": "tests/"
}
}
}

0 comments on commit de03072

Please sign in to comment.