Skip to content
Snippets Groups Projects
Commit af6eb763 authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

Merge branch 'feature/metrics' into 'master'

Feature/metrics

See merge request wpdesk/gitlab-ci!170
parents d079992f 920d2f31
No related branches found
No related tags found
No related merge requests found
......@@ -25,54 +25,32 @@ stages:
include:
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/includes/prepare.yml'
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/includes/tests/unit.yml'
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/includes/metrics.yml'
- project: 'wpdesk/gitlab-ci'
ref: 'feature/metrics'
file: '/includes/tests/codeception.yml'
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/includes/tests/codeception-parallel.yml'
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/includes/tests/codeception-smoke.yml'
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/includes/tests/integration.yml'
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/includes/deploy.yml'
phpmetric metrics:
stage: tools
image: wpdesknet/phpunit-woocommerce:0-0
allow_failure: true
when: manual
artifacts:
when: always
expire_in: 1 month
name: "metrics"
paths:
- ${CI_PROJECT_DIR}/phpmetric
script:
- echo ${WPDESK_CI_VERSION}
- composer require phpmetrics/phpmetrics
- composer install --no-progress --prefer-dist
- php ./vendor/bin/phpmetrics --report-html=phpmetric .
churn metrics:
stage: tools
image: wpdesknet/phpunit-woocommerce:0-0
allow_failure: true
when: manual
script:
- echo ${WPDESK_CI_VERSION}
- composer require bmitch/churn-php
- composer install --no-progress --prefer-dist
- vendor/bin/churn run classes inc
- project: 'wpdesk/gitlab-ci'
ref: 'feature/metrics'
file: '/includes/pages.yml'
check version cohesion:
stage: tests
......
include:
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/gitlab-ci-1.2.yml'
deploy to repository:
......
......@@ -7,5 +7,5 @@ variables:
include:
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/gitlab-ci-1.2.yml'
include:
- project: 'wpdesk/gitlab-ci'
ref: 'master'
ref: 'feature/metrics'
file: '/gitlab-ci-1.2.yml'
deploy to shop:
......
......@@ -21,9 +21,9 @@
stage: deploy
script:
- php /tmp/sync.php ${CI_PROJECT_DIR}/${HOOK_DOCS_SRC} ${HELPSCOUT_API_KEY} ${HELPSCOUT_HOOK_PAGE_ID}
- 'curl -X POST --data-urlencode "payload={\"text\": \"Dokumentacja projektu ${CI_PROJECT_NAME} w wersji ${CI_COMMIT_REF_NAME} umieszczona w <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}/pages|pages> \", }" https://hooks.slack.com/services/${SLACK_AUTH}'
- 'curl -X POST --data-urlencode "payload={\"text\": \"Dokumentacja hooków projektu ${CI_PROJECT_NAME} w wersji ${CI_COMMIT_REF_NAME} umieszczona w HelpScout \", }" https://hooks.slack.com/services/${SLACK_AUTH}'
docs:
hooks docs:
<<: *docs-generation
allow_failure: true
only:
......@@ -32,7 +32,7 @@ docs:
variables:
- $DISABLE_DOCS
docs refresh:
hooks docs refresh:
<<: *docs-generation
only:
variables:
......@@ -233,4 +233,3 @@ deploy to devel:
variables:
- $IS_LIBRARY
- $IS_NPM_LIBRARY
.template: &job-metrics
tags:
- metrics
stage: tools
image: composer:2.0
allow_failure: true
needs:
- prepare prefixed vendor
before_script:
- apk add --update --no-cache libxml2-dev libzip zip libzip-dev
- docker-php-ext-install soap
- docker-php-ext-install zip
phpmetric metrics:
<<: *job-metrics
artifacts:
when: always
expire_in: 1 month
name: "phpmetric"
paths:
- phpmetric
script:
- echo ${WPDESK_CI_VERSION}
- composer global require phpmetrics/phpmetrics
- /tmp/vendor/bin/phpmetrics --report-html=phpmetric .
churn metrics:
<<: *job-metrics
artifacts:
when: always
expire_in: 1 month
name: "churn"
paths:
- churn
script:
- echo ${WPDESK_CI_VERSION}
- composer global require bmitch/churn-php
- export DIRS=""
- if [ -d "classes" ]; then export DIRS="$DIRS classes"; fi;
- if [ -d "src" ]; then export DIRS="$DIRS src"; fi;
- /tmp/vendor/bin/churn run $DIRS
- mkdir churn
- /tmp/vendor/bin/churn run $DIRS > churn/report.txt
phpdoc:
image:
name: phpdoc/phpdoc
entrypoint: [""]
tags:
- metrics
stage: tools
allow_failure: true
needs:
- prepare prefixed vendor
artifacts:
when: always
expire_in: 1 month
name: "phpdoc"
paths:
- phpdoc
script:
- echo ${WPDESK_CI_VERSION}
- export DIRS=""
- if [ -d "classes" ]; then export DIRS="$DIRS -d classes"; fi;
- if [ -d "src" ]; then export DIRS="$DIRS -d src"; fi;
- phpdoc $DIRS -t phpdoc --template=clean
.template: &job-pages
stage: post-deploy
dependencies:
- phpdoc
- phpmetric metrics
- churn metrics
- unit test lastest coverage
artifacts:
paths:
- public
script:
- mkdir public
- echo "<h1>${CI_PROJECT_NAME}</h1>" > public/index.html
- >
if [ -d "phpdoc" ]; then
echo "<br/><br/><a href="phpdoc/">PHP Doc</a>" >> public/index.html
mkdir -p public/phpdoc
cp -r phpdoc public
fi
- >
if [ -d "phpmetric" ]; then
echo "<br/><br/><a href="phpmetric/">PhpMetrics</a>" >> public/index.html
mkdir public/phpmetric
cp -r phpmetric/* public/phpmetric
fi
- >
if [ -d "churn" ]; then
echo "<br/><br/><a href="churn/report.txt">Churn</a>" >> public/index.html
mkdir public/churn
cp -r churn/* public/churn
fi
- >
if [ -d "tmp_artifacts/unit/coverage" ]; then
echo "<br/><br/><a href="unit/coverage/">Unit Tests Coverage</a>" >> public/index.html
mkdir -p public/unit/coverage
cp -r tmp_artifacts/unit/* public/unit
fi
pages:
<<: *job-pages
only:
refs:
- master
- main
pages manual:
<<: *job-pages
when: manual
dependencies:
- phpdoc
- phpmetric metrics
- churn metrics
- unit test lastest coverage manual
except:
refs:
- master
- main
......@@ -3,7 +3,7 @@
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
artifacts:
reports:
junit: tmp_artifacts/report.xml
junit: tmp_artifacts/integration/report.xml
interruptible: true
tags:
- integration
......@@ -22,9 +22,9 @@
- ln -s $CI_PROJECT_DIR /tmp/wordpress-develop/src/wp-content/plugins/$CI_PROJECT_NAME
- echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
script:
- vendor/bin/phpunit -d memory_limit=-1 --configuration phpunit-integration.xml --no-coverage --log-junit tmp_artifacts/report.xml
- vendor/bin/phpunit -d memory_limit=-1 --configuration phpunit-integration.xml --no-coverage --log-junit tmp_artifacts/integration/integration/report.xml
after_script:
- 'if [[ ${REPORTPORTAL_AUTHORIZATION} && ${REPORTPORTAL_PROJECT} ]]; then curl -X POST "http://195.201.225.204:8080/api/v1/${REPORTPORTAL_PROJECT}/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "${REPORTPORTAL_AUTHORIZATION}" -F "file=file=@tmp_artifacts/report.xml;type=text/xml;type=text/xml;filename=${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-integration.xml"; fi'
- 'if [[ ${REPORTPORTAL_AUTHORIZATION} && ${REPORTPORTAL_PROJECT} ]]; then curl -X POST "http://195.201.225.204:8080/api/v1/${REPORTPORTAL_PROJECT}/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "${REPORTPORTAL_AUTHORIZATION}" -F "file=file=@tmp_artifacts/integration/report.xml;type=text/xml;type=text/xml;filename=${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-integration.xml"; fi'
rules:
- if: '$DISABLE_INTEGRATION_TESTS'
when: never
......
......@@ -7,8 +7,10 @@
- $IS_NPM_LIBRARY
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
artifacts:
paths:
- tmp_artifacts/unit
reports:
junit: tmp_artifacts/report.xml
junit: tmp_artifacts/unit/report.xml
interruptible: true
.template: &job-test-unit-template
......@@ -21,15 +23,9 @@
- cat /tmp/woocommerce/woocommerce.php
- echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
script:
- vendor/bin/phpunit -d memory_limit=-1 --configuration phpunit-unit.xml --coverage-text --colors=never --log-junit tmp_artifacts/report.xml
- vendor/bin/phpunit -d memory_limit=-1 --configuration phpunit-unit.xml --coverage-text --colors=never --log-junit tmp_artifacts/unit/report.xml --coverage-html tmp_artifacts/unit/coverage
after_script:
- 'if [[ ${REPORTPORTAL_AUTHORIZATION} && ${REPORTPORTAL_PROJECT} ]]; then curl -X POST "http://195.201.225.204:8080/api/v1/${REPORTPORTAL_PROJECT}/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "${REPORTPORTAL_AUTHORIZATION}" -F "file=file=@tmp_artifacts/report.xml;type=text/xml;type=text/xml;filename=${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-unit.xml"; fi'
only:
- master
- main
except:
variables:
- $DISABLE_COVERAGE
- 'if [[ ${REPORTPORTAL_AUTHORIZATION} && ${REPORTPORTAL_PROJECT} ]]; then curl -X POST "http://195.201.225.204:8080/api/v1/${REPORTPORTAL_PROJECT}/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "${REPORTPORTAL_AUTHORIZATION}" -F "file=file=@tmp_artifacts/unit/report.xml;type=text/xml;type=text/xml;filename=${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-unit.xml"; fi'
.template: &job-test-unit-template-fast
<<: *job-test-template
......@@ -39,7 +35,7 @@
- php --version
- cat /tmp/wordpress-develop/src/wp-includes/version.php
- cat /tmp/woocommerce/woocommerce.php
- vendor/bin/phpunit -d memory_limit=-1 --configuration phpunit-unit.xml --no-coverage --log-junit tmp_artifacts/report.xml
- vendor/bin/phpunit -d memory_limit=-1 --configuration phpunit-unit.xml --no-coverage --log-junit tmp_artifacts/unit/report.xml
unit test lastest:
<<: *job-test-unit-template-fast
......@@ -67,8 +63,6 @@ unit test lastest manual:
allow_failure: true
except:
refs:
- master
- main
- devel
- tags
variables:
......@@ -83,7 +77,3 @@ unit test lastest coverage manual:
refs:
- master
- main
- devel
- tags
variables:
- $DISABLE_COVERAGE
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment