Skip to content

Commit 86360d3

Browse files
committed
feat: adding code coverage tracking
1 parent e4a705c commit 86360d3

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

.github/workflows/unittests.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run Unit Tests
1+
name: Tests and Code Coverage
22

33
on:
44
pull_request:
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
test:
11-
name: Unit Tests
11+
name: Run Tests and Generate Coverage
1212
runs-on: ubuntu-latest
1313

1414
steps:
@@ -34,5 +34,14 @@ jobs:
3434
</servers>
3535
</settings>
3636
EOF
37-
- name: Run Unit Tests
38-
run: mvn clean test
37+
38+
- name: Run tests with coverage
39+
run: mvn clean verify
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v5
43+
with:
44+
token: ${{ secrets.CODECOV_TOKEN }}
45+
files: target/site/jacoco/jacoco.xml
46+
fail_ci_if_error: true
47+
slug: bigboxer23/switchbotapi-java

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![CodeQL](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/codeql.yml/badge.svg)](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/codeql.yml)
2+
[![Build Status](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/unittests.yml/badge.svg)](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/unittests.yml)
3+
[![codecov](https://codecov.io/gh/bigboxer23/switchbotapi-java/branch/main/graph/badge.svg)](https://codecov.io/gh/bigboxer23/switchbotapi-java)
4+
15
# SwitchBotAPI-java
26

37
This project provides a java wrapper over the SwitchBot API v1.1 (https://github.com/OpenWonderLabs/SwitchBotAPI)

pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,25 @@
159159
</plugins>
160160
</pluginManagement>
161161
<plugins>
162+
<plugin>
163+
<groupId>org.jacoco</groupId>
164+
<artifactId>jacoco-maven-plugin</artifactId>
165+
<version>0.8.13</version>
166+
<executions>
167+
<execution>
168+
<goals>
169+
<goal>prepare-agent</goal>
170+
</goals>
171+
</execution>
172+
<execution>
173+
<id>report</id>
174+
<goals>
175+
<goal>report</goal>
176+
</goals>
177+
<phase>test</phase>
178+
</execution>
179+
</executions>
180+
</plugin>
162181
<plugin>
163182
<groupId>com.diffplug.spotless</groupId>
164183
<artifactId>spotless-maven-plugin</artifactId>

0 commit comments

Comments
 (0)