Skip to content

Commit 292bbf5

Browse files
author
orbeji
committed
update readme with CI examples
1 parent 686c5fc commit 292bbf5

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

README.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ the current and destination branches.
6060
Diff file example:
6161
Bitbucket
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
```
6767
GitHub
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

122168
See 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

Comments
 (0)