Skip to content

Commit ca10c2e

Browse files
authored
Merge pull request #105 from jacomago/code-coverage
Code coverage
2 parents 46a21f1 + c7c2134 commit ca10c2e

File tree

4 files changed

+78
-9
lines changed

4 files changed

+78
-9
lines changed

.github/workflows/codecov.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Code coverage
10+
11+
on:
12+
push:
13+
branches: [ "master" ]
14+
15+
jobs:
16+
codecov:
17+
permissions:
18+
checks: write
19+
contents: read
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Set up JDK 11
24+
uses: actions/setup-java@v3
25+
with:
26+
java-version: '11'
27+
distribution: 'temurin'
28+
cache: maven
29+
- uses: ankane/setup-elasticsearch@v1
30+
with:
31+
elasticsearch-version: 8
32+
config: |
33+
http.port: 9200
34+
- name: Clear existing docker image cache
35+
shell: bash
36+
run: docker image prune -af
37+
- name: Integration Test with Maven
38+
run: mvn clean install test-compile failsafe:integration-test failsafe:verify jacoco:report --batch-mode --fail-at-end
39+
- name: Publish Test Report
40+
uses: mikepenz/action-junit-report@v3
41+
if: success() || failure() # always run even if the previous step fails
42+
with:
43+
report_paths: '**/target/failsafe-reports/TEST-*.xml'
44+
- name: Publish test coverage results
45+
uses: PavanMudigonda/[email protected]
46+
with:
47+
coverage_results_path: 'target/site/jacoco/jacoco.xml'
48+
coverage_report_title: 'Test coverage results'
49+
coverage_report_name: 'Test coverage results'
50+
- name: Upload Code Coverage Artifacts
51+
uses: actions/upload-artifact@v2
52+
with:
53+
name: code-coverage-report-markdown
54+
path: '*/coverage-results.md'

.github/workflows/maven.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
name: Java CI with Maven
1010

11-
on: [push, pull_request]
12-
13-
permissions:
14-
checks: write
11+
on:
12+
push:
13+
branches: [ "master" ]
14+
pull_request:
15+
branches: [ "master" ]
1516

1617
jobs:
1718
build:
@@ -79,6 +80,3 @@ jobs:
7980
if: success() || failure() # always run even if the previous step fails
8081
with:
8182
report_paths: '**/target/failsafe-reports/TEST-*.xml'
82-
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
83-
# - name: Update dependency graph
84-
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,25 @@
233233
</execution>
234234
</executions>
235235
</plugin>
236+
<plugin>
237+
<groupId>org.jacoco</groupId>
238+
<artifactId>jacoco-maven-plugin</artifactId>
239+
<version>0.8.10</version>
240+
<executions>
241+
<execution>
242+
<goals>
243+
<goal>prepare-agent</goal>
244+
</goals>
245+
</execution>
246+
<execution>
247+
<id>report</id>
248+
<phase>prepare-package</phase>
249+
<goals>
250+
<goal>report</goal>
251+
</goals>
252+
</execution>
253+
</executions>
254+
</plugin>
236255
<plugin>
237256
<groupId>org.apache.maven.plugins</groupId>
238257
<artifactId>maven-compiler-plugin</artifactId>

src/test/java/org/phoebus/channelfinder/ChannelScrollIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package org.phoebus.channelfinder;
22

3-
import co.elastic.clients.elasticsearch.indices.DeleteIndexRequest;
43
import org.junit.jupiter.api.*;
54
import org.phoebus.channelfinder.entity.Channel;
65
import org.phoebus.channelfinder.entity.Scroll;
76
import org.phoebus.channelfinder.example.PopulateService;
87
import org.springframework.beans.factory.annotation.Autowired;
98
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
109
import org.springframework.test.context.TestPropertySource;
11-
1210
import org.springframework.util.LinkedMultiValueMap;
1311
import org.springframework.util.MultiValueMap;
1412

0 commit comments

Comments
 (0)