diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e91d0c..8c13d35 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,15 +25,30 @@ jobs: name: Lint code command: docker compose exec phpserver composer lint - run: - name: Run tests - command: docker compose exec phpserver composer test + name: Run tests with PHPUnit + command: | + XDEBUG_ENABLE=true docker compose up -d phpserver + docker compose exec -T -e XDEBUG_MODE=coverage phpserver vendor/bin/phpunit + docker compose up -d phpserver + - run: + name: Run tests with Behat + command: docker compose exec phpserver behat - run: - name: Copy artifacts + name: Process test logs and artifacts command: | - mkdir -p "/tmp/test_results" && docker compose cp phpserver:/app/.logs/test_results/. "/tmp/test_results/" - mkdir -p "/tmp/artifacts" && docker compose cp phpserver:/app/.logs/. "/tmp/artifacts/" + mkdir -p /tmp/test_results + mkdir -p /tmp/artifacts + if docker compose ps --services --filter "status=running" | grep -q phpserver && docker compose exec phpserver test -d /app/.logs; then + docker compose cp phpserver:/app/.logs/. "/tmp/artifacts/" + if docker compose exec -T phpserver sh -c 'test -d /app/.logs/test_results'; then + docker compose cp phpserver:/app/.logs/test_results/. "/tmp/test_results/" + fi + fi when: always - store_test_results: path: /tmp/test_results - store_artifacts: path: /tmp/artifacts + - run: + name: Upload code coverage reports to Codecov + command: if [ -f /tmp/artifacts/coverage ]; then codecov -Z -s /tmp/artifacts/coverage; fi diff --git a/.gitattributes b/.gitattributes index 79d5be0..25ecf3a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,14 +1,18 @@ # Ignore files for distribution archives. -/.circleci export-ignore -/.editorconfig export-ignore -/.gitattributes export-ignore -/.github export-ignore -/.gitignore export-ignore -/behat.yml export-ignore -/docker-compose.yml export-ignore -/docs export-ignore -/phpcs.xml export-ignore -/phpmd.xml export-ignore -/phpstan.neon export-ignore -/tests export-ignore +/.circleci export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.github export-ignore +/.gitignore export-ignore +/behat.yml export-ignore +/docker-compose.override.default.yml export-ignore +/docker-compose.yml export-ignore +/docs export-ignore +/phpcs.xml export-ignore +/phpmd.xml export-ignore +/phpstan.neon export-ignore +/phpunit.xml export-ignore +/rector.php export-ignore +/renovate.json export-ignore +/tests export-ignore diff --git a/.gitignore b/.gitignore index 1f8482c..f773816 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ # To ignore OS temporary files use global .gitignore # https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer +/.build +/.coverage-html /.logs +/.phpunit.cache +/cobertura.xml /composer.lock /docker-compose.override.yml /screenshots diff --git a/README.md b/README.md index c609525..3484247 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ [![GitHub Issues](https://img.shields.io/github/issues/drevops/behat-screenshot.svg)](https://github.com/drevops/behat-screenshot/issues) [![GitHub Pull Requests](https://img.shields.io/github/issues-pr/drevops/behat-screenshot.svg)](https://github.com/drevops/behat-screenshot/pulls) [![CircleCI](https://circleci.com/gh/drevops/behat-screenshot.svg?style=shield)](https://circleci.com/gh/drevops/behat-screenshot) +[![codecov](https://codecov.io/gh/drevops/behat-screenshot/graph/badge.svg?token=UN930S8FGC)](https://codecov.io/gh/drevops/behat-screenshot) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/drevops/behat-screenshot) ![LICENSE](https://img.shields.io/github/license/drevops/behat-screenshot) ![Renovate](https://img.shields.io/badge/renovate-enabled-green?logo=renovatebot) diff --git a/phpunit.xml b/phpunit.xml index ead316b..ca562ec 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -30,8 +30,8 @@ ignoreDeprecatedCodeUnits="true" disableCodeCoverageIgnore="false"> - - + +