diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index ea19b1a..68bce30 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,4 +1,4 @@ -name: Run Unit Tests +name: Tests and Code Coverage on: pull_request: @@ -8,7 +8,7 @@ on: jobs: test: - name: Unit Tests + name: Run Tests and Generate Coverage runs-on: ubuntu-latest steps: @@ -34,5 +34,14 @@ jobs: EOF - - name: Run Unit Tests - run: mvn clean test + + - name: Run tests with coverage + run: mvn clean verify + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: target/site/jacoco/jacoco.xml + fail_ci_if_error: true + slug: bigboxer23/switchbotapi-java diff --git a/README.md b/README.md index dee3c55..a348353 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![CodeQL](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/codeql.yml/badge.svg)](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/codeql.yml) +[![Build Status](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/unittests.yml/badge.svg)](https://github.com/bigboxer23/switchbotapi-java/actions/workflows/unittests.yml) +[![codecov](https://codecov.io/gh/bigboxer23/switchbotapi-java/branch/main/graph/badge.svg)](https://codecov.io/gh/bigboxer23/switchbotapi-java) + # SwitchBotAPI-java This project provides a java wrapper over the SwitchBot API v1.1 (https://github.com/OpenWonderLabs/SwitchBotAPI) diff --git a/pom.xml b/pom.xml index 04e3f8b..58e5223 100644 --- a/pom.xml +++ b/pom.xml @@ -159,6 +159,25 @@ + + org.jacoco + jacoco-maven-plugin + 0.8.13 + + + + prepare-agent + + + + report + + report + + test + + + com.diffplug.spotless spotless-maven-plugin