From 5dea22e116e82a6472c95eb0db0454169f971eff Mon Sep 17 00:00:00 2001 From: Bertrand Marron Date: Tue, 6 Mar 2018 01:23:14 +0100 Subject: [PATCH] Add CircleCI build (#39) * Run phpunit on circleci * Update phpro/grumphp to ^0.14 Also update erusev/parsedown to ^1.7 as ^1.6 had a XSS vulnerability (see https://github.com/erusev/parsedown/pull/495). This allows dependencies to be installed successfully on CircleCI. * Disable all library hooks besides curl for tests --- .circleci/config.yml | 77 ++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + composer.json | 4 +-- composer.lock | 73 ++++++++++++++++++++++------------------- tests/bootstrap.php | 1 + 5 files changed, 120 insertions(+), 36 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..60dcbd3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,77 @@ +version: 2 + +defaults: + workspace_root: &workspace_root + ~/BuildSize + + php_container: &php_container + working_directory: *workspace_root + docker: + - image: circleci/php:7.2 + + attach_workspace: &attach_workspace + attach_workspace: + at: *workspace_root + + restore_composer: &restore_composer + restore_cache: + name: Restore composer cache + keys: + - v1-composer-{{ checksum "composer.lock" }} + - v1-composer- + +jobs: + checkout: + <<: *php_container + steps: + - checkout + + - persist_to_workspace: + root: *workspace_root + paths: + - ./ + + composer: + <<: *php_container + steps: + - *attach_workspace + - *restore_composer + + - run: + name: Install dependencies + command: composer install --no-interaction + + - save_cache: + name: Save composer cache + key: v1-composer-{{ checksum "composer.lock" }} + paths: + - vendor + + test: + <<: *php_container + steps: + - *attach_workspace + - *restore_composer + + - run: + name: Run PHP tests + command: ./vendor/bin/phpunit --log-junit reports/phpunit/junit.xml + + - store_test_results: + path: reports/phpunit + + +workflows: + version: 2 + + push: + jobs: + - checkout + + - composer: + requires: + - checkout + + - test: + requires: + - composer diff --git a/.gitignore b/.gitignore index 5c8006f..17c9906 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /public/storage /storage/*.key /vendor +/reports /.idea /.vagrant Homestead.json diff --git a/composer.json b/composer.json index 23f875d..e7dd0e3 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require": { "php": ">=7.0.0", "doctrine/dbal": "^2.6", - "erusev/parsedown": "^1.6", + "erusev/parsedown": "^1.7", "fideloper/proxy": "~3.3", "firebase/php-jwt": "^5.0", "graham-campbell/github": "^6.0", @@ -27,7 +27,7 @@ "mockery/mockery": "0.9.*", "php-vcr/php-vcr": "^1.3", "php-vcr/phpunit-testlistener-vcr": "^3.0", - "phpro/grumphp": "^0.12.0", + "phpro/grumphp": "^0.14.0", "phpunit/phpunit": "6.2", "sebastian/phpcpd": "^3.0", "sensiolabs/security-checker": "^4.1" diff --git a/composer.lock b/composer.lock index 9f48f50..164bfeb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "d9befea38cfb4373e1a2dcf3469bb84d", + "content-hash": "2cf36f05d819f6e490b54703054e38e6", "packages": [ { "name": "clue/stream-filter", @@ -626,21 +626,24 @@ }, { "name": "erusev/parsedown", - "version": "1.6.3", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d" + "reference": "6678d59be48c4be64eaca6ce70bea48a09488cc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/728952b90a333b5c6f77f06ea9422b94b585878d", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/6678d59be48c4be64eaca6ce70bea48a09488cc2", + "reference": "6678d59be48c4be64eaca6ce70bea48a09488cc2", "shasum": "" }, "require": { "php": ">=5.3.0" }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, "type": "library", "autoload": { "psr-0": { @@ -664,7 +667,7 @@ "markdown", "parser" ], - "time": "2017-05-14T14:47:48+00:00" + "time": "2018-02-28T11:41:37+00:00" }, { "name": "fideloper/proxy", @@ -4474,22 +4477,24 @@ }, { "name": "gitonomy/gitlib", - "version": "v1.0.2", + "version": "v1.0.3", "source": { "type": "git", "url": "https://github.com/gitonomy/gitlib.git", - "reference": "b4b916423a2e2da631cf3b3787beb9386a7b253c" + "reference": "1c2b0605115786613cb517798046c8ab57c17097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/gitonomy/gitlib/zipball/b4b916423a2e2da631cf3b3787beb9386a7b253c", - "reference": "b4b916423a2e2da631cf3b3787beb9386a7b253c", + "url": "https://api.github.com/repos/gitonomy/gitlib/zipball/1c2b0605115786613cb517798046c8ab57c17097", + "reference": "1c2b0605115786613cb517798046c8ab57c17097", "shasum": "" }, "require": { - "symfony/process": "^2.3|^3.0" + "php": "^5.3 || ^7.0", + "symfony/process": "^2.3|^3.0|^4.0" }, "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.7", "psr/log": "^1.0" }, "suggest": { @@ -4524,7 +4529,7 @@ ], "description": "Library for accessing git", "homepage": "http://gitonomy.com", - "time": "2016-05-11T08:25:40+00:00" + "time": "2018-01-10T11:34:47+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -5250,37 +5255,35 @@ }, { "name": "phpro/grumphp", - "version": "v0.12.0", + "version": "v0.14.0", "source": { "type": "git", "url": "https://github.com/phpro/grumphp.git", - "reference": "a6a3e9227a7a039d242b810d005d2ae9adc96cd6" + "reference": "fc4eda385f04d95652f58dd9a6b4f2bc16f560b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpro/grumphp/zipball/a6a3e9227a7a039d242b810d005d2ae9adc96cd6", - "reference": "a6a3e9227a7a039d242b810d005d2ae9adc96cd6", + "url": "https://api.github.com/repos/phpro/grumphp/zipball/fc4eda385f04d95652f58dd9a6b4f2bc16f560b0", + "reference": "fc4eda385f04d95652f58dd9a6b4f2bc16f560b0", "shasum": "" }, "require": { "composer-plugin-api": "~1.0", "composer/composer": "^1.0", "doctrine/collections": "~1.2", - "gitonomy/gitlib": "~1.0", + "gitonomy/gitlib": "^1.0.3", "monolog/monolog": "~1.16", - "ocramius/proxy-manager": "~0.4|~1.0|~2.0", "php": ">=5.6.0", "seld/jsonlint": "~1.1", - "symfony/config": "~2.7|~3.0", - "symfony/console": "~2.7|~3.0", - "symfony/dependency-injection": "~2.7|~3.0", - "symfony/event-dispatcher": "~2.7|~3.0", - "symfony/filesystem": "~2.7|~3.0", - "symfony/finder": "~2.7|~3.0", - "symfony/options-resolver": "~2.7|~3.0", - "symfony/process": "~2.7|~3.0", - "symfony/proxy-manager-bridge": "~2.7|~3.0", - "symfony/yaml": "~2.7|~3.0" + "symfony/config": "~2.7|~3.0|~4.0", + "symfony/console": "~2.7|~3.0|~4.0", + "symfony/dependency-injection": "~2.7|~3.0|~4.0", + "symfony/event-dispatcher": "~2.7|~3.0|~4.0", + "symfony/filesystem": "~2.7|~3.0|~4.0", + "symfony/finder": "~2.7|~3.0|~4.0", + "symfony/options-resolver": "~2.7|~3.0|~4.0", + "symfony/process": "~2.7|~3.0|~4.0", + "symfony/yaml": "~2.7|~3.0|~4.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "~1|~2", @@ -5288,9 +5291,9 @@ "nikic/php-parser": "~2.1", "phpspec/phpspec": "^3.2.2", "phpspec/prophecy": "^1.6.2", - "phpunit/phpunit": "^4.8.31", + "phpunit/phpunit": "^5.7.27|^6.4.4", "sebastian/comparator": "^1.2.4", - "sensiolabs/security-checker": "^3.0", + "sensiolabs/security-checker": "^4.0", "squizlabs/php_codesniffer": "~2.4" }, "suggest": { @@ -5301,15 +5304,17 @@ "doctrine/orm": "Lets GrumPHP validate your Doctrine mapping files.", "etsy/phan": "Lets GrumPHP unleash a static analyzer on your code", "friendsofphp/php-cs-fixer": "Lets GrumPHP automatically fix your codestyle.", + "infection/infection": "Lets GrumPHP evaluate the quality your unit tests", "jakub-onderka/php-parallel-lint": "Lets GrumPHP quickly lint your entire code base.", + "maglnet/composer-require-checker": "Lets GrumPHP analyze composer dependencies.", "malukenho/kawaii-gherkin": "Lets GrumPHP lint your Gherkin files.", "nikic/php-parser": "Lets GrumPHP run static analyses through your PHP files.", "phing/phing": "Lets GrumPHP run your automated PHP tasks.", "phpmd/phpmd": "Lets GrumPHP sort out the mess in your code", - "phpmnd/phpmnd": "Lets GrumPHP help you detect magic numbers in PHP code.", "phpspec/phpspec": "Lets GrumPHP spec your code.", "phpstan/phpstan": "Lets GrumPHP discover bugs in your code without running it.", "phpunit/phpunit": "Lets GrumPHP run your unit tests.", + "povils/phpmnd": "Lets GrumPHP help you detect magic numbers in PHP code.", "roave/security-advisories": "Lets GrumPHP be sure that there are no known security issues.", "sebastian/phpcpd": "Lets GrumPHP find duplicated code.", "sensiolabs/security-checker": "Lets GrumPHP be sure that there are no known security issues.", @@ -5338,12 +5343,12 @@ "email": "toon.verwerft@phpro.be" }, { - "name": "Alexander Deruwe", - "email": "alexander.deruwe@phpro.be" + "name": "Community", + "homepage": "https://github.com/phpro/grumphp/graphs/contributors" } ], "description": "A composer plugin that enables source code quality checks.", - "time": "2017-09-01T06:14:18+00:00" + "time": "2018-02-23T10:08:43+00:00" }, { "name": "phpspec/prophecy", diff --git a/tests/bootstrap.php b/tests/bootstrap.php index a9e1435..5a0a64b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,7 @@ enableLibraryHooks(array('curl')); \VCR\VCR::turnOn(); \VCR\VCR::configure() ->setCassettePath(__DIR__ . '/fixtures/http/')