Commit 793bd43c authored by Ines WALLON's avatar Ines WALLON
Browse files

refactor gitlab-ci.yml

parent f7a141b2
Pipeline #652 canceled with stages
in 14 seconds
.code_quality_default:
stage: Code quality
image: libert/drupal-php-dev:7.4
needs: ['Build Drupal']
.phpunit_default:
stage: Test
needs: ['Build Drupal']
image: docker/compose:latest
before_script:
- docker login -u $HUB_USERNAME -p $HUB_PASSWORD
- sed -i "s/FIXUID=1000/FIXUID=0/g" .env
- sed -i "s/FIXGID=1000/FIXGID=0/g" .env
- sed -i '/COMPOSER_AUTH/d' .env
- echo CMIS_URL_NUXEO=$CMIS_URL_NUXEO >> .env
- echo CMIS_URL_ALFRESCO=$CMIS_URL_ALFRESCO >> .env
- docker network create drupalci_nw
- docker-compose up -d
- sleep 30
- $WEB_CONTAINTER bash /project/scripts/install.sh "skeletond9" "d9@example.com"
stages:
- init
- Code quality
- Code quality PHP 7.4
- Code quality PHP 8.0
- Test
services:
......@@ -36,116 +15,9 @@ variables:
CMIS_URL_NUXEO: "http://nuxeo:8080/nuxeo/json/cmis"
CMIS_URL_ALFRESCO: "http://proxy:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser"
'Build Drupal':
stage: init
image: libert/drupal-php-dev:7.4
tags:
- spud
script:
- mkdir /usr/local/composer || true
- echo $COMPOSER_AUTH > /usr/local/composer/auth.json
- cp config/.init_files/exemple.docker-compose.yml docker-compose.yml
- cp config/.init_files/exemple.env .env
- sed -i '/COMPOSER_AUTH/d' .env
- mkdir -p web/sites/default/
- cp config/drupal/example.settings.local.php config/drupal/settings.local.php
- cp config/drupal/example.settings.php web/sites/default/settings.php
- composer install --dev
artifacts:
paths:
- config/
- vendor/
- web/
- .env
- docker-compose.yml
rules:
- if: $CI_COMMIT_BRANCH == "develop" || $CI_COMMIT_BRANCH == "contrib_modules"
PHPCS:
extends: .code_quality_default
tags:
- spud
script:
- phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md web/modules/contrib_project/ --report-junit=./phpcs.xml
artifacts:
when: always
reports:
junit: phpcs.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPMD:
extends: .code_quality_default
tags:
- spud
script:
- phpmd web/modules/contrib_project/ ansi scripts/quality/phpmd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPCPD:
extends: .code_quality_default
tags:
- spud
script:
- phpcpd web/modules/contrib_project/ --log-pmd phpcpd.xml
artifacts:
when: always
reports:
junit: phpcpd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPStan:
extends: .code_quality_default
tags:
- spud
script:
- ./vendor/bin/drupal-check --memory-limit 512M --format=junit -d web/modules/contrib_project/ > phpstan.xml
artifacts:
when: always
reports:
junit: phpstan.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'PHPUnit : CMIS':
extends: .phpunit_default
tags:
- spud
script:
- docker-compose -f web/modules/contrib_project/cmis/tests/docker-compose.yml up -d
- $WEB_CONTAINTER timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' $CMIS_URL_ALFRESCO)" != "401" ]]; do sleep 5; done'
- $WEB_CONTAINTER phpunit -v --log-junit ./phpunit_cmis.xml --testsuite=cmis
artifacts:
when: always
reports:
junit: phpunit_cmis.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'PHPUnit : Theme permission':
extends: .phpunit_default
tags:
- spud
script:
- $WEB_CONTAINTER phpunit -v --log-junit ./phpunit_theme_permission.xml --testsuite=theme_permission
artifacts:
when: always
reports:
junit: phpunit_theme_permission.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
include:
- local: config/.gitlab/build_drupal.yml
- local: config/.gitlab/code_quality_default.yml
- local: config/.gitlab/code_quality_php8.yml
- local: config/.gitlab/phpunit_default.yml
'PHPUnit : paragraphs Usage':
extends: .phpunit_default
tags:
- spud
script:
- $WEB_CONTAINTER phpunit -v --log-junit ./phpunit_paragraphs_usage.xml --testsuite=paragraphs_usage
artifacts:
when: always
reports:
junit: phpunit_paragraphs_usage.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'Build Drupal':
stage: init
image: libert/drupal-php-dev:7.4
tags:
- spud
script:
- mkdir /usr/local/composer || true
- echo $COMPOSER_AUTH > /usr/local/composer/auth.json
- cp config/.init_files/exemple.docker-compose.yml docker-compose.yml
- cp config/.init_files/exemple.env .env
- sed -i '/COMPOSER_AUTH/d' .env
- mkdir -p web/sites/default/
- cp config/drupal/example.settings.local.php config/drupal/settings.local.php
- cp config/drupal/example.settings.php web/sites/default/settings.php
- composer install --dev
artifacts:
paths:
- config/
- vendor/
- web/
- .env
- docker-compose.yml
rules:
- if: $CI_COMMIT_BRANCH == "develop" || $CI_COMMIT_BRANCH == "contrib_modules"
.code_quality_default:
stage: Code quality PHP 7.4
image: libert/drupal-php-dev:7.4
needs: ['Build Drupal']
PHPCS:
extends: .code_quality_default
tags:
- spud
script:
- phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md web/modules/contrib_project/ --report-junit=./phpcs.xml
artifacts:
when: always
reports:
junit: phpcs.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPMD:
extends: .code_quality_default
tags:
- spud
script:
- phpmd web/modules/contrib_project/ ansi scripts/quality/phpmd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPCPD:
extends: .code_quality_default
tags:
- spud
script:
- phpcpd web/modules/contrib_project/ --log-pmd phpcpd.xml
artifacts:
when: always
reports:
junit: phpcpd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPStan:
extends: .code_quality_default
tags:
- spud
script:
- ./vendor/bin/drupal-check --memory-limit 512M --format=junit -d web/modules/contrib_project/ > phpstan.xml
artifacts:
when: always
reports:
junit: phpstan.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
.code_quality_php8:
stage: Code quality PHP 8.0
image: libert/drupal-php-dev:8.0
needs: ['Build Drupal']
PHPCS:
extends: .code_quality_php8
tags:
- spud
script:
- phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md web/modules/contrib_project/ --report-junit=./phpcs.xml
artifacts:
when: always
reports:
junit: phpcs.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPMD:
extends: .code_quality_php8
tags:
- spud
script:
- phpmd web/modules/contrib_project/ ansi scripts/quality/phpmd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPCPD:
extends: .code_quality_php8
tags:
- spud
script:
- phpcpd web/modules/contrib_project/ --log-pmd phpcpd.xml
artifacts:
when: always
reports:
junit: phpcpd.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
PHPStan:
extends: .code_quality_php8
tags:
- spud
script:
- ./vendor/bin/drupal-check --memory-limit 512M --format=junit -d web/modules/contrib_project/ > phpstan.xml
artifacts:
when: always
reports:
junit: phpstan.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
.phpunit_default:
stage: Test
needs: ['Build Drupal']
image: docker/compose:latest
before_script:
- docker login -u $HUB_USERNAME -p $HUB_PASSWORD
- sed -i "s/FIXUID=1000/FIXUID=0/g" .env
- sed -i "s/FIXGID=1000/FIXGID=0/g" .env
- sed -i '/COMPOSER_AUTH/d' .env
- echo CMIS_URL_NUXEO=$CMIS_URL_NUXEO >> .env
- echo CMIS_URL_ALFRESCO=$CMIS_URL_ALFRESCO >> .env
- docker network create drupalci_nw
- docker-compose up -d
- sleep 30
- $WEB_CONTAINTER bash /project/scripts/install.sh "skeletond9" "d9@example.com"
'PHPUnit : CMIS':
extends: .phpunit_default
tags:
- spud
script:
- docker-compose -f web/modules/contrib_project/cmis/tests/docker-compose.yml up -d
- $WEB_CONTAINTER timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' $CMIS_URL_ALFRESCO)" != "401" ]]; do sleep 5; done'
- $WEB_CONTAINTER phpunit -v --log-junit ./phpunit_cmis.xml --testsuite=cmis
artifacts:
when: always
reports:
junit: phpunit_cmis.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'PHPUnit : Theme permission':
extends: .phpunit_default
tags:
- spud
script:
- $WEB_CONTAINTER phpunit -v --log-junit ./phpunit_theme_permission.xml --testsuite=theme_permission
artifacts:
when: always
reports:
junit: phpunit_theme_permission.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
'PHPUnit : paragraphs Usage':
extends: .phpunit_default
tags:
- spud
script:
- $WEB_CONTAINTER phpunit -v --log-junit ./phpunit_paragraphs_usage.xml --testsuite=paragraphs_usage
artifacts:
when: always
reports:
junit: phpunit_paragraphs_usage.xml
rules:
- if: $CI_COMMIT_BRANCH == "contrib_modules"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment