diff --git a/.circleci/config.yml b/.circleci/config.yml index 808cf5d7e..7fa0704de 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -311,10 +311,7 @@ jobs: - run: name: Test with PHPUnit - command: | - XDEBUG_ENABLE=true docker compose up -d cli php nginx # Restart stack with XDEBUG enabled for coverage. - docker compose exec -T -e XDEBUG_MODE=coverage cli vendor/bin/phpunit || [ "${VORTEX_CI_PHPUNIT_IGNORE_FAILURE:-0}" -eq 1 ] - docker compose up -d cli php nginx # Restart stack without XDEBUG enabled for coverage. + command: docker compose exec -T cli vendor/bin/phpunit || [ "${VORTEX_CI_PHPUNIT_IGNORE_FAILURE:-0}" -eq 1 ] - run: name: Test with Behat diff --git a/.docker/cli.dockerfile b/.docker/cli.dockerfile index 2b8566fee..d89b5a901 100644 --- a/.docker/cli.dockerfile +++ b/.docker/cli.dockerfile @@ -52,7 +52,10 @@ ENV WEBROOT=${WEBROOT} \ # reduce build time. # Adding more tools. -RUN apk add --no-cache ncurses pv tzdata +RUN apk add --no-cache ncurses pv tzdata autoconf g++ make \ + && pecl install pcov \ + && docker-php-ext-enable pcov \ + && apk del g++ make autoconf # Adding patches and scripts. COPY patches /app/patches diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml index 55db2385e..aab4350f4 100644 --- a/.github/workflows/build-test-deploy.yml +++ b/.github/workflows/build-test-deploy.yml @@ -281,10 +281,7 @@ jobs: timeout-minutes: 30 - name: Test with PHPUnit - run: | - XDEBUG_ENABLE=true docker compose up -d cli php nginx # Restart stack with XDEBUG enabled for coverage. - docker compose exec -T -e XDEBUG_MODE=coverage cli vendor/bin/phpunit - docker compose up -d cli php nginx # Restart stack without XDEBUG enabled for coverage. + run: docker compose exec -T cli vendor/bin/phpunit continue-on-error: ${{ vars.VORTEX_CI_PHPUNIT_IGNORE_FAILURE == '1' }} - name: Test with Behat diff --git a/.github/workflows/vortex-test-installer.yml b/.github/workflows/vortex-test-installer.yml index b85c92396..b6b25f1b4 100644 --- a/.github/workflows/vortex-test-installer.yml +++ b/.github/workflows/vortex-test-installer.yml @@ -26,6 +26,8 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} + coverage: pcov + ini-values: pcov.directory=. - name: Install dependencies run: composer install @@ -36,7 +38,7 @@ jobs: working-directory: .vortex/installer - name: Run tests - run: XDEBUG_MODE=coverage composer test + run: composer test working-directory: .vortex/installer - name: Upload coverage report as an artifact diff --git a/.vortex/docs/content/tools/phpunit.mdx b/.vortex/docs/content/tools/phpunit.mdx index 6ca43b782..69e5515ad 100644 --- a/.vortex/docs/content/tools/phpunit.mdx +++ b/.vortex/docs/content/tools/phpunit.mdx @@ -88,12 +88,6 @@ automated coverage assessment, and in `.logs/coverage/phpunit/.coverage-html` as HTML coverage report, useful for visual report assessment during test development. -The tests need to run with `XDEBUG_MODE=coverage` environment variable set. - -```shell -XDEBUG_MODE=coverage cli vendor/bin/phpunit -``` - CI runs tests with coverage by default and stores the reports as artifacts. ### Ignoring lines from coverage