diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e2af39c768c3e0f5a783a227fe0238499d91a60..ad3a95f019f88101ad2789ee8456e257121836cf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,71 +4,21 @@ variables: GIT_STRATEGY: fetch stages: - - tools - tests -.template: &job-test-template - stage: tests - coverage: '/^\s*Lines:\s*\d+.\d+\%/' - -.template: &job-test-unit-template - <<: *job-test-template - script: - - echo ${WPDESK_CI_VERSION} - - ls -l - - php --version - - cat /tmp/wordpress-develop/src/wp-includes/version.php - - cat /tmp/woocommerce/woocommerce.php - - composer update --no-progress - - vendor/bin/phpunit --configuration phpunit-unit.xml --coverage-text --colors=never - -.template: &job-test-unit-template-fast - <<: *job-test-unit-template - script: - - echo ${WPDESK_CI_VERSION} - - ls -l - - php --version - - cat /tmp/wordpress-develop/src/wp-includes/version.php - - cat /tmp/woocommerce/woocommerce.php - - composer update --no-progress - - vendor/bin/phpunit --configuration phpunit-unit.xml --no-coverage - - -before_script: - - cd ${CI_PROJECT_DIR} - -phpmetric metrics: - stage: tools +unit test lastest: image: wpdesknet/phpunit-woocommerce:0-0 - allow_failure: true - when: manual + stage: tests artifacts: when: always - expire_in: 1 month - name: "metrics" - paths: - - ${CI_PROJECT_DIR}/phpmetric - script: - - echo ${WPDESK_CI_VERSION} - - composer require phpmetrics/phpmetrics - - composer update --no-progress - - php ./vendor/bin/phpmetrics --report-html=phpmetric . - -churn metrics: - stage: tools - image: wpdesknet/phpunit-woocommerce:0-0 - allow_failure: true - when: manual + reports: + junit: phpunit-report.xml + coverage_report: + coverage_format: cobertura + path: phpunit-coverage.xml + coverage: '/^\s*Lines:\s*\d+.\d+\%/' + variables: + XDEBUG_MODE: coverage script: - - echo ${WPDESK_CI_VERSION} - - composer require bmitch/churn-php - - composer update --no-progress - - vendor/bin/churn run classes inc - -unit test lastest: - <<: *job-test-unit-template-fast - image: wpdesknet/phpunit-woocommerce:0-0 - -integration test lastest: - <<: *job-test-unit-template - image: wpdesknet/phpunit-woocommerce:0-0 + - composer install --no-progress --no-ansi --no-interaction + - vendor/bin/phpunit --do-not-cache-result --log-junit phpunit-report.xml --coverage-cobertura phpunit-coverage.xml --coverage-text --colors=never diff --git a/phpunit-integration.xml b/phpunit-integration.xml deleted file mode 100644 index c4a8e8535177a8a9ffdf768b4272d479bc47a8ca..0000000000000000000000000000000000000000 --- a/phpunit-integration.xml +++ /dev/null @@ -1,28 +0,0 @@ -<phpunit bootstrap="tests/integration/bootstrap.php" - backupGlobals="false" - > - <testsuites> - <testsuite> - <directory prefix="Test" suffix=".php">./tests/integration</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory suffix=".php">classes</directory> - </whitelist> - </filter> - - <logging> - <log type="junit" target="build-coverage/report.junit.xml"/> - <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/> - <log type="coverage-text" target="build-coverage/coverage.txt"/> - <log type="coverage-clover" target="build-coverage/clover.xml"/> - </logging> - - <php> - <env name="WP_DEVELOP_DIR" value="/tmp/wordpress-develop"/> - <env name="WC_DEVELOP_DIR" value="/tmp/woocommerce"/> - </php> - -</phpunit> \ No newline at end of file diff --git a/phpunit-unit.xml b/phpunit-unit.xml deleted file mode 100644 index e22f6be926377957fc342499bdf481ef6314c611..0000000000000000000000000000000000000000 --- a/phpunit-unit.xml +++ /dev/null @@ -1,21 +0,0 @@ -<phpunit bootstrap="tests/unit/bootstrap.php"> - <testsuites> - <testsuite> - <directory prefix="Test" suffix=".php">./tests/unit/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory suffix=".php">classes</directory> - </whitelist> - </filter> - - <logging> - <log type="junit" target="build-coverage/report.junit.xml"/> - <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/> - <log type="coverage-text" target="build-coverage/coverage.txt"/> - <log type="coverage-clover" target="build-coverage/clover.xml"/> - </logging> - -</phpunit> diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1a6fcff411945c43b606a086c378529d837e460d..869edec0f3c337ac5b71ae32ac99938c520e5938 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,4 +4,9 @@ <directory prefix="Test" suffix=".php">./tests/</directory> </testsuite> </testsuites> + <coverage> + <include> + <directory suffix=".php">src</directory> + </include> + </coverage> </phpunit>