Skip to content

Commit

Permalink
[#1453] Replaced Xdebug with PCOV for coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Dec 3, 2024
1 parent f01f34e commit c4602ea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
5 changes: 1 addition & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion .docker/cli.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/vortex-test-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions .vortex/docs/content/tools/phpunit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit c4602ea

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.