From 65ea8fc82967f210aa364cb342832fd054dc8a7b Mon Sep 17 00:00:00 2001 From: Olli-Pekka Lehtokallio Date: Tue, 4 Jun 2024 10:23:10 +0300 Subject: [PATCH] jacoco --- .github/workflows/coverage.yml | 34 ++++++++++++++++++++++++ eperusteet/eperusteet-service/pom.xml | 38 +++------------------------ 2 files changed, 38 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000000..a9d2f3f049 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,34 @@ +name: Test Coverage + +on: [push] + +jobs: + test-coverage: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Build with Maven + run: mvn clean install + + - name: Run Tests and Generate Coverage Reports + run: mvn verify + + - name: Upload Coverage to Code Climate + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + ./cc-test-reporter format-coverage target/jacoco-ut.exec --input-type jacoco + ./cc-test-reporter upload-coverage + ./cc-test-reporter format-coverage target/jacoco-it.exec --input-type jacoco + ./cc-test-reporter upload-coverage + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} diff --git a/eperusteet/eperusteet-service/pom.xml b/eperusteet/eperusteet-service/pom.xml index 621973ea5f..da511a7c88 100644 --- a/eperusteet/eperusteet-service/pom.xml +++ b/eperusteet/eperusteet-service/pom.xml @@ -48,6 +48,7 @@ 2.7.0 3.2.2 3.1.7 + 0.8.12 @@ -523,28 +524,6 @@ - - org.eclipse.jetty - jetty-maven-plugin - 10.0.12 - - 0 - - 8080 - - - /eperusteet-service - ${basedir}/src/test/config/jetty-env.xml - - - - - org.postgresql - postgresql - ${postgresql.version} - - - org.apache.maven.plugins maven-failsafe-plugin @@ -558,13 +537,10 @@ - -Xmx2048m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC - - + -Dlog4j2.level=OFF -Xmx2048m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${project.build.directory}/jacoco-it.exec 3 true plain - -Dlog4j2.level=OFF ${eperusteet.ittestdb.user} ${eperusteet.ittestdb.password} @@ -582,18 +558,11 @@ 3 true - -Dlog4j2.level=OFF - - - - - - - **/service/test/*.java **/*IT.java + -Dlog4j2.level=OFF -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${project.build.directory}/jacoco-ut.exec @@ -831,6 +800,7 @@ org.jacoco jacoco-maven-plugin + ${jacoco.version} pre-unit-test