diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 1c27f6e..4ef94a1 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -27,7 +27,15 @@ jobs: - name: Run API tests run: | - task --yes api:test + task --yes api:test:coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v7 + with: + files: ./coverage/unit.xml + flags: unittests + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} code-analysis-phpstan: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index e34bf05..6b0cf92 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ phpstan.neon ###> claude-code ### /.claude/settings.local.json ###< claude-code ### + +# Coverage reports (generated in CI, uploaded to Codecov). +/coverage diff --git a/CHANGELOG.md b/CHANGELOG.md index 574c735..651abee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ See [keep a changelog] for information about writing changes to this log. ## [Unreleased] +- [PR-37](https://github.com/itk-dev/event-database-api/pull/37) + Upload test coverage to Codecov in CI - [PR-36](https://github.com/itk-dev/event-database-api/pull/36) Add unit tests pinning the Elasticsearch filters' query DSL and parameter descriptors - [PR-35](https://github.com/itk-dev/event-database-api/pull/35) diff --git a/Taskfile.yml b/Taskfile.yml index f4c0a9a..2cd8f36 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -182,6 +182,13 @@ tasks: vars: COMPOSE_ARGS: exec phpfpm bin/phpunit + api:test:coverage: + desc: Run API tests with a Clover coverage report (coverage/unit.xml) + cmds: + - task: compose + vars: + COMPOSE_ARGS: exec --env XDEBUG_MODE=coverage phpfpm bin/phpunit --coverage-clover=coverage/unit.xml + api:spec:export: desc: Export API spec cmds: