Skip to content
Snippets Groups Projects
Verified Commit 958fa550 authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

refactor: cleanup unit test job

parent 94b1ac5e
No related branches found
No related tags found
No related merge requests found
variables:
WPDESK_CI_VERSION: "2024.11.04"
WPDESK_CI_VERSION: "2024.11.19"
MYSQL_ROOT_PASSWORD: "mysql"
MYSQL_DATABASE: "wptest"
MYSQL_USER: "mysql"
......
.template: &job-test-template
test:unit:
image: gitlab.wpdesk.dev:5050/wpdesk/docker-tests/php-box:8.3.2
variables:
PHPUNIT_OPTIONS: "--no-coverage"
tags:
- unit
stage: tests
except:
rules:
- if: $IS_NPM_LIBRARY
when: never
- if: $CI_COMMIT_BRANCH == "devel"
exists:
- phpunit-unit.xml
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG
exists:
- phpunit-unit.xml
variables:
- $IS_NPM_LIBRARY
PHPUNIT_OPTIONS: "--coverage-text --coverage-html tmp_artifacts/unit/coverage --colors=never"
- exists:
- phpunit-unit.xml
when: manual
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
artifacts:
paths:
- tmp_artifacts/unit
reports:
junit: tmp_artifacts/unit/report.xml
expire_in: 3 mos
interruptible: true
.template: &job-test-unit-template
<<: *job-test-template
before_script:
- echo ${WPDESK_CI_VERSION}
- php --version
- 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/unit/report.xml --coverage-html tmp_artifacts/unit/coverage
- vendor/bin/phpunit -d memory_limit=-1 --configuration phpunit-unit.xml --log-junit tmp_artifacts/unit/report.xml $PHPUNIT_OPTIONS
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/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
script:
- echo ${WPDESK_CI_VERSION}
- ls -l
- php --version
- 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
only:
refs:
- devel
- tags
except:
variables:
- $IS_NPM_LIBRARY
unit test lastest coverage:
<<: *job-test-unit-template
only:
refs:
- master
- main
unit test lastest manual:
<<: *job-test-unit-template-fast
when: manual
allow_failure: true
except:
refs:
- devel
- tags
variables:
- $DISABLE_COVERAGE
unit test lastest coverage manual:
<<: *job-test-unit-template
when: manual
allow_failure: true
except:
refs:
- master
- main
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment