From 23423155a17ad7605d8838b90fc13f845a27c3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 19 Jun 2017 16:28:40 +0200 Subject: [PATCH 1/3] Migrating artifacts download to the Jobs API --- composer.json | 2 +- composer.lock | 416 ++++++++++++++++++++-------------- src/Commands/Config.php | 14 ++ src/Commands/RunCommand.php | 19 +- src/Gitlab/BuildService.php | 8 +- tests/Commands/ConfigTest.php | 35 +++ 6 files changed, 317 insertions(+), 177 deletions(-) diff --git a/composer.json b/composer.json index 58e8110..7004e13 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "m4tthumphrey/php-gitlab-api": "^7.16", + "m4tthumphrey/php-gitlab-api": "dev-feature/jobs_api as 8.0.0", "symfony/console": "^3.0", "mouf/picotainer": "^1.0", "symfony/filesystem": "^3.0", diff --git a/composer.lock b/composer.lock index 89039a4..c414c59 100644 --- a/composer.lock +++ b/composer.lock @@ -4,23 +4,25 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "0c63b1a586b1629a99ca90eb6e0cfa13", - "content-hash": "663df9f800315737d0d51024ad3a5cb0", + "content-hash": "bebad73705730b271085eea03901b3ea", "packages": [ { "name": "container-interop/container-interop", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/container-interop/container-interop.git", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", "shasum": "" }, + "require": { + "psr/container": "^1.0" + }, "type": "library", "autoload": { "psr-4": { @@ -32,20 +34,21 @@ "MIT" ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30 15:22:37" + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" }, { "name": "czproject/git-php", - "version": "v3.8.0", + "version": "v3.9.1", "source": { "type": "git", "url": "https://github.com/czproject/git-php.git", - "reference": "0a643071a97b230d16df9264339dc3a5b51d7f66" + "reference": "f2d29f5255ed4a5bcae5e25dff3505297c58cb66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/czproject/git-php/zipball/0a643071a97b230d16df9264339dc3a5b51d7f66", - "reference": "0a643071a97b230d16df9264339dc3a5b51d7f66", + "url": "https://api.github.com/repos/czproject/git-php/zipball/f2d29f5255ed4a5bcae5e25dff3505297c58cb66", + "reference": "f2d29f5255ed4a5bcae5e25dff3505297c58cb66", "shasum": "" }, "require": { @@ -74,7 +77,7 @@ "keywords": [ "git" ], - "time": "2016-11-18 07:43:41" + "time": "2017-06-02T16:43:43+00:00" }, { "name": "kriswallsmith/buzz", @@ -122,35 +125,45 @@ "curl", "http client" ], - "time": "2015-06-25 17:26:56" + "time": "2015-06-25T17:26:56+00:00" }, { "name": "m4tthumphrey/php-gitlab-api", - "version": "7.16.0", + "version": "dev-feature/jobs_api", "source": { "type": "git", "url": "https://github.com/moufmouf/php-gitlab-api.git", - "reference": "c54645d9e5bfbc1565f38399de81fe5ce3700c8b" + "reference": "50bd325346574cdb844f86d7403acf722a9fdc4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/moufmouf/php-gitlab-api/zipball/c54645d9e5bfbc1565f38399de81fe5ce3700c8b", - "reference": "c54645d9e5bfbc1565f38399de81fe5ce3700c8b", + "url": "https://api.github.com/repos/moufmouf/php-gitlab-api/zipball/50bd325346574cdb844f86d7403acf722a9fdc4f", + "reference": "50bd325346574cdb844f86d7403acf722a9fdc4f", "shasum": "" }, "require": { "ext-curl": "*", "ext-xml": "*", "kriswallsmith/buzz": ">=0.7", - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { "phpunit/phpunit": "~4.5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Gitlab\\": "lib/" + "psr-4": { + "Gitlab\\": "lib/Gitlab/" + } + }, + "autoload-dev": { + "psr-4": { + "Gitlab\\Tests\\": "test/Gitlab/Tests/" } }, "license": [ @@ -178,30 +191,31 @@ "gitlab" ], "support": { - "source": "https://github.com/moufmouf/php-gitlab-api/tree/7.16.0" + "source": "https://github.com/moufmouf/php-gitlab-api/tree/feature/jobs_api" }, - "time": "2017-01-17 18:01:47" + "time": "2017-06-19 13:55:32" }, { "name": "mouf/picotainer", - "version": "v1.0.1", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/thecodingmachine/picotainer.git", - "reference": "e6f0009c7d6b8b7f2bf7639fd0b417f897f8ed48" + "reference": "83737d6af8534c35e0d4cd2f0afd1e2e6c0ad7d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/picotainer/zipball/e6f0009c7d6b8b7f2bf7639fd0b417f897f8ed48", - "reference": "e6f0009c7d6b8b7f2bf7639fd0b417f897f8ed48", + "url": "https://api.github.com/repos/thecodingmachine/picotainer/zipball/83737d6af8534c35e0d4cd2f0afd1e2e6c0ad7d4", + "reference": "83737d6af8534c35e0d4cd2f0afd1e2e6c0ad7d4", "shasum": "" }, "require": { - "container-interop/container-interop": "~1.0" + "container-interop/container-interop": "~1.2", + "psr/container": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~3.7", - "satooshi/php-coveralls": "dev-master" + "phpunit/phpunit": "~4.8", + "satooshi/php-coveralls": "~1.0" }, "type": "library", "autoload": { @@ -227,7 +241,56 @@ "dependency injection", "di" ], - "time": "2015-12-15 16:35:28" + "time": "2017-03-09T09:19:17+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -274,20 +337,20 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "symfony/console", - "version": "v3.2.3", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "7a8405a9fc175f87fed8a3c40856b0d866d61936" + "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/7a8405a9fc175f87fed8a3c40856b0d866d61936", - "reference": "7a8405a9fc175f87fed8a3c40856b0d866d61936", + "url": "https://api.github.com/repos/symfony/console/zipball/70d2a29b2911cbdc91a7e268046c395278238b2e", + "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e", "shasum": "" }, "require": { @@ -295,10 +358,16 @@ "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, "require-dev": { "psr/log": "~1.0", + "symfony/config": "~3.3", + "symfony/dependency-injection": "~3.3", "symfony/event-dispatcher": "~2.8|~3.0", "symfony/filesystem": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { @@ -310,7 +379,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -337,20 +406,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-02-06 12:04:21" + "time": "2017-06-02T19:24:58+00:00" }, { "name": "symfony/debug", - "version": "v3.2.3", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "b4d9818f127c60ce21ed62c395da7df868dc8477" + "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/b4d9818f127c60ce21ed62c395da7df868dc8477", - "reference": "b4d9818f127c60ce21ed62c395da7df868dc8477", + "url": "https://api.github.com/repos/symfony/debug/zipball/e9c50482841ef696e8fa1470d950a79c8921f45d", + "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d", "shasum": "" }, "require": { @@ -361,13 +430,12 @@ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/class-loader": "~2.8|~3.0", "symfony/http-kernel": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -394,20 +462,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-01-28 02:37:08" + "time": "2017-06-01T21:01:25+00:00" }, { "name": "symfony/filesystem", - "version": "v3.2.3", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4" + "reference": "c709670bf64721202ddbe4162846f250735842c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", - "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/c709670bf64721202ddbe4162846f250735842c0", + "reference": "c709670bf64721202ddbe4162846f250735842c0", "shasum": "" }, "require": { @@ -416,7 +484,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -443,20 +511,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-01-08 20:47:33" + "time": "2017-05-28T14:08:56+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + "reference": "f29dca382a6485c3cbe6379f0c61230167681937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937", + "reference": "f29dca382a6485c3cbe6379f0c61230167681937", "shasum": "" }, "require": { @@ -468,7 +536,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -502,7 +570,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-06-09T14:24:12+00:00" } ], "packages-dev": [ @@ -558,7 +626,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "guzzle/guzzle", @@ -654,20 +722,20 @@ "web service" ], "abandoned": "guzzlehttp/guzzle", - "time": "2015-03-18 18:23:50" + "time": "2015-03-18T18:23:50+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", "shasum": "" }, "require": { @@ -696,7 +764,7 @@ "object", "object graph" ], - "time": "2017-01-26 22:05:40" + "time": "2017-04-12T18:52:22+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -750,7 +818,7 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2015-12-27T11:43:31+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -795,7 +863,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30 07:12:33" + "time": "2016-09-30T07:12:33+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -842,31 +910,31 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25 06:54:22" + "time": "2016-11-25T06:54:22+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.6.2", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0", + "phpspec/phpspec": "^2.5|^3.2", "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", @@ -905,39 +973,39 @@ "spy", "stub" ], - "time": "2016-11-21 14:58:47" + "time": "2017-03-02T20:05:34+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.5", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971" + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", - "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", "shasum": "" }, "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "~1.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "~1.0|~2.0" + "sebastian/version": "^1.0 || ^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.4.0", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { @@ -968,7 +1036,7 @@ "testing", "xunit" ], - "time": "2017-01-20 15:06:43" + "time": "2017-04-02T07:44:40+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1015,7 +1083,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -1056,29 +1124,34 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1100,20 +1173,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.9", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -1149,20 +1222,20 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15 14:06:22" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.13", + "version": "5.7.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "60ebeed87a35ea46fd7f7d8029df2d6f013ebb34" + "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/60ebeed87a35ea46fd7f7d8029df2d6f013ebb34", - "reference": "60ebeed87a35ea46fd7f7d8029df2d6f013ebb34", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3cb94a5f8c07a03c8b7527ed7468a2926203f58b", + "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b", "shasum": "" }, "require": { @@ -1180,13 +1253,13 @@ "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "^3.2", "sebastian/comparator": "^1.2.4", - "sebastian/diff": "~1.2", + "sebastian/diff": "^1.4.3", "sebastian/environment": "^1.3.4 || ^2.0", "sebastian/exporter": "~2.0", "sebastian/global-state": "^1.1", "sebastian/object-enumerator": "~2.0", "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", + "sebastian/version": "~1.0.3|~2.0", "symfony/yaml": "~2.1|~3.0" }, "conflict": { @@ -1231,7 +1304,7 @@ "testing", "xunit" ], - "time": "2017-02-10 09:05:10" + "time": "2017-05-22T07:42:55+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1290,7 +1363,7 @@ "mock", "xunit" ], - "time": "2016-12-08 20:27:08" + "time": "2016-12-08T20:27:08+00:00" }, { "name": "satooshi/php-coveralls", @@ -1348,27 +1421,27 @@ "github", "test" ], - "time": "2016-01-20 17:35:46" + "time": "2016-01-20T17:35:46+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1393,7 +1466,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", @@ -1457,27 +1530,27 @@ "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1509,7 +1582,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -1559,7 +1632,7 @@ "environment", "hhvm" ], - "time": "2016-11-26 07:53:53" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", @@ -1626,7 +1699,7 @@ "export", "exporter" ], - "time": "2016-11-19 08:54:04" + "time": "2016-11-19T08:54:04+00:00" }, { "name": "sebastian/global-state", @@ -1677,20 +1750,20 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", "shasum": "" }, "require": { @@ -1723,7 +1796,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19 07:35:10" + "time": "2017-02-18T15:18:39+00:00" }, { "name": "sebastian/recursion-context", @@ -1776,7 +1849,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19 07:33:16" + "time": "2016-11-19T07:33:16+00:00" }, { "name": "sebastian/resource-operations", @@ -1818,7 +1891,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -1861,27 +1934,31 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/config", - "version": "v3.2.3", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "2ffa7b84d647b8be1788d46b44e438cb3d62056c" + "reference": "35716d4904e0506a7a5a9bcf23f854aeb5719bca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/2ffa7b84d647b8be1788d46b44e438cb3d62056c", - "reference": "2ffa7b84d647b8be1788d46b44e438cb3d62056c", + "url": "https://api.github.com/repos/symfony/config/zipball/35716d4904e0506a7a5a9bcf23f854aeb5719bca", + "reference": "35716d4904e0506a7a5a9bcf23f854aeb5719bca", "shasum": "" }, "require": { "php": ">=5.5.9", "symfony/filesystem": "~2.8|~3.0" }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, "require-dev": { + "symfony/dependency-injection": "~3.3", "symfony/yaml": "~3.0" }, "suggest": { @@ -1890,7 +1967,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1917,20 +1994,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-02-06 12:04:21" + "time": "2017-06-02T18:07:20+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.17", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "74877977f90fb9c3e46378d5764217c55f32df34" + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74877977f90fb9c3e46378d5764217c55f32df34", - "reference": "74877977f90fb9c3e46378d5764217c55f32df34", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1377400fd641d7d1935981546aaef780ecd5bf6d", + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d", "shasum": "" }, "require": { @@ -1938,7 +2015,7 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/config": "^2.0.5|~3.0.0", "symfony/dependency-injection": "~2.6|~3.0.0", "symfony/expression-language": "~2.6|~3.0.0", "symfony/stopwatch": "~2.3|~3.0.0" @@ -1977,20 +2054,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:30:24" + "time": "2017-06-02T07:47:27+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.2.3", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "9aa0b51889c01bca474853ef76e9394b02264464" + "reference": "602a15299dc01556013b07167d4f5d3a60e90d15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/9aa0b51889c01bca474853ef76e9394b02264464", - "reference": "9aa0b51889c01bca474853ef76e9394b02264464", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/602a15299dc01556013b07167d4f5d3a60e90d15", + "reference": "602a15299dc01556013b07167d4f5d3a60e90d15", "shasum": "" }, "require": { @@ -1999,7 +2076,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -2026,20 +2103,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:32:22" + "time": "2017-04-12T14:14:56+00:00" }, { "name": "symfony/yaml", - "version": "v3.2.3", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b" + "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e1718c6bf57e1efbb8793ada951584b2ab27775b", - "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9752a30000a8ca9f4b34b5227d15d0101b96b063", + "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063", "shasum": "" }, "require": { @@ -2054,7 +2131,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -2081,7 +2158,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-21 17:06:35" + "time": "2017-06-02T22:05:06+00:00" }, { "name": "webmozart/assert", @@ -2131,12 +2208,21 @@ "check", "validate" ], - "time": "2016-11-23 20:04:58" + "time": "2016-11-23T20:04:58+00:00" + } + ], + "aliases": [ + { + "alias": "8.0.0", + "alias_normalized": "8.0.0.0", + "version": "dev-feature/jobs_api", + "package": "m4tthumphrey/php-gitlab-api" } ], - "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "m4tthumphrey/php-gitlab-api": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], diff --git a/src/Commands/Config.php b/src/Commands/Config.php index b494658..0d3fec8 100644 --- a/src/Commands/Config.php +++ b/src/Commands/Config.php @@ -99,6 +99,20 @@ public function getCommitSha() : string return $commitSha; } + public function getJobStage() : string + { + $commitSha = $this->input->getOption('job-stage'); + + if ($commitSha === null) { + $commitSha = getenv('CI_JOB_STAGE'); + if ($commitSha === false) { + throw new \RuntimeException('Could not find the Gitlab job stage in the "CI_JOB_STAGE" (Gitlab 9+) environment variable (usually set by Gitlab CI). Either set this environment variable or pass the job stage via the --job_stage command line option.'); + } + } + + return $commitSha; + } + public function getGitlabBuildId() : int { $buildId = $this->input->getOption('gitlab-job-id'); diff --git a/src/Commands/RunCommand.php b/src/Commands/RunCommand.php index 2429237..edcd8d3 100644 --- a/src/Commands/RunCommand.php +++ b/src/Commands/RunCommand.php @@ -66,7 +66,12 @@ protected function configure() ->addOption('gitlab-job-id', 'b', InputOption::VALUE_REQUIRED, - 'The Gitlab CI build id. If not specified, it is deduced from the CI_BUILD_ID environment variable.', + 'The Gitlab CI build/job id. If not specified, it is deduced from the CI_BUILD_ID environment variable.', + null) + ->addOption('job-stage', + 's', + InputOption::VALUE_REQUIRED, + 'The Gitlab CI job stage. If not specified, it is deduced from the CI_JOB_ID environment variable (only available in Gitlab 9+).', null) ->addOption('file', 'f', @@ -159,7 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $lastCommonCommit = $repo->getMergeBase($targetCommit, $commitSha); - list($previousCodeCoverageProvider, $previousMethodsProvider) = $this->getMeasuresFromCommit($buildService, $mergeRequest['target_project_id'], $lastCommonCommit, $cloverFilePath, $crap4JFilePath); + list($previousCodeCoverageProvider, $previousMethodsProvider) = $this->getMeasuresFromCommit($buildService, $mergeRequest['target_project_id'], $lastCommonCommit, $cloverFilePath, $crap4JFilePath, $config->getJobStage()); //list($previousCodeCoverageProvider, $previousMethodsProvider) = $this->getMeasuresFromBranch($buildService, $mergeRequest['target_project_id'], $mergeRequest['target_branch'], $cloverFilePath, $crap4JFilePath); $message = new Message(); @@ -186,7 +191,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $targetProjectId = $mergeRequest['target_project_id'] ?? $projectName; - list($lastCommitCoverage, $lastCommitMethodsProvider) = $this->getMeasuresFromBranch($buildService, $targetProjectId, $currentBranchName, $cloverFilePath, $crap4JFilePath); + list($lastCommitCoverage, $lastCommitMethodsProvider) = $this->getMeasuresFromBranch($buildService, $targetProjectId, $currentBranchName, $cloverFilePath, $crap4JFilePath, $config->getJobStage()); $sendCommentService->sendDifferencesCommentsInCommit($methodsProvider, $lastCommitMethodsProvider, $projectName, $commitSha, $gitlabUrl); @@ -258,12 +263,12 @@ private function getCommiterId(Client $client, Project $project, $commitRef) * @param string $crap4JPath * @return array First element: code coverage, second element: list of methods. */ - public function getMeasuresFromBranch(BuildService $buildService, string $projectName, string $targetBranch, string $cloverPath, string $crap4JPath) : array + public function getMeasuresFromBranch(BuildService $buildService, string $projectName, string $targetBranch, string $cloverPath, string $crap4JPath, string $jobStage) : array { try { $tmpFile = tempnam(sys_get_temp_dir(), 'art').'.zip'; - $buildService->dumpArtifactFromBranch($projectName, $targetBranch, $tmpFile); + $buildService->dumpArtifactFromBranch($projectName, $targetBranch, $jobStage, $tmpFile); $zipFile = new \ZipArchive(); if ($zipFile->open($tmpFile)!==true) { throw new \RuntimeException('Invalid ZIP archive '.$tmpFile); @@ -281,13 +286,13 @@ public function getMeasuresFromBranch(BuildService $buildService, string $projec } } - public function getMeasuresFromCommit(BuildService $buildService, string $projectName, string $commitId, string $cloverPath, string $crap4JPath) : array + public function getMeasuresFromCommit(BuildService $buildService, string $projectName, string $commitId, string $cloverPath, string $crap4JPath, string $jobStage) : array { try { $tmpFile = tempnam(sys_get_temp_dir(), 'art').'.zip'; $build = $buildService->getLatestBuildFromCommitId($projectName, $commitId); - $buildService->dumpArtifact($projectName, $build['id'], $tmpFile); + $buildService->dumpArtifact($projectName, $build['id'], $jobStage, $tmpFile); $zipFile = new \ZipArchive(); if ($zipFile->open($tmpFile)!==true) { throw new \RuntimeException('Invalid ZIP archive '.$tmpFile); diff --git a/src/Gitlab/BuildService.php b/src/Gitlab/BuildService.php index 3e6a56d..3061a76 100644 --- a/src/Gitlab/BuildService.php +++ b/src/Gitlab/BuildService.php @@ -115,16 +115,16 @@ public function getLatestBuildFromBranch(string $projectName, string $branchName } } - public function dumpArtifact(string $projectName, string $buildRef, string $file) + public function dumpArtifact(string $projectName, string $buildRef, string $jobName, string $file) { - $artifactContent = $this->client->projects->buildArtifacts($projectName, $buildRef); + $artifactContent = $this->client->jobs->artifactsByRefName($projectName, $buildRef, $jobName); $filesystem = new Filesystem(); $filesystem->dumpFile($file, $artifactContent); } - public function dumpArtifactFromBranch(string $projectName, string $branchName, string $file) + public function dumpArtifactFromBranch(string $projectName, string $branchName, string $jobStage, string $file) { $build = $this->getLatestBuildFromBranch($projectName, $branchName); - $this->dumpArtifact($projectName, $build['id'], $file); + $this->dumpArtifact($projectName, $build['id'], $jobStage, $file); } } diff --git a/tests/Commands/ConfigTest.php b/tests/Commands/ConfigTest.php index d9825e1..0bade04 100644 --- a/tests/Commands/ConfigTest.php +++ b/tests/Commands/ConfigTest.php @@ -44,6 +44,11 @@ private function getInputDefinition() InputOption::VALUE_REQUIRED, 'The Gitlab CI build id. If not specified, it is deduced from the CI_BUILD_ID environment variable.', null), + new InputOption('job-stage', + 's', + InputOption::VALUE_REQUIRED, + 'The Gitlab CI job stage. If not specified, it is deduced from the CI_JOB_ID environment variable (only available in Gitlab 9+).', + null), new InputOption('file', 'f', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, @@ -226,6 +231,36 @@ public function testNoGitlabBuildId() $config->getGitlabBuildId(); } + public function testGitlabJobStageFromParam() + { + putenv('CI_JOB_STAGE'); + + $input = new ArrayInput(array('--job-stage' => 'test'), $this->getInputDefinition()); + + $config = new Config($input); + $this->assertSame('test', $config->getJobStage()); + } + + public function testGitlabJobStageFromEnv() + { + putenv('CI_JOB_STAGE=test2'); + + $input = new ArrayInput([], $this->getInputDefinition()); + + $config = new Config($input); + $this->assertSame('test2', $config->getJobStage()); + } + + public function testNoGitlabJobStage() + { + putenv('CI_JOB_STAGE'); + + $input = new ArrayInput([], $this->getInputDefinition()); + + $config = new Config($input); + $this->expectException(\RuntimeException::class); + $this->assertSame('test2', $config->getJobStage()); + } public function testFile() { From 795027ec2c39faf8d7f10e0c563fdb98b9c21bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=83=C2=A9grier?= Date: Tue, 20 Jun 2017 15:28:11 +0200 Subject: [PATCH 2/3] Improving README --- README.md | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9b8de75..528480c 100644 --- a/README.md +++ b/README.md @@ -57,18 +57,35 @@ Now, we need to install the *washingmachine*, and get it to run. `.gitlab-ci.yml` ``` -before_script: - - composer global require 'thecodingmachine/washingmachine' +image: php:7.0 + +test: + before_script: + - cd /root && composer create-project thecodingmachine/washingmachine washingmachine ^1.2 -script: - - phpdbg -qrr vendor/bin/phpunit + script: + - phpdbg -qrr vendor/bin/phpunit -after_script: - - /root/.composer/vendor/bin/washingmachine run -v + after_script: + - /root/washingmachine/washingmachine run -v ``` Notice that we need to make sure the PHPDbg extension for PHP is installed. Also, make sure that Xdebug is NOT enabled on your Docker instance. Xdebug can also return code coverage data but is less accurate than PHPDbg, leading to wrong CRAP score results. +### Supported Gitlab versions + +Gitlab 8+ is supported. + +- The washingmachine v1.0 => v1.2 has support for Gitlab 8. +- The washingmachine v1.2+ has support for Gitlab 8 and 9. + +Starting with v1.3, we use some features only available in Gitlab 9. +You can still run the washingmachine on Gitlab 8.10+, but you will need to fill the `job_stage` parameters when program is run: + + /root/washingmachine/washingmachine run --job-stage=test + +THe 'job_stage' parameter is the name of the stage in your `gitlab-ci.yml` file. + ### Adding extra data in the comment When the *washingmachine* adds a comment in your merge-request, you can ask it to add additional text. From 3d320f3d97d52590453339ea781fe627c43a230c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 20 Jun 2017 15:38:23 +0200 Subject: [PATCH 3/3] Preparing for v1.3 release => switching badges --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 528480c..5cfd242 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ [![Total Downloads](https://poser.pugx.org/thecodingmachine/washingmachine/downloads)](https://packagist.org/packages/thecodingmachine/washingmachine) [![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/washingmachine/v/unstable)](https://packagist.org/packages/thecodingmachine/washingmachine) [![License](https://poser.pugx.org/thecodingmachine/washingmachine/license)](https://packagist.org/packages/thecodingmachine/washingmachine) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/washingmachine/badges/quality-score.png?b=1.2)](https://scrutinizer-ci.com/g/thecodingmachine/washingmachine/?branch=1.2) -[![Build Status](https://travis-ci.org/thecodingmachine/washingmachine.svg?branch=1.2)](https://travis-ci.org/thecodingmachine/washingmachine) -[![Coverage Status](https://coveralls.io/repos/thecodingmachine/washingmachine/badge.svg?branch=1.2&service=github)](https://coveralls.io/github/thecodingmachine/washingmachine?branch=1.2) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/washingmachine/badges/quality-score.png?b=1.3)](https://scrutinizer-ci.com/g/thecodingmachine/washingmachine/?branch=1.3) +[![Build Status](https://travis-ci.org/thecodingmachine/washingmachine.svg?branch=1.3)](https://travis-ci.org/thecodingmachine/washingmachine) +[![Coverage Status](https://coveralls.io/repos/thecodingmachine/washingmachine/badge.svg?branch=1.3&service=github)](https://coveralls.io/github/thecodingmachine/washingmachine?branch=1.3) # Washing machine