Skip to content

Commit 37e5a84

Browse files
committed
! add coveralls on AppVeyor
2 parents 30844d5 + c627c44 commit 37e5a84

File tree

6 files changed

+107
-49
lines changed

6 files changed

+107
-49
lines changed

.coveralls.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
service_name: AppVeyor

appveyor.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
version: '{build}'
1111
image:
12-
- Visual Studio 2017
1312
- Ubuntu2004
13+
- Visual Studio 2017
1414
build: false
1515
clone_depth: 50
1616
branches:
@@ -22,6 +22,27 @@ environment:
2222
APPVEYOR_YML_DISABLE_PS_LINUX: true
2323

2424
for:
25+
-
26+
#------------------
27+
# Ubuntu
28+
#------------------
29+
matrix:
30+
only:
31+
- image: Ubuntu2004
32+
init:
33+
- sh: export MAVEN_OPTS="-Xmx768m -XX:MaxPermSize=128m -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2"
34+
- sh: export JAVA_OPTS="-Xmx768m -XX:MaxPermSize=128m"
35+
36+
test_script:
37+
- sh: ./scripts/integration-test.sh
38+
39+
after_test:
40+
- sh: ./scripts/codecov.sh
41+
- sh: rm -rf /home/appveyor/.m2/repository/com/alibaba/dns-cache-manipulator*
42+
43+
cache:
44+
- /home/appveyor/.m2/
45+
- /home/appveyor/.sdkman/
2546
-
2647
#------------------
2748
# Windows
@@ -51,23 +72,3 @@ for:
5172

5273
cache:
5374
- C:\Users\appveyor\.m2\
54-
-
55-
#------------------
56-
# Ubuntu
57-
#------------------
58-
matrix:
59-
only:
60-
- image: Ubuntu2004
61-
init:
62-
- sh: export MAVEN_OPTS="-Xmx768m -XX:MaxPermSize=128m -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2"
63-
- sh: export JAVA_OPTS="-Xmx768m -XX:MaxPermSize=128m"
64-
65-
test_script:
66-
- sh: ./scripts/integration-test.sh
67-
68-
after_test:
69-
- sh: rm -rf /home/appveyor/.m2/repository/com/alibaba/dns-cache-manipulator*
70-
71-
cache:
72-
- /home/appveyor/.m2/
73-
- /home/appveyor/.sdkman/

library/pom.xml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,24 @@
391391
</profile>
392392
<profile>
393393
<id>gen-code-cov</id>
394-
<activation>
395-
<property>
396-
<name>env.TRAVIS</name>
397-
<value>true</value>
398-
</property>
399-
</activation>
400394
<build>
401395
<plugins>
396+
<plugin>
397+
<groupId>org.eluder.coveralls</groupId>
398+
<artifactId>coveralls-maven-plugin</artifactId>
399+
<version>4.3.0</version>
400+
<configuration>
401+
<repoToken>${env.COVERALLS_REPO_TOKEN}</repoToken>
402+
</configuration>
403+
<!-- https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->
404+
<dependencies>
405+
<dependency>
406+
<groupId>javax.xml.bind</groupId>
407+
<artifactId>jaxb-api</artifactId>
408+
<version>2.2.3</version>
409+
</dependency>
410+
</dependencies>
411+
</plugin>
402412
<plugin>
403413
<!-- for codecov.io -->
404414
<!-- config example: https://github.com/codecov/example-java -->
@@ -411,20 +421,30 @@
411421
<goals>
412422
<goal>prepare-agent</goal>
413423
</goals>
424+
<!--
425+
https://www.eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html
426+
-->
427+
<configuration>
428+
<append>true</append>
429+
</configuration>
414430
</execution>
415431
<execution>
416432
<id>report</id>
417433
<phase>test</phase>
418434
<goals>
419435
<goal>report</goal>
420436
</goals>
421-
<configuration>
422-
<excludes>
423-
<exclude>com/alibaba/dcm/internal/JavaVersion.class</exclude>
424-
</excludes>
425-
</configuration>
426437
</execution>
427438
</executions>
439+
<configuration>
440+
<!--
441+
Maven Jacoco Configuration - Exclude classes/packages from report not working - Stack Overflow
442+
https://stackoverflow.com/questions/27799419
443+
-->
444+
<excludes>
445+
<exclude>com/alibaba/dcm/internal/JavaVersion.class</exclude>
446+
</excludes>
447+
</configuration>
428448
</plugin>
429449
</plugins>
430450
</build>

