From 9695863ff4b0c302dd04eff8f5cfa522e93d34e3 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 13:25:55 +0000 Subject: [PATCH 001/110] Adding gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ From 000b61cbc7242ac2f5ca41dbe836c9cf841c654a Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:00:33 +0000 Subject: [PATCH 002/110] Updating travis file --- .travis.yml | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4bc5d1..6f0d1a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,31 +6,11 @@ addons: apt: packages: - libxml2-utils - php: - 7.1 - - 7.2 - - 7.3 - - master - -matrix: - allow_failures: - - php: master - fast_finish: true - -env: - matrix: - - DEPENDENCIES="high" - - DEPENDENCIES="low" - global: - - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" before_install: - - ./build/tools/composer clear-cache - -install: - - if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry ./build/tools/composer update $DEFAULT_COMPOSER_FLAGS; fi - - if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry ./build/tools/composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi +- php /home/travis/.phpenv/versions/7.1/bin/composer.phar update before_script: - echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini @@ -46,16 +26,3 @@ script: after_success: - bash <(curl -s https://codecov.io/bash) - -notifications: - email: false - -jobs: - include: - - stage: Static Code Analysis - php: 7.2 - env: php-cs-fixer - install: - - phpenv config-rm xdebug.ini - script: - - ./build/tools/php-cs-fixer fix --dry-run -v --show-progress=dots --diff-format=udiff From bba365ba4ac036eafab0ac77a45da9af3657c17e Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:02:21 +0000 Subject: [PATCH 003/110] Updating travis file --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f0d1a4..7a4f663 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,6 @@ addons: php: - 7.1 -before_install: -- php /home/travis/.phpenv/versions/7.1/bin/composer.phar update - before_script: - echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - echo 'assert.exception=On' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini From 363d28cb9a25c71bab6439d1fa658784bf30a337 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:07:07 +0000 Subject: [PATCH 004/110] Updating travis file --- .travis.yml | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7a4f663..2de3618 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,16 @@ -language: php +# Config file for https://travis-ci.org/ -sudo: false +language: php -addons: - apt: - packages: - - libxml2-utils +# Define the php versions against we want to test our code php: - - 7.1 +- 7.1 -before_script: - - echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - echo 'assert.exception=On' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini +# Note: Code coverage requires php-xDebug extension enabled on CI server -script: - - ./phpunit --coverage-clover=coverage.xml - - ./phpunit --configuration ./build/travis-ci-fail.xml > /dev/null; if [ $? -eq 0 ]; then echo "SHOULD FAIL"; false; else echo "fail checked"; fi; - - xmllint --noout --schema phpunit.xsd phpunit.xml - - xmllint --noout --schema phpunit.xsd tests/_files/configuration.xml - - xmllint --noout --schema phpunit.xsd tests/_files/configuration_empty.xml - - xmllint --noout --schema phpunit.xsd tests/_files/configuration_xinclude.xml -xinclude +install: +- travis_retry composer install --no-interaction --no-suggest -after_success: - - bash <(curl -s https://codecov.io/bash) +# Testing the app (see phpunit.xml) for configs, generating Code Coverage report +script: +- composer test -- --coverage-clover=coverage.xml From c91d435a5e4f299153ea82ad1fdaaf103ee1c9a5 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:12:25 +0000 Subject: [PATCH 005/110] Ading composer file --- composer.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b496d60 --- /dev/null +++ b/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/phpunit_example", + "type": "drupal-module", + "description": "Allow a term to be configured to show the content on a referenced node rather than the default term view.", + "keywords": ["Drupal", "Term", "phpunit"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/term_node", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/term_node", + "source": "http://cgit.drupalcode.org/term_node" + }, + "require": { } +} From 87d0e5e528d2224d794942de22db9288ba6cad4f Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:30:53 +0000 Subject: [PATCH 006/110] Updating travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2de3618..8c30983 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ install: # Testing the app (see phpunit.xml) for configs, generating Code Coverage report script: -- composer test -- --coverage-clover=coverage.xml +- phpunit -c core/phpunit.xml.dist . --debug --testdox From b9b97ea7b0e04f2fbb66d2f6a7898372f0a785cb Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:40:40 +0000 Subject: [PATCH 007/110] Updating travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8c30983..ff570f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ language: php # Define the php versions against we want to test our code php: - 7.1 +- 7.2 # Note: Code coverage requires php-xDebug extension enabled on CI server @@ -13,4 +14,4 @@ install: # Testing the app (see phpunit.xml) for configs, generating Code Coverage report script: -- phpunit -c core/phpunit.xml.dist . --debug --testdox +- ./bin/phpunit tests/src/Unit/UnitTest.php From 53506b8a9b9fe05d15171b18d1cf3a82a1358fb6 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:42:24 +0000 Subject: [PATCH 008/110] Updating travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ff570f5..be96f91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,4 @@ install: # Testing the app (see phpunit.xml) for configs, generating Code Coverage report script: -- ./bin/phpunit tests/src/Unit/UnitTest.php +- ./phpunit tests/src/Unit/UnitTest.php From 1d5f3bdd93253606a01db584b6a26aaa28a87fa7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:44:51 +0000 Subject: [PATCH 009/110] Updating travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index be96f91..92af85f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,4 @@ install: # Testing the app (see phpunit.xml) for configs, generating Code Coverage report script: -- ./phpunit tests/src/Unit/UnitTest.php +- phpunit tests/src/Unit/UnitTest.php From 136ebb1bccab4f05bba8287f2c419ffc1e2cd0d2 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 14:45:04 +0000 Subject: [PATCH 010/110] Updating travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 92af85f..edce2b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ language: php # Define the php versions against we want to test our code php: - 7.1 -- 7.2 # Note: Code coverage requires php-xDebug extension enabled on CI server From 87daccf5fd06b8f3a7bd5404b1a1cdc7d47bc64b Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 16:32:51 +0000 Subject: [PATCH 011/110] Updating travis file --- .travis.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index edce2b7..5497a6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,18 @@ -# Config file for https://travis-ci.org/ - language: php - -# Define the php versions against we want to test our code php: -- 7.1 - -# Note: Code coverage requires php-xDebug extension enabled on CI server - +- '7.1' +addons: + sonarcloud: + organization: "simon-peacock-github" + token: + secure: "secure-string=666f24e3ccd30b982a2e1a78b4517210c2cf412b" +env: +- SIMPLETEST_DB=sqlite://testdb.sqlite install: -- travis_retry composer install --no-interaction --no-suggest - -# Testing the app (see phpunit.xml) for configs, generating Code Coverage report +- composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction +- composer require -d drupal 'drupal/flag:4.0-alpha2' +- patch -d drupal/web -p1 < sqlite-driver-exception.patch +- patch -d drupal/web/core -p1 < travis-ci-phpunit.xml.dist.patch +- mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests templates src config drupal/web/modules/${PWD##*/} script: -- phpunit tests/src/Unit/UnitTest.php +- drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/my_module/tests/ --coverage-clover clover.xml --log-junit junit.log From 4ee5bbad96b3f13b7502a2ab929b8f52c0f30e37 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 16:37:37 +0000 Subject: [PATCH 012/110] Updating travis file --- .travis.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5497a6d..40067cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,9 @@ language: php php: - '7.1' -addons: - sonarcloud: - organization: "simon-peacock-github" - token: - secure: "secure-string=666f24e3ccd30b982a2e1a78b4517210c2cf412b" -env: -- SIMPLETEST_DB=sqlite://testdb.sqlite + install: - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction -- composer require -d drupal 'drupal/flag:4.0-alpha2' -- patch -d drupal/web -p1 < sqlite-driver-exception.patch -- patch -d drupal/web/core -p1 < travis-ci-phpunit.xml.dist.patch - mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests templates src config drupal/web/modules/${PWD##*/} script: -- drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/my_module/tests/ --coverage-clover clover.xml --log-junit junit.log +- drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ --coverage-clover clover.xml --log-junit junit.log From 0102f21cd7bff6a10421d37c2675af96d2a14186 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 16:41:51 +0000 Subject: [PATCH 013/110] Updating travis file --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 40067cb..076d554 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,6 @@ php: install: - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction -- mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests templates src config drupal/web/modules/${PWD##*/} +- mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} script: - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ --coverage-clover clover.xml --log-junit junit.log From 06e5df3ceb042ee323c092eb56f94cd7499c2aa2 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 16:46:22 +0000 Subject: [PATCH 014/110] Updating travis file --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 076d554..96b92b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,12 @@ language: php php: - '7.1' +addons: + sonarcloud: + organization: "simon-peacock-github" + token: + secure: "secure-string=666f24e3ccd30b982a2e1a78b4517210c2cf412b" + install: - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} From eb7e05c769ac50dfd143e216a3c379b18640429f Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 16:53:41 +0000 Subject: [PATCH 015/110] Updating travis file --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96b92b5..5193343 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,5 @@ install: - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} script: -- drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ --coverage-clover clover.xml --log-junit junit.log +- drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ +- sonar-scanner From 2fd10ae80737f8a5e3373240a376fe51b1798a14 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 17:03:25 +0000 Subject: [PATCH 016/110] Adding sonar project --- .travis.yml | 3 ++- sonar-project.properties | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 sonar-project.properties diff --git a/.travis.yml b/.travis.yml index 5193343..44590ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,5 @@ install: - mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} script: - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ -- sonar-scanner +- sonar-scanner -Dsonar.sources=drupal/web/modules/${PWD##*/}/src -Dsonar.php.tests.reportPath=junit.log -Dsonar.php.coverage.reportPaths=drupal/web/clover.xml + diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..a1fdcea --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,12 @@ +# must be unique in a given SonarQube instance +sonar.projectKey=phpunit_example +# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1. +sonar.projectName=phpunit example +sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +# This property is optional if sonar.modules is set. +sonar.sources=src + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 From 70323a634c5079c7ddec66ac99375ffabc04e7fc Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 17:12:32 +0000 Subject: [PATCH 017/110] Adding sonar project --- sonar-project.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sonar-project.properties b/sonar-project.properties index a1fdcea..05ddf0c 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -4,6 +4,10 @@ sonar.projectKey=phpunit_example sonar.projectName=phpunit example sonar.projectVersion=1.0 +sonar.host.url=https://sonarcloud.io +sonar.organization=simon-peacock-github +sonar.login=666f24e3ccd30b982a2e1a78b4517210c2cf412b + # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. # This property is optional if sonar.modules is set. sonar.sources=src From 877688ddae6e379f7230161fb9d6fab709c36984 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 17:23:05 +0000 Subject: [PATCH 018/110] Adding sonar project --- sonar-project.properties | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 05ddf0c..7862b66 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,9 +1,6 @@ -# must be unique in a given SonarQube instance sonar.projectKey=phpunit_example -# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1. sonar.projectName=phpunit example sonar.projectVersion=1.0 - sonar.host.url=https://sonarcloud.io sonar.organization=simon-peacock-github sonar.login=666f24e3ccd30b982a2e1a78b4517210c2cf412b @@ -11,6 +8,5 @@ sonar.login=666f24e3ccd30b982a2e1a78b4517210c2cf412b # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. # This property is optional if sonar.modules is set. sonar.sources=src - # Encoding of the source code. Default is default system encoding #sonar.sourceEncoding=UTF-8 From c0b17373f11e242f53cd96aceca6ac40b38bb29c Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 17:28:54 +0000 Subject: [PATCH 019/110] Adding sonar project --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 44590ed..05646c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,5 +13,4 @@ install: - mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} script: - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ -- sonar-scanner -Dsonar.sources=drupal/web/modules/${PWD##*/}/src -Dsonar.php.tests.reportPath=junit.log -Dsonar.php.coverage.reportPaths=drupal/web/clover.xml From bc65d0cc4d25bfcf62dbb70161a9c58021869eb7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 17:33:24 +0000 Subject: [PATCH 020/110] Updating README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2fbbb84..7c506a2 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # phpunit_example +[![Build Status](https://travis-ci.org/simon-peacock/phpunit_example.svg?branch=master)](https://travis-ci.org/simon-peacock/phpunit_example) From a31f685be072247fa4cecd0981a3df3e602e78df Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 6 Nov 2018 17:51:09 +0000 Subject: [PATCH 021/110] Making test fail --- tests/src/Unit/UnitTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Unit/UnitTest.php b/tests/src/Unit/UnitTest.php index addd400..176348c 100644 --- a/tests/src/Unit/UnitTest.php +++ b/tests/src/Unit/UnitTest.php @@ -10,7 +10,7 @@ * * @group phpunit_example */ -class UnitTest extends UnitTestCase { +class UnitTest extends UnitTestCas { protected $unit; From 064a51945e9583cc9809b73efecc7bc34f04f059 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Wed, 7 Nov 2018 11:28:45 +0000 Subject: [PATCH 022/110] Adding circleci config --- .circleci/config.yml | 37 +++++++++++++++++++++++++++++++++++++ tests/src/Unit/UnitTest.php | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..fb1e4cf --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,37 @@ +# PHP CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-php/ for more details +# +version: 2 +jobs: + build: + docker: + # specify the version you desire here + - image: circleci/php:7.1-browsers + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/mysql:9.4 + + working_directory: ~/repo + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "composer.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: composer install -n --prefer-dist + + - save_cache: + paths: + - ./vendor + key: v1-dependencies-{{ checksum "composer.json" }} + + # run tests! + - run: phpunit diff --git a/tests/src/Unit/UnitTest.php b/tests/src/Unit/UnitTest.php index 176348c..addd400 100644 --- a/tests/src/Unit/UnitTest.php +++ b/tests/src/Unit/UnitTest.php @@ -10,7 +10,7 @@ * * @group phpunit_example */ -class UnitTest extends UnitTestCas { +class UnitTest extends UnitTestCase { protected $unit; From 222dd6b70daf449368d33d19259cc1976b672668 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Wed, 7 Nov 2018 11:36:06 +0000 Subject: [PATCH 023/110] Updating circleci config --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index fb1e4cf..2f4b24a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,3 +35,4 @@ jobs: # run tests! - run: phpunit + From 849fb34fc227a7fa008820c5b7347e6ed51fe2e7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 10:59:39 +0000 Subject: [PATCH 024/110] Adding Jenkinsfile --- .circleci/config.yml | 2 +- Jenkinsfile | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f4b24a..ac27ec3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,4 +35,4 @@ jobs: # run tests! - run: phpunit - + diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fd64aeb --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,20 @@ +#!/usr/bin/env groovy + +pipeline { + agent { label 'drupal8' } + triggers { + bitbucketPush() + } + options { disableConcurrentBuilds() } + stages { + stage('Static code analysis') { + steps { + sh ''' + composer create-project drupal-composer/drupal-project:8.x-dev + ''' + } + + } + } +} + From 435a27a7e885aefc64bebeb705c66c80de0fdad7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 11:01:34 +0000 Subject: [PATCH 025/110] Adding Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fd64aeb..4924738 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,9 +2,9 @@ pipeline { agent { label 'drupal8' } - triggers { - bitbucketPush() - } +// triggers { +// bitbucketPush() +// } options { disableConcurrentBuilds() } stages { stage('Static code analysis') { From 1bf243e83ccef1a38cb4ee97bb04d839d7396e66 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 11:41:39 +0000 Subject: [PATCH 026/110] Updaing Jenkinsfile --- Jenkinsfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4924738..9286638 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,10 +11,24 @@ pipeline { steps { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev + composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction + mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ ''' } } + stage('Static code analysis') { + when { + not { branch "PR-*" } + not { branch "1.x" } + } + steps { + sh ''' + echo "This is not a PR" + ''' + } + } } } From 34270044605ace2d8468bdfa1d1f7ca1f349ed1c Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 11:43:49 +0000 Subject: [PATCH 027/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9286638..2c102b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { // } options { disableConcurrentBuilds() } stages { - stage('Static code analysis') { + stage('Pull Request') { steps { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev From e62a25be6f4fee7e0bd9940f6143c17e245b0dd3 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 11:55:06 +0000 Subject: [PATCH 028/110] Updaing Jenkinsfile --- Jenkinsfile | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c102b2..2a1563e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,9 @@ #!/usr/bin/env groovy pipeline { + environment { + workspace = pwd() + } agent { label 'drupal8' } // triggers { // bitbucketPush() @@ -8,15 +11,27 @@ pipeline { options { disableConcurrentBuilds() } stages { stage('Pull Request') { - steps { - sh ''' - composer create-project drupal-composer/drupal-project:8.x-dev - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ - ''' + steps { + sh ''' + + echo ${workspace} + + ''' + } + +// steps { +// sh ''' +// composer create-project drupal-composer/drupal-project:8.x-dev +// composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction +// mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} +// drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ +// ''' +// } + + + } stage('Static code analysis') { when { From 2265717dbd60fece2bfa893b347889ccc02e1aba Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 11:56:57 +0000 Subject: [PATCH 029/110] Updaing Jenkinsfile --- Jenkinsfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2a1563e..bd9ea4e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,12 +12,7 @@ pipeline { stages { stage('Pull Request') { steps { - sh ''' - - echo ${workspace} - - ''' - + sh "echo ${workspace}" } From 71fd3216792cf81e2698468cce714f4d60cba1de Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:01:21 +0000 Subject: [PATCH 030/110] Updaing Jenkinsfile --- Jenkinsfile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bd9ea4e..792b92e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,18 +1,20 @@ #!/usr/bin/env groovy pipeline { - environment { - workspace = pwd() - } - agent { label 'drupal8' } -// triggers { -// bitbucketPush() -// } + environment { + workspace = pwd() + } + agent { + label 'drupal8' + } + triggers { + githubPush() + } options { disableConcurrentBuilds() } stages { stage('Pull Request') { steps { - sh "echo ${workspace}" + sh "ls -la" } From d2bfff3969b2a129bd0634542e7db28518c6af75 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:03:07 +0000 Subject: [PATCH 031/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 792b92e..aa4a50c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { stages { stage('Pull Request') { steps { - sh "ls -la" + echo sh(returnStdout: true, script: 'env') } From 216a039db355287fe0e9a83da23d45a532bc6dce Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:07:16 +0000 Subject: [PATCH 032/110] Updaing Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index aa4a50c..636ab56 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,9 @@ pipeline { stages { stage('Pull Request') { steps { - echo sh(returnStdout: true, script: 'env') + // echo sh(returnStdout: true, script: 'env') + + echo ${JOB_NAME%/*} } From a77d0446d8e6066c3f6dad7414962237bcdc6aeb Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:08:25 +0000 Subject: [PATCH 033/110] Updaing Jenkinsfile --- Jenkinsfile | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 636ab56..1959a44 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,23 +14,12 @@ pipeline { stages { stage('Pull Request') { steps { - // echo sh(returnStdout: true, script: 'env') + echo ${JOB_NAME%/*} } -// steps { -// sh ''' -// composer create-project drupal-composer/drupal-project:8.x-dev -// composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction -// mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} -// drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ -// ''' -// } - - - } stage('Static code analysis') { when { From 0944d351e0b1d7bec6beb50bac111427a18eef18 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:09:48 +0000 Subject: [PATCH 034/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1959a44..9179b09 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { steps { - echo ${JOB_NAME%/*} + echo "${JOB_NAME%/\*}" } From 184ef81176c928bea2a5e767e13abbeaf03d4e8c Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:11:26 +0000 Subject: [PATCH 035/110] Updaing Jenkinsfile --- Jenkinsfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9179b09..5454376 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,12 +14,23 @@ pipeline { stages { stage('Pull Request') { steps { + // echo sh(returnStdout: true, script: 'env') - - echo "${JOB_NAME%/\*}" + echo sh(${JOB_NAME%/*}) } +// steps { +// sh ''' +// composer create-project drupal-composer/drupal-project:8.x-dev +// composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction +// mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} +// drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ +// ''' +// } + + + } stage('Static code analysis') { when { From 6268b5774cfb308102868389c81e0d21cf29c5cf Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:13:02 +0000 Subject: [PATCH 036/110] Updaing Jenkinsfile --- Jenkinsfile | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5454376..1914b50 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,23 +14,12 @@ pipeline { stages { stage('Pull Request') { steps { - // echo sh(returnStdout: true, script: 'env') - echo sh(${JOB_NAME%/*}) + sh ''' + echo "${JOB_NAME%/*}" + ''' } - -// steps { -// sh ''' -// composer create-project drupal-composer/drupal-project:8.x-dev -// composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction -// mkdir -p drupal/web/modules/${PWD##*/} && cp -a ${PWD##*/}* tests src drupal/web/modules/${PWD##*/} -// drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ -// ''' -// } - - - } stage('Static code analysis') { when { From 24da6d5d27d75514d2e17bf66bb3cb25cdabb6fc Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:16:53 +0000 Subject: [PATCH 037/110] Updaing Jenkinsfile --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1914b50..494eb71 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { environment { - workspace = pwd() + DIRS_TO_TEST= "tests src" } agent { label 'drupal8' @@ -13,13 +13,15 @@ pipeline { options { disableConcurrentBuilds() } stages { stage('Pull Request') { - steps { + steps { sh ''' - echo "${JOB_NAME%/*}" + composer create-project drupal-composer/drupal-project:8.x-dev + composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction + mkdir -p drupal/web/modules/${JOB_NAME%/*} && cp -a ${PWD##*/}* ${DIRS_TO_TEST} drupal/web/modules/${JOB_NAME%/*} + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ ''' - } - + } } stage('Static code analysis') { when { From 8ad80910d047b75a67f888571fb8ad54331fd506 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:26:39 +0000 Subject: [PATCH 038/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 494eb71..b0fb97f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && cp -a ${PWD##*/}* ${DIRS_TO_TEST} drupal/web/modules/${JOB_NAME%/*} + mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ ''' } From a33c276ba2bb78f7e579e164f113d15f9ef9e7e6 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:32:00 +0000 Subject: [PATCH 039/110] Updaing Jenkinsfile --- Jenkinsfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0fb97f..ed1d7cc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,9 +18,12 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ + mkdir -p drupal/web/modules/${JOB_NAME%/*} + ls -la + ''' + //&& rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ } } stage('Static code analysis') { From cab574bff05a3cdaf1c4bac06a546cbd6d342990 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:43:12 +0000 Subject: [PATCH 040/110] Updaing Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed1d7cc..524a7a3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,12 +16,12 @@ pipeline { steps { sh ''' - composer create-project drupal-composer/drupal-project:8.x-dev - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction + mkdir -p drupal/web/modules/${JOB_NAME%/*} ls -la ''' + //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction //&& rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ } From 4848f33db8d2ab7aaa0b2e45723587ab10d98f00 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:44:33 +0000 Subject: [PATCH 041/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 524a7a3..1dc6b1a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { sh ''' mkdir -p drupal/web/modules/${JOB_NAME%/*} - ls -la + ls -la ${PWD} ''' //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction From 2b664f518c8bade01110fb66b9ca065f5b41f83c Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:45:59 +0000 Subject: [PATCH 042/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1dc6b1a..2dfa677 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { sh ''' mkdir -p drupal/web/modules/${JOB_NAME%/*} - ls -la ${PWD} + rsync -av --progress ${PWD} drupal/web/modules/${JOB_NAME%/*} --exclude drupal ''' //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction From 787f6697f0217e6a4b867e9b5ad6d17513e2869c Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:49:01 +0000 Subject: [PATCH 043/110] Updaing Jenkinsfile --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2dfa677..6048f61 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,13 +17,15 @@ pipeline { steps { sh ''' - mkdir -p drupal/web/modules/${JOB_NAME%/*} - rsync -av --progress ${PWD} drupal/web/modules/${JOB_NAME%/*} --exclude drupal + mkdir -p drupal/web/modules/${JOB_NAME%/*} \ + && cp -a ${PWD}* ${DIRS_TO_TEST} drupal/web/modules/${JOB_NAME%/*} + ''' //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction //&& rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ + //rsync -av --progress ${PWD} drupal/web/modules/${JOB_NAME%/*} --exclude drupal } } stage('Static code analysis') { From 84e67df4aaa738924b57905f6beaaa18292801fc Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:53:48 +0000 Subject: [PATCH 044/110] Updaing Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6048f61..5227146 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { sh ''' mkdir -p drupal/web/modules/${JOB_NAME%/*} \ - && cp -a ${PWD}* ${DIRS_TO_TEST} drupal/web/modules/${JOB_NAME%/*} + && rsync -av ${PWD}/ drupal/web/modules/${JOB_NAME%/*}/ --exclude drupal ''' @@ -26,6 +26,7 @@ pipeline { //&& rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ //rsync -av --progress ${PWD} drupal/web/modules/${JOB_NAME%/*} --exclude drupal + //cp -a ${PWD}* ${DIRS_TO_TEST} drupal/web/modules/${JOB_NAME%/*} } } stage('Static code analysis') { From eca6003a85dad5986b0aeda38dbaa80927a90d0f Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 12:59:48 +0000 Subject: [PATCH 045/110] Updaing Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5227146..8f77fcd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { sh ''' mkdir -p drupal/web/modules/${JOB_NAME%/*} \ - && rsync -av ${PWD}/ drupal/web/modules/${JOB_NAME%/*}/ --exclude drupal + && rsync --help ''' @@ -27,6 +27,7 @@ pipeline { //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ //rsync -av --progress ${PWD} drupal/web/modules/${JOB_NAME%/*} --exclude drupal //cp -a ${PWD}* ${DIRS_TO_TEST} drupal/web/modules/${JOB_NAME%/*} + //&& rsync -av ${PWD}/ drupal/web/modules/${JOB_NAME%/*}/ --exclude drupal } } stage('Static code analysis') { From 058d00c4538d9be654e8b6a91259c2a943a94897 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 13:15:36 +0000 Subject: [PATCH 046/110] Updating JenkinsFile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f77fcd..b31e255 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { sh ''' mkdir -p drupal/web/modules/${JOB_NAME%/*} \ - && rsync --help + && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal ''' From 50989883b0deb7c9e504fdf68e1c8911af423b0f Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 13:18:19 +0000 Subject: [PATCH 047/110] Updating JenkinsFile --- Jenkinsfile | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b31e255..ebeb34a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,18 +16,9 @@ pipeline { steps { sh ''' - - mkdir -p drupal/web/modules/${JOB_NAME%/*} \ - && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - - + mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ ''' - //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - //&& rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${PWD##*/}/tests/ - //rsync -av --progress ${PWD} drupal/web/modules/${JOB_NAME%/*} --exclude drupal - //cp -a ${PWD}* ${DIRS_TO_TEST} drupal/web/modules/${JOB_NAME%/*} - //&& rsync -av ${PWD}/ drupal/web/modules/${JOB_NAME%/*}/ --exclude drupal } } stage('Static code analysis') { From e04907820d8872a4dbb247ba69aed02bd13063ec Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 13:19:28 +0000 Subject: [PATCH 048/110] Updating JenkinsFile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index ebeb34a..7f98a25 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,6 +16,7 @@ pipeline { steps { sh ''' + composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ ''' From 41f8dffae0c13d1545f20fbdf627757c24014913 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 14:38:49 +0000 Subject: [PATCH 049/110] Updating Jenkins --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7f98a25..0974e6b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { } steps { sh ''' - echo "This is not a PR" + echo "This is not a PR " ''' } } From 22cb94da7455f0ea72e426a6f51107166f031c78 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 14:48:42 +0000 Subject: [PATCH 050/110] Updating Jenkins --- Jenkinsfile | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0974e6b..92e1cb1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,15 +1,8 @@ #!/usr/bin/env groovy pipeline { - environment { - DIRS_TO_TEST= "tests src" - } - agent { - label 'drupal8' - } - triggers { - githubPush() - } + agent { label 'drupal8' } + triggers { githubPush() } options { disableConcurrentBuilds() } stages { stage('Pull Request') { @@ -22,17 +15,6 @@ pipeline { ''' } } - stage('Static code analysis') { - when { - not { branch "PR-*" } - not { branch "1.x" } - } - steps { - sh ''' - echo "This is not a PR " - ''' - } - } } } From df168ccfd6607a7ba2cf11811573dbeb3cc6d242 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 14:57:45 +0000 Subject: [PATCH 051/110] Updating Jenkins --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 92e1cb1..ca25f26 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,6 @@ pipeline { options { disableConcurrentBuilds() } stages { stage('Pull Request') { - steps { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction From e8c1f8749f40b76f429a9551ffcad831c19f76cb Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 15:06:25 +0000 Subject: [PATCH 052/110] Updating Jenkins --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ca25f26..da2ac62 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,6 +6,10 @@ pipeline { options { disableConcurrentBuilds() } stages { stage('Pull Request') { + when { + expression { branch "PR-*" } + expression { branch "1.x" } + } steps { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction From 448d4f697beef1f37f988e18a6155e1cfab58fb5 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 15:19:11 +0000 Subject: [PATCH 053/110] Updating Jenkins --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index da2ac62..0b6c88d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,10 +12,15 @@ pipeline { } steps { sh ''' + echo sh(returnStdout: true, script: 'env') composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ ''' + + //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction + //mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ } } } From 625d383bf782ec3a02f8911fd04a6b2f5566ed71 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 15:20:24 +0000 Subject: [PATCH 054/110] Updating Jenkins --- Jenkinsfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b6c88d..da4848a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,9 +13,6 @@ pipeline { steps { sh ''' echo sh(returnStdout: true, script: 'env') - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ ''' //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction From 77a95f8b28aa559f232d5e50a19fb195c8c65d68 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 15:21:45 +0000 Subject: [PATCH 055/110] Updating Jenkins --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index da4848a..55db427 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,9 +11,7 @@ pipeline { expression { branch "1.x" } } steps { - sh ''' - echo sh(returnStdout: true, script: 'env') - ''' + echo sh(returnStdout: true, script: 'env') //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction //mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal From e271d4ed8533054ebf3ce0a0968c5004867cb9a9 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 17:22:22 +0000 Subject: [PATCH 056/110] Updating Jenkinsfile --- Jenkinsfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 55db427..71601d6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,11 +11,12 @@ pipeline { expression { branch "1.x" } } steps { - echo sh(returnStdout: true, script: 'env') - - //composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - //mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - //drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ + sh ''' + composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction + mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ + ''' + //echo sh(returnStdout: true, script: 'env') } } } From 44a555c6db3260f3a51caff1ed832fa9d86d2e33 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 17:34:32 +0000 Subject: [PATCH 057/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 71601d6..eb5dcfb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ ''' - //echo sh(returnStdout: true, script: 'env') + publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/coverage', reportFiles: 'index.html', reportName: 'Coverage Report', reportTitles: '']) } } } From c09cab7ec69b2cae184b60691f1468cac27d028f Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 8 Nov 2018 17:40:40 +0000 Subject: [PATCH 058/110] Updating Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index eb5dcfb..1f3a8f5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,6 +14,7 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + mkdir build/coverage drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ ''' publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/coverage', reportFiles: 'index.html', reportName: 'Coverage Report', reportTitles: '']) From 3bf92abf3dbf7751e470b32c4698e832ef47edf7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 12:31:06 +0000 Subject: [PATCH 059/110] Updating Jenkinsfile --- Jenkinsfile | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1f3a8f5..3ac879a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,20 +5,17 @@ pipeline { triggers { githubPush() } options { disableConcurrentBuilds() } stages { - stage('Pull Request') { - when { - expression { branch "PR-*" } - expression { branch "1.x" } - } - steps { - sh ''' - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - mkdir build/coverage - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ - ''' - publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/coverage', reportFiles: 'index.html', reportName: 'Coverage Report', reportTitles: '']) - } + + stage('Static code analysis') { + when { + not { branch "PR-*" } + not { branch "1.x" } + } + steps { + withSonarQubeEnv('lightning') { + sh "sonar-scanner -Dsonar.analysis.mode=preview" + } + } } } } From 9e6a92e7d050661b4c60516ddde4d8f1908f8a0e Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 12:32:52 +0000 Subject: [PATCH 060/110] Updating Jenkinsfile --- Jenkinsfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ac879a..676a887 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,10 +7,6 @@ pipeline { stages { stage('Static code analysis') { - when { - not { branch "PR-*" } - not { branch "1.x" } - } steps { withSonarQubeEnv('lightning') { sh "sonar-scanner -Dsonar.analysis.mode=preview" From 1065b0487af8ffeb591bb88d907d582f977b1c5d Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 12:46:26 +0000 Subject: [PATCH 061/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 676a887..5a466fc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { stage('Static code analysis') { steps { - withSonarQubeEnv('lightning') { + withSonarQubeEnv('lighting-prototype') { sh "sonar-scanner -Dsonar.analysis.mode=preview" } } From af0e2cd885df5fa6a85822b44488fd1c5d0b0aec Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 12:51:14 +0000 Subject: [PATCH 062/110] Updating Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5a466fc..542cadf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,11 +5,10 @@ pipeline { triggers { githubPush() } options { disableConcurrentBuilds() } stages { - stage('Static code analysis') { steps { withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner -Dsonar.analysis.mode=preview" + sh "sonar-scanner -Dsonar.analysis.mode=preview -X" } } } From 75db74dcbc5908909cca26227eeefdd142a0de90 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 12:58:13 +0000 Subject: [PATCH 063/110] Updating sonarfile --- sonar-project.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 7862b66..671d4e7 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,8 +2,8 @@ sonar.projectKey=phpunit_example sonar.projectName=phpunit example sonar.projectVersion=1.0 sonar.host.url=https://sonarcloud.io -sonar.organization=simon-peacock-github -sonar.login=666f24e3ccd30b982a2e1a78b4517210c2cf412b +sonar.organization=jenkins +sonar.login=00f857328036f4e782a840959b0186eefe5ddcd9 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. # This property is optional if sonar.modules is set. From e2eb354c90595eac53f1314359bc9901a93d4732 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 13:05:26 +0000 Subject: [PATCH 064/110] Updating sonarfile --- sonar-project.properties | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 671d4e7..86f5f5c 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,12 +1,11 @@ sonar.projectKey=phpunit_example sonar.projectName=phpunit example -sonar.projectVersion=1.0 -sonar.host.url=https://sonarcloud.io -sonar.organization=jenkins -sonar.login=00f857328036f4e782a840959b0186eefe5ddcd9 +sonar.links.homepage=https://github.com/simon-peacock/phpunit_example -# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. -# This property is optional if sonar.modules is set. -sonar.sources=src -# Encoding of the source code. Default is default system encoding -#sonar.sourceEncoding=UTF-8 +sonar.sources=srsc +sonar.host.url=http://ec2-34-248-104-77.eu-west-1.compute.amazonaws.com:9000 +sonar.verbose=false +sonar.sourceEncoding=UTF-8 + +sonar.dependencyCheck.reportPath=dependency-check-report.xml +sonar.dependencyCheck.htmlReportPath=dependency-check-report.html From eee26d158c640133b176c2ca749d276d36a2b64c Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 13:19:18 +0000 Subject: [PATCH 065/110] Updating sonarfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 542cadf..2c36878 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { stage('Static code analysis') { steps { withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner -Dsonar.analysis.mode=preview -X" + sh "sonar-scanner -Dsonar.analysis.mode=preview -X --stacktrace --debug" } } } From d49effc07f8d2b001f7e6716e0099c799b5c79ca Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 13:21:09 +0000 Subject: [PATCH 066/110] Updating sonarfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c36878..542cadf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { stage('Static code analysis') { steps { withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner -Dsonar.analysis.mode=preview -X --stacktrace --debug" + sh "sonar-scanner -Dsonar.analysis.mode=preview -X" } } } From b87f995d1f152e4a112db56a095a8de6b4d197b0 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 13:26:34 +0000 Subject: [PATCH 067/110] Updating sonarfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 542cadf..0df0f0f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { stage('Static code analysis') { steps { withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner -Dsonar.analysis.mode=preview -X" + sh "sonar-scanner" } } } From 8b34c13b0bba3b62d3f7df5fcbb4411006908a65 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 13:27:51 +0000 Subject: [PATCH 068/110] Updating sonarfile --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 86f5f5c..12b644d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,7 +2,7 @@ sonar.projectKey=phpunit_example sonar.projectName=phpunit example sonar.links.homepage=https://github.com/simon-peacock/phpunit_example -sonar.sources=srsc +sonar.sources=src sonar.host.url=http://ec2-34-248-104-77.eu-west-1.compute.amazonaws.com:9000 sonar.verbose=false sonar.sourceEncoding=UTF-8 From 64ac7d301d72793569338ae7fbbb055472ac3253 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 14:24:49 +0000 Subject: [PATCH 069/110] Ading files just for testing --- src/ContentPartnershipKickerBuilder.php | 55 +++++++ src/DefaultKickerBuilder.php | 156 +++++++++++++++++++ src/Kicker.php | 187 +++++++++++++++++++++++ src/KickerBuilderInterface.php | 29 ++++ src/KickerInterface.php | 100 ++++++++++++ src/KickerManager.php | 105 +++++++++++++ src/KickerManagerInterface.php | 51 +++++++ src/Plugin/ExtraField/Display/Kicker.php | 71 +++++++++ 8 files changed, 754 insertions(+) create mode 100644 src/ContentPartnershipKickerBuilder.php create mode 100644 src/DefaultKickerBuilder.php create mode 100644 src/Kicker.php create mode 100644 src/KickerBuilderInterface.php create mode 100644 src/KickerInterface.php create mode 100644 src/KickerManager.php create mode 100644 src/KickerManagerInterface.php create mode 100644 src/Plugin/ExtraField/Display/Kicker.php diff --git a/src/ContentPartnershipKickerBuilder.php b/src/ContentPartnershipKickerBuilder.php new file mode 100644 index 0000000..7a5eaa8 --- /dev/null +++ b/src/ContentPartnershipKickerBuilder.php @@ -0,0 +1,55 @@ +entityTypeManager = $entity_type_manager; + } + + /** + * {@inheritdoc} + */ + public function build(KickerInterface $kicker, ContentEntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { + // If it is tagged with a term from the Content Partnerships taxonomy, + // then that term is displayed. + if ($entity->hasField('field_sponsored')) { + if ($reference = $entity->get('field_sponsored')->first()) { + $term = $this->entityTypeManager->getStorage('taxonomy_term') + ->load($reference->getString()); + if ($term) { + // A Content Partnerships term, + // then use it as the kicker but with no path. + $kicker + ->setEntity($term) + ->setText($term->getName()) + ->setBuilt(); + } + } + } + } + +} diff --git a/src/DefaultKickerBuilder.php b/src/DefaultKickerBuilder.php new file mode 100644 index 0000000..a946ed9 --- /dev/null +++ b/src/DefaultKickerBuilder.php @@ -0,0 +1,156 @@ +entityTypeManager = $entity_type_manager; + $this->router = $router; + $this->pathProcessor = $path_processor; + $this->nodeResolver = $node_resolver; + } + + /** + * {@inheritdoc} + */ + public function build(KickerInterface $kicker, ContentEntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { + // The term used for the kicker should follow the same logic + // that we use for the breadcrumb/paths. + // It is the last entity that is in the path that should be used. + // NB: Cannot use the breadcrumb as it always builds the current page. + $path_elements = explode('/', $entity->toUrl()->toString()); + while (count($path_elements) > 1) { + array_pop($path_elements); + // Build a request for the path. + $route_request = $this->getRequestForPath(implode('/', $path_elements)); + if ($route_request) { + $route_match = RouteMatch::createFromRequest($route_request); + foreach ($route_match->getParameters() as $entity) { + if ($entity instanceof EntityInterface) { + + // If the entity is a node, it may be a term node, + // in which case we want to use the term's label not the node's. + if ($entity->getEntityTypeId() == 'node' && $tid = $this->nodeResolver->getReferencedBy($entity->id())) { + $entity = $this->entityTypeManager->getStorage('taxonomy_term') + ->load($tid); + } + + $kicker->setEntity($entity) + ->setText($entity->label()) + ->setUrl($entity->toUrl()) + ->setBuilt(); + // Found the last entity, so do no more. + return; + } + } + } + } + } + + /** + * Matches a path in the router. + * + * Shameless copy of core/modules/system/src/PathBasedBreadcrumbBuilder.php. + * + * @param string $path + * The request path with a leading slash. + * + * @return \Symfony\Component\HttpFoundation\Request + * A populated request object or NULL if the path couldn't be matched. + */ + protected function getRequestForPath($path) { + $request = Request::create($path); + // Performance optimization: set a short accept header to reduce overhead in + // AcceptHeaderMatcher when matching the request. + $request->headers->set('Accept', 'text/html'); + // Find the system path by resolving aliases, language prefix, etc. + $processed = $this->pathProcessor->processInbound($path, $request); + if (empty($processed) || !empty($exclude[$processed])) { + // This resolves to the front page. + return NULL; + } + + // Attempt to match this path to provide a fully built request. + try { + $request->attributes->add($this->router->matchRequest($request)); + return $request; + } + catch (ParamNotConvertedException $e) { + return NULL; + } + catch (ResourceNotFoundException $e) { + return NULL; + } + catch (MethodNotAllowedException $e) { + return NULL; + } + catch (AccessDeniedHttpException $e) { + return NULL; + } + } + +} diff --git a/src/Kicker.php b/src/Kicker.php new file mode 100644 index 0000000..09f72c7 --- /dev/null +++ b/src/Kicker.php @@ -0,0 +1,187 @@ +built; + } + + /** + * {@inheritdoc} + */ + public function setBuilt($bool = TRUE) { + $this->built = $bool; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setUrl(Url $url) { + $this->url = $url; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getUrl() { + if ($this->url instanceof Url) { + return $this->url; + } + + return NULL; + } + + /** + * {@inheritdoc} + */ + public function getText() { + return $this->text; + } + + /** + * {@inheritdoc} + */ + public function getEntity() { + if ($this->entity instanceof EntityInterface) { + return $this->entity; + } + + return NULL; + } + + /** + * {@inheritdoc} + */ + public function setText($text) { + $this->text = $text; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setEntity(EntityInterface $entity) { + $this->entity = $entity; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCacheTags() { + if ($entity = $this->getEntity()) { + // If a term changes, then the cache should be invalidated. + $this->addCacheTags($entity->getCacheTags()); + } + + return $this->cacheTags; + } + + /** + * {@inheritdoc} + */ + public function toRenderable() { + if (!$this->built()) { + // Nothing to render. + return []; + } + + if (empty($this->getText())) { + // Nothing to render. + return []; + } + + $build = []; + if ($this->getEntity()) { + $build = [ + '#cache' => [ + 'contexts' => $this->getCacheContexts(), + 'tags' => $this->getCacheTags(), + 'max-age' => $this->getCacheMaxAge(), + ], + ]; + } + + if (empty($this->getUrl())) { + // Text only. + $build += [ + '#markup' => $this->getText(), + ]; + } + else { + $build += [ + '#type' => 'link', + '#title' => $this->getText(), + '#url' => $this->getUrl(), + ]; + } + + return $build; + } + + /** + * {@inheritdoc} + */ + public function reset() { + $this->url = NULL; + $this->text = NULL; + $this->entity = NULL; + $this->built = FALSE; + + return $this; + } + +} diff --git a/src/KickerBuilderInterface.php b/src/KickerBuilderInterface.php new file mode 100644 index 0000000..893f6a9 --- /dev/null +++ b/src/KickerBuilderInterface.php @@ -0,0 +1,29 @@ +setKicker($kicker); + } + + /** + * {@inheritdoc} + */ + public function setKicker(KickerInterface $kicker) { + $this->kicker = $kicker; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addBuilder(KickerBuilderInterface $builder, $priority) { + $this->builders[$priority][] = $builder; + // Force the builders to be re-sorted. + $this->sortedBuilders = NULL; + } + + /** + * {@inheritdoc} + */ + public function buildKicker(ContentEntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { + // Ensure a fresh kicker to start with. + $this->kicker->reset(); + + // Call the build method of registered kicker builders, + // until one of them returns the kicker. + foreach ($this->getSortedBuilders() as $builder) { + $builder->build($this->kicker, $entity, $display, $view_mode); + if ($this->kicker->built()) { + return $this->kicker; + } + } + + // Return an unbuilt kicker. + return $this->kicker->reset(); + } + + /** + * Returns the sorted array of kicker builders. + * + * @return KickerBuilderInterface[] + * An array of kicker builder objects. + */ + protected function getSortedBuilders() { + if (!isset($this->sortedBuilders)) { + // Sort the builders according to priority. + krsort($this->builders); + // Merge nested builders from $this->builders into $this->sortedBuilders. + $this->sortedBuilders = []; + foreach ($this->builders as $builders) { + $this->sortedBuilders = array_merge($this->sortedBuilders, $builders); + } + } + return $this->sortedBuilders; + } + +} diff --git a/src/KickerManagerInterface.php b/src/KickerManagerInterface.php new file mode 100644 index 0000000..bccfe10 --- /dev/null +++ b/src/KickerManagerInterface.php @@ -0,0 +1,51 @@ +manager = $manager; + parent::__construct($configuration, $plugin_id, $plugin_definition); + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('dennis_kicker.manager') + ); + } + + /** + * {@inheritdoc} + */ + public function viewElements(ContentEntityInterface $entity) { + return $this->manager->buildKicker( + $entity, + $this->getEntityViewDisplay(), + $this->getViewMode()) + ->toRenderable(); + } + +} From d980d549a4d2758684ca0bfba4f76d10eb053fd7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 14:29:08 +0000 Subject: [PATCH 070/110] Updating Jenkinsfile --- Jenkinsfile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0df0f0f..f9e63e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,22 @@ pipeline { triggers { githubPush() } options { disableConcurrentBuilds() } stages { - stage('Static code analysis') { + stage('Unit Test') { + when { + expression { branch "PR-*" } + expression { branch "1.x" } + } + steps { + sh ''' + composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction + mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + mkdir -p build && mkdir -p build/coverage/ + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ + ''' + publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/coverage', reportFiles: 'index.html', reportName: 'Coverage Report', reportTitles: '']) + } + } + stage('Static Code Analysis') { steps { withSonarQubeEnv('lighting-prototype') { sh "sonar-scanner" From 7f63fe288f3d8ee9089d0e72ac7fc90dbe00e4db Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 15:04:00 +0000 Subject: [PATCH 071/110] Updating sonar --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 12b644d..fd15424 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.projectName=phpunit example sonar.links.homepage=https://github.com/simon-peacock/phpunit_example sonar.sources=src -sonar.host.url=http://ec2-34-248-104-77.eu-west-1.compute.amazonaws.com:9000 +sonar.host.url=http://ec2-34-255-179-73.eu-west-1.compute.amazonaws.com:9000 sonar.verbose=false sonar.sourceEncoding=UTF-8 From f0431d646af8ab8aa65023115a648205c5f3c6e5 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 15:10:07 +0000 Subject: [PATCH 072/110] Updating jenkinsfile --- Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f9e63e0..bd8c9ef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,10 +14,8 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - mkdir -p build && mkdir -p build/coverage/ drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ ''' - publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'build/coverage', reportFiles: 'index.html', reportName: 'Coverage Report', reportTitles: '']) } } stage('Static Code Analysis') { From 1ad3f9aa95e17fb64ea7c3c810131ee0c13dca03 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 15:13:13 +0000 Subject: [PATCH 073/110] Updating Jenkinsfile --- Jenkinsfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bd8c9ef..92a6dac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,11 +19,15 @@ pipeline { } } stage('Static Code Analysis') { - steps { - withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner" - } - } + when { + expression { branch "PR-*" } + expression { branch "1.x" } + } + steps { + withSonarQubeEnv('lighting-prototype') { + sh "sonar-scanner" + } + } } } } From f923bdd5dbf7f625502f604c8563f6ba8f337692 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 15:29:12 +0000 Subject: [PATCH 074/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 92a6dac..2b20d95 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ -coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' } } From 6e837f6db3016cf4ef0cf77725e698f0337671e9 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 15:43:39 +0000 Subject: [PATCH 075/110] Updaing Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b20d95..1089317 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ -coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' } } From 22a41111b17019ca20116831b770e3de06e3c78a Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 15:44:21 +0000 Subject: [PATCH 076/110] Updaing Jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1089317..825ec1d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,4 +31,3 @@ pipeline { } } } - From 8425a00efea214a89c58b601e8e8898bc4511ac9 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 16:30:10 +0000 Subject: [PATCH 077/110] Updating sonar and Jenkins file --- Jenkinsfile | 33 +++++++++++++++++++-------------- sonar-project.properties | 3 +++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 825ec1d..6038165 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,19 +5,24 @@ pipeline { triggers { githubPush() } options { disableConcurrentBuilds() } stages { - stage('Unit Test') { - when { - expression { branch "PR-*" } - expression { branch "1.x" } - } - steps { - sh ''' - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml - ''' - } - } + + +// stage('Unit Test') { +// when { +// expression { branch "PR-*" } +// expression { branch "1.x" } +// } +// steps { +// sh ''' +// composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction +// mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal +// drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml +// ''' +// } +// } + + + stage('Static Code Analysis') { when { expression { branch "PR-*" } @@ -25,7 +30,7 @@ pipeline { } steps { withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner" + sh "sonar-scanner " } } } diff --git a/sonar-project.properties b/sonar-project.properties index fd15424..a543121 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,9 +3,12 @@ sonar.projectName=phpunit example sonar.links.homepage=https://github.com/simon-peacock/phpunit_example sonar.sources=src +sonar.exclusions=**drupal** sonar.host.url=http://ec2-34-255-179-73.eu-west-1.compute.amazonaws.com:9000 sonar.verbose=false sonar.sourceEncoding=UTF-8 +sonar.pullrequest.github.repository=https://github.com/simon-peacock/phpunit_example + sonar.dependencyCheck.reportPath=dependency-check-report.xml sonar.dependencyCheck.htmlReportPath=dependency-check-report.html From 043697bc5730d2db449f9d5c606a5ac71381e578 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Fri, 9 Nov 2018 16:51:06 +0000 Subject: [PATCH 078/110] Updating Jenkinsfile --- Jenkinsfile | 31 +++++++++++++------------------ sonar-project.properties | 1 + 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6038165..2325c3d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,24 +5,19 @@ pipeline { triggers { githubPush() } options { disableConcurrentBuilds() } stages { - - -// stage('Unit Test') { -// when { -// expression { branch "PR-*" } -// expression { branch "1.x" } -// } -// steps { -// sh ''' -// composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction -// mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal -// drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml -// ''' -// } -// } - - - + stage('Unit Test') { + when { + expression { branch "PR-*" } + expression { branch "1.x" } + } + steps { + sh ''' + composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction + mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml + ''' + } + } stage('Static Code Analysis') { when { expression { branch "PR-*" } diff --git a/sonar-project.properties b/sonar-project.properties index a543121..cc1cf52 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -7,6 +7,7 @@ sonar.exclusions=**drupal** sonar.host.url=http://ec2-34-255-179-73.eu-west-1.compute.amazonaws.com:9000 sonar.verbose=false sonar.sourceEncoding=UTF-8 +sonar.pullrequest.provider=github sonar.pullrequest.github.repository=https://github.com/simon-peacock/phpunit_example From f19de5336af2aece75f4c3c61070346218c8cba9 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 08:12:32 +0000 Subject: [PATCH 079/110] Updating Jenkinsfile --- Jenkinsfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2325c3d..d92b2fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,20 +8,25 @@ pipeline { stage('Unit Test') { when { expression { branch "PR-*" } - expression { branch "1.x" } } steps { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml + $class: 'CloverPublisher', + cloverReportDir: '/var/coverage/reports/', + cloverReportFileName: 'coverage.xml', + healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80], + unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50], + failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0] + ''' } } stage('Static Code Analysis') { when { expression { branch "PR-*" } - expression { branch "1.x" } } steps { withSonarQubeEnv('lighting-prototype') { From a62bfbc05c6b567d3d462fb4349fee8cd7dcecc3 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 08:19:31 +0000 Subject: [PATCH 080/110] Updating Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d92b2fd..c8f09ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,8 +14,9 @@ pipeline { composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml + mkdir reports $class: 'CloverPublisher', - cloverReportDir: '/var/coverage/reports/', + cloverReportDir: 'reports/', cloverReportFileName: 'coverage.xml', healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80], unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50], From 4f600fccc9ceb75e562f4599dfa4f68c0c02f2a7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 08:25:29 +0000 Subject: [PATCH 081/110] Updating Jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c8f09ae..2d05a1d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,6 @@ pipeline { composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml - mkdir reports $class: 'CloverPublisher', cloverReportDir: 'reports/', cloverReportFileName: 'coverage.xml', From f378e07938c8ba6a3dda3456fe221d8b6f9f9db8 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 10:08:40 +0000 Subject: [PATCH 082/110] Updating Jenkinsfile --- Jenkinsfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2d05a1d..7edbdb7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,14 +14,16 @@ pipeline { composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml - $class: 'CloverPublisher', - cloverReportDir: 'reports/', - cloverReportFileName: 'coverage.xml', - healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80], - unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50], - failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0] - ''' + + step([ + $class: 'CloverPublisher', + cloverReportDir: 'target/site', + cloverReportFileName: 'clover.xml', + healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80], // optional, default is: method=70, conditional=80, statement=80 + unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50], // optional, default is none + failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0] // optional, default is none + ]) } } stage('Static Code Analysis') { From 0b6b2012741613e175dc4d7702fd8fa5482823d1 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 10:20:19 +0000 Subject: [PATCH 083/110] Updating Jenkinsfile --- Jenkinsfile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7edbdb7..9b5ed71 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,15 +15,7 @@ pipeline { mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' - - step([ - $class: 'CloverPublisher', - cloverReportDir: 'target/site', - cloverReportFileName: 'clover.xml', - healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80], // optional, default is: method=70, conditional=80, statement=80 - unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50], // optional, default is none - failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0] // optional, default is none - ]) + publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'coverage', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '']) } } stage('Static Code Analysis') { From 9ce1476932ede0446ff42da9a0d938408d8f147b Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 10:27:52 +0000 Subject: [PATCH 084/110] Updating Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9b5ed71..2e0642b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,6 +13,7 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + mkdir coverage drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'coverage', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '']) From f4e1045e0d947226c1ab3182575ca6b4fd0d2a70 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 10:38:14 +0000 Subject: [PATCH 085/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e0642b..dde85a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { mkdir coverage drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' - publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'coverage', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '']) + publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'reports', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '']) } } stage('Static Code Analysis') { From effc9c55c7ef4ae70d390ddadfb77501586945c7 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 10:46:38 +0000 Subject: [PATCH 086/110] Updating Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dde85a0..abef057 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,10 +13,9 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - mkdir coverage drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' - publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'reports', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '']) + publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'reports', reportFiles: 'index.html', reportName: 'HTML-Report', reportTitles: '']) } } stage('Static Code Analysis') { From b6bf72b1df4c98505ab115333e72ad52a3a6519d Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 10:53:57 +0000 Subject: [PATCH 087/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index abef057..29516f2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' - publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'reports', reportFiles: 'index.html', reportName: 'HTML-Report', reportTitles: '']) + publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'reports', reportFiles: 'phpunit.xml', reportName: 'HTML-Report', reportTitles: '']) } } stage('Static Code Analysis') { From 6f76cdede5a68faffb54883c3ef8b75a31a087f5 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 11:14:07 +0000 Subject: [PATCH 088/110] Updating Jenkinsfile --- Jenkinsfile | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 29516f2..49cd22c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,20 +13,46 @@ pipeline { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' - publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'reports', reportFiles: 'phpunit.xml', reportName: 'HTML-Report', reportTitles: '']) } } - stage('Static Code Analysis') { - when { - expression { branch "PR-*" } - } - steps { - withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner " - } - } + stage("PHPUnit") { + sh 'vendor/phpunit/phpunit/phpunit --bootstrap build/bootstrap.php --configuration phpunit-coverage.xml' + } + + stage("Publish Coverage") { + publishHTML (target: [ + allowMissing: false, + alwaysLinkToLastBuild: false, + keepAll: true, + reportDir: 'build/coverage', + reportFiles: 'index.html', + reportName: "Coverage Report" + + ]) + } + + stage("Publish Clover") { + step([$class: 'CloverPublisher', cloverReportDir: 'build/logs', cloverReportFileName: 'clover.xml']) + } + + stage('Checkstyle Report') { + sh 'vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=phpcs.xml --extensions=php,inc --ignore=autoload.php --ignore=vendor/ app || exit 0' + checkstyle pattern: 'build/logs/checkstyle.xml' + } + + stage('Mess Detection Report') { + sh 'vendor/bin/phpmd app xml phpmd.xml --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php || exit 0' + pmd canRunOnFailed: true, pattern: 'build/logs/pmd.xml' + } + + stage('CPD Report') { + sh 'phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude vendor app || exit 0' /* should be vendor/bin/phpcpd but... conflicts... */ + dry canRunOnFailed: true, pattern: 'build/logs/pmd-cpd.xml' + } + + stage('Lines of Code') { + sh 'vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml app' } } } From b27f2b7048e209cf5e2d30f68a03859fb7dd7b33 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 11:15:07 +0000 Subject: [PATCH 089/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 49cd22c..b3d840b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { } } stage("PHPUnit") { - sh 'vendor/phpunit/phpunit/phpunit --bootstrap build/bootstrap.php --configuration phpunit-coverage.xml' + sh 'drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml' } stage("Publish Coverage") { From 885c5a955f71d433ac540d370b69f959025d5b32 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 11:17:34 +0000 Subject: [PATCH 090/110] Updating Jenkinsfile --- Jenkinsfile | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b3d840b..bf50192 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,26 +33,36 @@ pipeline { } stage("Publish Clover") { - step([$class: 'CloverPublisher', cloverReportDir: 'build/logs', cloverReportFileName: 'clover.xml']) + steps { + step([$class: 'CloverPublisher', cloverReportDir: 'build/logs', cloverReportFileName: 'clover.xml']) + } } stage('Checkstyle Report') { - sh 'vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=phpcs.xml --extensions=php,inc --ignore=autoload.php --ignore=vendor/ app || exit 0' - checkstyle pattern: 'build/logs/checkstyle.xml' + steps { + sh 'vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=phpcs.xml --extensions=php,inc --ignore=autoload.php --ignore=vendor/ app || exit 0' + checkstyle pattern: 'build/logs/checkstyle.xml' + } } stage('Mess Detection Report') { - sh 'vendor/bin/phpmd app xml phpmd.xml --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php || exit 0' - pmd canRunOnFailed: true, pattern: 'build/logs/pmd.xml' + steps { + sh 'vendor/bin/phpmd app xml phpmd.xml --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php || exit 0' + pmd canRunOnFailed: true, pattern: 'build/logs/pmd.xml' + } } stage('CPD Report') { - sh 'phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude vendor app || exit 0' /* should be vendor/bin/phpcpd but... conflicts... */ - dry canRunOnFailed: true, pattern: 'build/logs/pmd-cpd.xml' + steps { + sh 'phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude vendor app || exit 0' /* should be vendor/bin/phpcpd but... conflicts... */ + dry canRunOnFailed: true, pattern: 'build/logs/pmd-cpd.xml' + } } stage('Lines of Code') { - sh 'vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml app' + steps { + sh 'vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml app' + } } } } From 98a36a899fd7e2ce379245c5daf0750769b1cc8f Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 11:20:07 +0000 Subject: [PATCH 091/110] Updating Jenkinsfile --- Jenkinsfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf50192..aac7e64 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,11 +17,14 @@ pipeline { } } stage("PHPUnit") { - sh 'drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml' + steps { + sh 'drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml' + } } stage("Publish Coverage") { - publishHTML (target: [ + steps { + publishHTML (target: [ allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, @@ -29,7 +32,8 @@ pipeline { reportFiles: 'index.html', reportName: "Coverage Report" - ]) + ]) + } } stage("Publish Clover") { From 1bf1cd0ea367486ee895442837bb850d2db66a4d Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 11:53:06 +0000 Subject: [PATCH 092/110] Updating Jenkinsfile --- Jenkinsfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aac7e64..ea70be4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,15 +12,12 @@ pipeline { steps { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal + mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal --quiet + mkdir coverage + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/build/phpunit.xml ''' } } - stage("PHPUnit") { - steps { - sh 'drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml' - } - } stage("Publish Coverage") { steps { @@ -29,7 +26,7 @@ pipeline { alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'build/coverage', - reportFiles: 'index.html', + reportFiles: 'phpunit.xml', reportName: "Coverage Report" ]) @@ -68,5 +65,15 @@ pipeline { sh 'vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml app' } } + stage('Static Code Analysis') { + when { + expression { branch "PR-*" } + } + steps { + withSonarQubeEnv('lighting-prototype') { + sh "sonar-scanner " + } + } + } } } From 9fc339b07f8b9e99e72a6fcc89c190ce7d62b31e Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 12:14:18 +0000 Subject: [PATCH 093/110] Updating Jenkinsfile --- Jenkinsfile | 53 +++------------------------------------- sonar-project.properties | 2 -- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ea70be4..82eba9d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ #!/usr/bin/env groovy pipeline { - agent { label 'drupal8' } + agent { label 'dennis-php' } triggers { githubPush() } options { disableConcurrentBuilds() } stages { @@ -12,59 +12,12 @@ pipeline { steps { sh ''' composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal --quiet + mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal mkdir coverage - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/build/phpunit.xml + drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' } } - - stage("Publish Coverage") { - steps { - publishHTML (target: [ - allowMissing: false, - alwaysLinkToLastBuild: false, - keepAll: true, - reportDir: 'build/coverage', - reportFiles: 'phpunit.xml', - reportName: "Coverage Report" - - ]) - } - } - - stage("Publish Clover") { - steps { - step([$class: 'CloverPublisher', cloverReportDir: 'build/logs', cloverReportFileName: 'clover.xml']) - } - } - - stage('Checkstyle Report') { - steps { - sh 'vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=phpcs.xml --extensions=php,inc --ignore=autoload.php --ignore=vendor/ app || exit 0' - checkstyle pattern: 'build/logs/checkstyle.xml' - } - } - - stage('Mess Detection Report') { - steps { - sh 'vendor/bin/phpmd app xml phpmd.xml --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php || exit 0' - pmd canRunOnFailed: true, pattern: 'build/logs/pmd.xml' - } - } - - stage('CPD Report') { - steps { - sh 'phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude vendor app || exit 0' /* should be vendor/bin/phpcpd but... conflicts... */ - dry canRunOnFailed: true, pattern: 'build/logs/pmd-cpd.xml' - } - } - - stage('Lines of Code') { - steps { - sh 'vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml app' - } - } stage('Static Code Analysis') { when { expression { branch "PR-*" } diff --git a/sonar-project.properties b/sonar-project.properties index cc1cf52..6dd1723 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -9,7 +9,5 @@ sonar.verbose=false sonar.sourceEncoding=UTF-8 sonar.pullrequest.provider=github -sonar.pullrequest.github.repository=https://github.com/simon-peacock/phpunit_example - sonar.dependencyCheck.reportPath=dependency-check-report.xml sonar.dependencyCheck.htmlReportPath=dependency-check-report.html From 82a42f8dbb6b93a12d9d0bb328d8a093da781c06 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:07:55 +0000 Subject: [PATCH 094/110] Updating Jenkinsfile --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 82eba9d..d7ad15a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,19 +5,21 @@ pipeline { triggers { githubPush() } options { disableConcurrentBuilds() } stages { + + stage('Unit Test') { when { expression { branch "PR-*" } } steps { sh ''' - composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction - mkdir -p drupal/web/modules/${JOB_NAME%/*} && rsync -av --progress . drupal/web/modules/${JOB_NAME%/*} --exclude drupal - mkdir coverage - drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/${JOB_NAME%/*}/tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml + composer install + ls -la ''' } } + + stage('Static Code Analysis') { when { expression { branch "PR-*" } From 013c9f70b3d903655564d4bec5f2b0a7364dcf83 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:12:12 +0000 Subject: [PATCH 095/110] Updating Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index d7ad15a..bd0b1c8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,6 +15,7 @@ pipeline { sh ''' composer install ls -la + vendor/bin/phpunit -c tests/ ''' } } From d532a5c47f960f73d8680d719162b5657f8337a1 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:13:22 +0000 Subject: [PATCH 096/110] Updating Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bd0b1c8..9671929 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,8 +14,8 @@ pipeline { steps { sh ''' composer install - ls -la - vendor/bin/phpunit -c tests/ + ls -la vendor/bin/ + ''' } } From c75392e870ae19034d39c431c1dea0e54df5de4b Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:14:19 +0000 Subject: [PATCH 097/110] Updating Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9671929..7a82ff3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,8 +14,8 @@ pipeline { steps { sh ''' composer install - ls -la vendor/bin/ - + ls -la vendor/ + ''' } } From 7725f6bf4286aa1efedc0edface371a0c8ce3722 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:15:28 +0000 Subject: [PATCH 098/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7a82ff3..437a7e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { steps { sh ''' composer install - ls -la vendor/ + ls -la vendor/composer/ ''' } From ff6316bae6ef0383d7e93f2dd6ffbc849a13b70a Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:23:32 +0000 Subject: [PATCH 099/110] Updating Jenkinsfile --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b496d60..745fa89 100644 --- a/composer.json +++ b/composer.json @@ -10,5 +10,7 @@ "issues": "https://www.drupal.org/project/issues/term_node", "source": "http://cgit.drupalcode.org/term_node" }, - "require": { } + "require": { + "phpunit/phpunit": "7.x" + } } From 0e2b6ab3b811a424931caf5c1372b6612426fa26 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:25:15 +0000 Subject: [PATCH 100/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 437a7e4..fb3bb88 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { steps { sh ''' composer install - ls -la vendor/composer/ + ls -la vendor/bin/ ''' } From f92ddfd41ffebbe86e1537facdf189a02720c6d8 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:27:14 +0000 Subject: [PATCH 101/110] Updating Jenkinsfile --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fb3bb88..42f2431 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,9 +13,8 @@ pipeline { } steps { sh ''' - composer install - ls -la vendor/bin/ - + composer install \ + && vendor/bin/phpunit -c tests/ ''' } } From 4cea5f072613e6ffd9cc0ba464a8cd32d88608df Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:29:50 +0000 Subject: [PATCH 102/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 42f2431..827876a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { steps { sh ''' composer install \ - && vendor/bin/phpunit -c tests/ + && vendor/bin/phpunit ''' } } From 64a9c5e016308a07b8688e4b53b879732a7362b0 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Mon, 12 Nov 2018 16:34:07 +0000 Subject: [PATCH 103/110] Updating Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 827876a..8f856dc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,8 +13,8 @@ pipeline { } steps { sh ''' - composer install \ - && vendor/bin/phpunit + composer install + vendor/bin/phpunit tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml ''' } } From 5dd05000c97eed750166cf6b3f02c78d6b0a80af Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 13 Nov 2018 11:14:08 +0000 Subject: [PATCH 104/110] Updating Jenkinsfile to use global libraries --- Jenkinsfile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f856dc..35611cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,25 +1,20 @@ #!/usr/bin/env groovy +@Library('lightning-shared-libraries@master') _ + pipeline { agent { label 'dennis-php' } triggers { githubPush() } options { disableConcurrentBuilds() } stages { - - stage('Unit Test') { when { expression { branch "PR-*" } } steps { - sh ''' - composer install - vendor/bin/phpunit tests/ --coverage-clover $WORKSPACE/reports/coverage.xml --log-junit $WORKSPACE/reports/phpunit.xml - ''' + buildDrupal() } } - - stage('Static Code Analysis') { when { expression { branch "PR-*" } From 60cdd6de7414552d96a602d498759200bd0238b6 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 13 Nov 2018 11:31:23 +0000 Subject: [PATCH 105/110] Updating function call --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 35611cf..31253f5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { expression { branch "PR-*" } } steps { - buildDrupal() + buildPhpSite() } } stage('Static Code Analysis') { From 1bb3d892ff18902200d059d169fec2c5d970ebdc Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 13 Nov 2018 11:54:48 +0000 Subject: [PATCH 106/110] Updating Jenkinsfile --- Jenkinsfile | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 31253f5..ea3b2b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,16 +6,31 @@ pipeline { agent { label 'dennis-php' } triggers { githubPush() } options { disableConcurrentBuilds() } + stages { + + stage('Build Environment') { + + when { + expression { branch "PR-*" } + } + steps { + standardInstallationDrupal() + } + } + stage('Unit Test') { + when { expression { branch "PR-*" } } steps { - buildPhpSite() + drupalPhpUnitTest() } } + stage('Static Code Analysis') { + when { expression { branch "PR-*" } } @@ -24,6 +39,7 @@ pipeline { sh "sonar-scanner " } } + } } } From 5a7f5063fc6e47d1954cb1c0a24bf8f9035f7fc9 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 13 Nov 2018 12:08:42 +0000 Subject: [PATCH 107/110] Updating script --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ea3b2b2..2c2036f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { stages { stage('Build Environment') { - + when { expression { branch "PR-*" } } @@ -36,7 +36,7 @@ pipeline { } steps { withSonarQubeEnv('lighting-prototype') { - sh "sonar-scanner " + sonnarScanner() } } From 786c4916ac86d385edae19678f2df717d16edc8d Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 13 Nov 2018 12:25:13 +0000 Subject: [PATCH 108/110] Updating pipeline --- Jenkinsfile | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c2036f..25fceb0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,44 +2,4 @@ @Library('lightning-shared-libraries@master') _ -pipeline { - agent { label 'dennis-php' } - triggers { githubPush() } - options { disableConcurrentBuilds() } - - stages { - - stage('Build Environment') { - - when { - expression { branch "PR-*" } - } - steps { - standardInstallationDrupal() - } - } - - stage('Unit Test') { - - when { - expression { branch "PR-*" } - } - steps { - drupalPhpUnitTest() - } - } - - stage('Static Code Analysis') { - - when { - expression { branch "PR-*" } - } - steps { - withSonarQubeEnv('lighting-prototype') { - sonnarScanner() - } - } - - } - } -} +myDeliveryPipeline() From ead29c34be0d48e04b6d2bec50d347d2bafd7f5d Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 13 Nov 2018 12:29:10 +0000 Subject: [PATCH 109/110] Updating Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 25fceb0..6a2b8bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,4 +2,4 @@ @Library('lightning-shared-libraries@master') _ -myDeliveryPipeline() +drupalUnitTest() From 05152ffbd9fce0e608b83dd512147e3c3e173db0 Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Tue, 13 Nov 2018 13:58:08 +0000 Subject: [PATCH 110/110] Updating Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6a2b8bc..a5f5d44 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,7 @@ #!/usr/bin/env groovy - +// Repository can be found at https://github.com/dennisinteractive/lightning-jenkins-build-scripts +// Required Library call @Library('lightning-shared-libraries@master') _ +// CAll Drupal unit test drupalUnitTest()