@@ -60,9 +60,9 @@ the current and destination branches.
6060Diff file example:
6161Bitbucket
6262``` bash
63- vendor/bin/phpunit --coverage-clover clover.xml
64- git diff ${BITBUCKET_PR_DESTINATION_BRANCH} ...${BITBUCKET_BRANCH} > diff.txt
65- vendor/bin/pr-coverage-check check clover.xml 100 --diff=diff.txt
63+ vendor/bin/phpunit --configuration phpunit.xml.dist --testsuite pipelines -- coverage-clover ' clover.xml'
64+ git diff origin/ ${BITBUCKET_PR_DESTINATION_BRANCH} ...origin/ ${BITBUCKET_BRANCH} > diff.txt
65+ vendor/bin/pr-coverage-check check clover.xml 100 --diff=diff.txt --report=ansi
6666```
6767GitHub
6868``` bash
@@ -109,14 +109,60 @@ report:
109109
110110### CI Integration
111111#### Bitbucket Pipelines
112+ ``` yaml
113+ pipelines :
114+ pull-requests :
115+ feature/* :
116+ - step :
117+ name : phpunit coverage check
118+ image :
119+ name : orbeji/base:7.2-xdebug-cli
120+ script :
121+ - composer install
122+ - vendor/bin/phpunit --configuration phpunit.xml.dist --testsuite pipelines --coverage-clover 'clover.xml'
123+ - git diff origin/${BITBUCKET_PR_DESTINATION_BRANCH}...origin/${BITBUCKET_BRANCH} > diff.txt
124+ - vendor/bin/pr-coverage-check check clover.xml 100 --diff=diff.txt --report=ansi
125+ caches :
126+ - composer
127+ ` ` `
112128#### GitHub Actions
129+ ` ` ` yaml
130+ name : PHPUnit and Coverage Check
131+
132+ on : [pull_request]
133+
134+ jobs :
135+ test :
136+ runs-on : ubuntu-22.04
137+
138+ steps :
139+ - name : Checkout code
140+ uses : actions/checkout@v4
113141
142+ - name : Set up PHP
143+ uses : shivammathur/setup-php@v2
144+ with :
145+ php-version : ' 7.2'
146+
147+ - name : Install dependencies
148+ run : composer install
149+
150+ - name : Run PHPUnit with coverage
151+ run : vendor/bin/phpunit --configuration phpunit.xml.dist --testsuite pipelines --coverage-clover 'clover.xml'
152+
153+ - name : Git diff
154+ run : git fetch && git diff origin/${GITHUB_BASE_REF}...origin/${GITHUB_HEAD_REF} > diff.txt
155+
156+ - name : PR Coverage Check
157+ run : vendor/bin/pr-coverage-check check clover.xml 100 --diff=diff.txt --report=ansi
158+
159+ ```
114160
115161<!-- ROADMAP -->
116162## Roadmap
117163
118164- [ ] Add Bitbucket report example screenshot
119- - [ ] Add examples of CI for Bitbucket and GitHub
165+ - [x ] Add examples of CI for Bitbucket and GitHub
120166
121167
122168See the [ open issues] ( https://github.com/orbeji/phpunit-pr-coverage-check/issues ) for a full list of proposed features (and known issues).
0 commit comments