Skip to content

Commit

Permalink
chore: adding coverage (#100)
Browse files Browse the repository at this point in the history
<!-- Please describe your pull request here. -->

## References

- TODO

<!-- References to relevant GitHub issues and pull requests, esp.
upstream and downstream changes -->

## Submitter checklist

- [ ] Recommended: Join [WireMock Slack](https://slack.wiremock.org/) to
get any help in `#help-contributing` or a project-specific channel like
`#wiremock-java`
- [ ] Recommended: If you participate in Hacktoberfest 2023, make sure
you're [signed up](https://wiremock.org/events/hacktoberfest/) there and
in the WireMock form
- [ ] The PR request is well described and justified, including the body
and the references
- [ ] The PR title represents the desired changelog entry
- [ ] The repository's code style is followed (see the contributing
guide)
- [ ] Test coverage that demonstrates that the change works as expected
- [ ] For new features, there's necessary documentation in this pull
request or in a subsequent PR to
[wiremock.org](https://github.com/wiremock/wiremock.org)

<!--
Put an `x` into the [ ] to show you have filled the information.
The template comes from
https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md
You can override it by creating .github/pull_request_template.md in your
own repository
-->
  • Loading branch information
dirkbolte authored Nov 12, 2023
1 parent 79d9ba3 commit a0be1c1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
37 changes: 36 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ jobs:
env:
JDK_VERSION: ${{ matrix.jdk }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout badges branch dedicated to storing badges only
uses: actions/checkout@v4
with:
ref: badges
path: badges
- name: Set up JDK
uses: actions/setup-java@v3
with:
Expand All @@ -35,3 +40,33 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: build check
- name: Generate coverage badges
if: ${{ matrix.os == 'ubuntu-latest' && matrix.jdk == '11' }}
uses: cicirello/jacoco-badge-generator@v2
with:
badges-directory: badges
generate-coverage-badge: true
generate-branches-badge: true
coverage-badge-filename: line-coverage.svg
branches-badge-filename: branches-coverage.svg
generate-summary: true
coverage-label: line coverage
branches-label: branch coverage
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
- name: Commit and push
if: ${{ matrix.os == 'ubuntu-latest' && matrix.jdk == '11' && github.event_name != 'pull_request' }}
run: |
cd badges
if [[ `git status --porcelain *.svg` ]]; then
git config --global user.name 'github-actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add *.svg
git commit -m "Autogenerated JaCoCo coverage badge" *.svg
git push
fi
- name: Upload Jacoco coverage report
uses: actions/upload-artifact@v3
with:
name: jacoco-report
path: build/reports/jacoco/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# WireMock State extension

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/wiremock/wiremock-state-extension)](https://github.com/wiremock/wiremock-state-extension/releases)
[![Maven Central](https://img.shields.io/maven-central/v/org.wiremock.extensions/wiremock-state-extension)](https://img.shields.io/maven-central/v/org.wiremock.extensions/wiremock-state-extension)
[![Maven Central](https://img.shields.io/maven-central/v/org.wiremock.extensions/wiremock-state-extension)](https://central.sonatype.com/artifact/org.wiremock.extensions/wiremock-state-extension)
[![Slack](https://img.shields.io/badge/slack-slack.wiremock.org-brightgreen?style=flat&logo=slack)](https://slack.wiremock.org/)
[![GitHub contributors](https://img.shields.io/github/contributors/wiremock/wiremock-state-extension)](https://github.com/wiremock/wiremock-state-extension/graphs/contributors)
![Line Coverage](../badges/line-coverage.svg)
![Branches Coverage](../badges/branches-coverage.svg)

<p align="center">
<a href="https://wiremock.org" target="_blank">
Expand Down
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ shadowJar {
exclude 'handlebars-*.js'
}

test {
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
csv.required = true
html.required = true
}
}

group 'org.wiremock.extensions'

version gitVersion()
Expand Down

0 comments on commit a0be1c1

Please sign in to comment.