mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
add test ci/support jdk 12
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
name: JavaCI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [7, 8, 9, 10, 11 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup java
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- name: Build with Maven
|
||||
run: mvn clean package -P full
|
||||
|
||||
build_jdk_ge_12:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [12, 13, 14 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
- name: save java8 home
|
||||
run: |
|
||||
export JAVA8_HOME=$JAVA_HOME && echo $JAVA8_HOME
|
||||
echo "export JAVA8_HOME=$JAVA_HOME" > ~/.testenv
|
||||
|
||||
- name: Setup java
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- name: Build with Maven
|
||||
run: |
|
||||
source ~/.testenv
|
||||
mvn -Dmaven.compiler.fork=true -Dmaven.compiler.executable=$JAVA8_HOME/bin/javac -DJAVA8_HOME=$JAVA8_HOME clean package -P full
|
||||
@@ -54,4 +54,8 @@ public class JavaVersionUtils {
|
||||
public static boolean isGreaterThanJava8() {
|
||||
return JAVA_VERSION > 1.8f;
|
||||
}
|
||||
|
||||
public static boolean isGreaterThanJava11() {
|
||||
return JAVA_VERSION > 11.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.taobao.arthas.core.util;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.taobao.arthas.common.JavaVersionUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
@@ -26,7 +29,14 @@ public class TypeRenderUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testDrawInterface() {
|
||||
assertThat(TypeRenderUtils.drawInterface(String.class), is(equalTo("java.io.Serializable,java.lang.Comparable,java.lang.CharSequence")));
|
||||
if (JavaVersionUtils.isGreaterThanJava11()) {
|
||||
Assertions.assertThat(TypeRenderUtils.drawInterface(String.class)).isEqualTo(
|
||||
"java.io.Serializable,java.lang.Comparable,java.lang.CharSequence,java.lang.constant.Constable,java.lang.constant.ConstantDesc");
|
||||
} else {
|
||||
Assertions.assertThat(TypeRenderUtils.drawInterface(String.class))
|
||||
.isEqualTo("java.io.Serializable,java.lang.Comparable,java.lang.CharSequence");
|
||||
}
|
||||
|
||||
assertThat(TypeRenderUtils.drawInterface(TestClass.class), is(equalTo("java.io.Serializable")));
|
||||
assertThat(TypeRenderUtils.drawInterface(Serializable.class), is(equalTo("")));
|
||||
}
|
||||
|
||||
@@ -121,6 +121,26 @@
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<!-- ci test -->
|
||||
<id>jdk12</id>
|
||||
<activation>
|
||||
<jdk>[12,)</jdk>
|
||||
<property>
|
||||
<name>JAVA8_HOME</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sun</groupId>
|
||||
<artifactId>tools</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${JAVA8_HOME}/lib/tools.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>full</id>
|
||||
<build>
|
||||
@@ -462,7 +482,7 @@
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.2</version>
|
||||
<version>0.8.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jacoco-initialize</id>
|
||||
|
||||
Reference in New Issue
Block a user