pom.xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,24 @@
121121
<profiles>
122122
<profile>
123123
<id>gen-code-cov</id>
124-
<activation>
125-
<property>
126-
<name>env.TRAVIS</name>
127-
<value>true</value>
128-
</property>
129-
</activation>
130124
<build>
131125
<plugins>
126+
<plugin>
127+
<groupId>org.eluder.coveralls</groupId>
128+
<artifactId>coveralls-maven-plugin</artifactId>
129+
<version>4.3.0</version>
130+
<configuration>
131+
<repoToken>${env.COVERALLS_REPO_TOKEN}</repoToken>
132+
</configuration>
133+
<!-- https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->
134+
<dependencies>
135+
<dependency>
136+
<groupId>javax.xml.bind</groupId>
137+
<artifactId>jaxb-api</artifactId>
138+
<version>2.2.3</version>
139+
</dependency>
140+
</dependencies>
141+
</plugin>
132142
<plugin>
133143
<!-- for codecov.io -->
134144
<!-- config example: https://github.com/codecov/example-java -->

scripts/codecov.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22
set -eEuo pipefail
33
cd "$(dirname "$(readlink -f "$0")")"
44

5-
source ./common_build.sh skipClean
5+
source ./common_build.sh
66
source ./prepare-jdk.sh
77

8-
switch_to_jdk 8
9-
108
cd "$ROOT_PROJECT_DIR"
11-
runCmd ./mvnw -Pgen-code-cov clean package cobertura:cobertura coveralls:report
9+
10+
switch_to_jdk 11
11+
runCmd "${MVN_CMD[@]}" -Pgen-code-cov clean test jacoco:report
12+
13+
switch_to_jdk 8
14+
# use -Dmaven.main.skip option fix below problem of jacoco-maven-plugin:report :
15+
#
16+
# [WARNING] Classes in bundle 'Java Dns Cache Manipulator(DCM) Lib' do not match with execution data.
17+
# For report generation the same class files must be used as at runtime.
18+
# [WARNING] Execution data for class com/alibaba/xxx/Yyy does not match.
19+
runCmd "${MVN_CMD[@]}" -Pgen-code-cov -Dmaven.main.skip test jacoco:report coveralls:report

tool/pom.xml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@
411411
</validationProperty>
412412
</validationProperties>
413413
<generateGitPropertiesFile>true</generateGitPropertiesFile>
414-
<generateGitPropertiesFilename>${project.build.outputDirectory}/META-INF/scm/${project.groupId}/${project.artifactId}/git.properties</generateGitPropertiesFilename>
414+
<generateGitPropertiesFilename>
415+
${project.build.outputDirectory}/META-INF/scm/${project.groupId}/${project.artifactId}/git.properties
416+
</generateGitPropertiesFilename>
415417
</configuration>
416418
</plugin>
417419
</plugins>
@@ -453,14 +455,24 @@
453455
</profile>
454456
<profile>
455457
<id>gen-code-cov</id>
456-
<activation>
457-
<property>
458-
<name>env.TRAVIS</name>
459-
<value>true</value>
460-
</property>
461-
</activation>
462458
<build>
463459
<plugins>
460+
<plugin>
461+
<groupId>org.eluder.coveralls</groupId>
462+
<artifactId>coveralls-maven-plugin</artifactId>
463+
<version>4.3.0</version>
464+
<configuration>
465+
<repoToken>${env.COVERALLS_REPO_TOKEN}</repoToken>
466+
</configuration>
467+
<!-- https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->
468+
<dependencies>
469+
<dependency>
470+
<groupId>javax.xml.bind</groupId>
471+
<artifactId>jaxb-api</artifactId>
472+
<version>2.2.3</version>
473+
</dependency>
474+
</dependencies>
475+
</plugin>
464476
<plugin>
465477
<!-- for codecov.io -->
466478
<!-- config example: https://github.com/codecov/example-java -->
@@ -473,6 +485,12 @@
473485
<goals>
474486
<goal>prepare-agent</goal>
475487
</goals>
488+
<!--
489+
https://www.eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html
490+
-->
491+
<configuration>
492+
<append>true</append>
493+
</configuration>
476494
</execution>
477495
<execution>
478496
<id>report</id>

0 commit comments

Comments
 (0)