Skip to content

Commit

Permalink
What type of PR is this?
Browse files Browse the repository at this point in the history
 for linke ut/it
  • Loading branch information
yuzhi.lyz committed Dec 14, 2020
1 parent 58dd933 commit 9334fed
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 22 deletions.
23 changes: 18 additions & 5 deletions .aci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
stages: # 定义了一条pipeline
- 代码检测 # 定义了stage
- 单元测试
# - 编译

- 测试
- 编译

#- 发布JAR包

Expand All @@ -19,13 +18,27 @@ STC扫描:
- stc = 0

单元测试:
stage: 单元测试
plugin: UT
stage: 测试
plugin: LINKQ-UT # java单元测试插件
checkRule:
- passRate = 100
pluginConfig:
markdown: admin/result.md # 向页面输出一些自定义内容

#see https://code.alipay.com/common_release/avatarpoc/blob/master/.aci.test.yml
集成测试:
stage: 测试
plugin: LINKQ-IT # java集成测试插件
tools:
jdk: '1.8'
maven: 3.0.3
parameters:
encoding: UTF-8 # 编码设置
pluginConfig:
privateRepo: false, # 是否是私有仓库
parallelCount: 1 # 并发执行个数
enableOracle: false # 是否依赖Oracle

编译:
stage: 编译
plugin: ANT-BUILD # 使用插件ANT-BUILD
Expand Down
29 changes: 20 additions & 9 deletions .master.aci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
stages: # 定义了一条pipeline
- 代码检测 # 定义了stage
- 单元测试
- 测试
- 编译
#- 发布JAR包
- 发布JAR包

PMD扫描: # 定义了一个job
stage: 代码检测 # 绑定到stage
Expand All @@ -17,13 +17,27 @@ STC扫描:
- stc = 0

单元测试:
stage: 单元测试
plugin: UT
stage: 测试
plugin: LINKQ-UT # java单元测试插件
checkRule:
- passRate = 100
pluginConfig:
markdown: admin/result.md # 向页面输出一些自定义内容

#see https://code.alipay.com/common_release/avatarpoc/blob/master/.aci.test.yml
集成测试:
stage: 测试
plugin: LINKQ-IT # java集成测试插件
tools:
jdk: '1.8'
maven: 3.0.3
parameters:
encoding: UTF-8 # 编码设置
pluginConfig:
privateRepo: false, # 是否是私有仓库
parallelCount: 1 # 并发执行个数
enableOracle: false # 是否依赖Oracle

编译:
stage: 编译
plugin: ANT-BUILD # 使用插件ANT-BUILD
Expand All @@ -33,10 +47,7 @@ STC扫描:
- export PATH=$PATH:/opt/taobao/java/bin:/opt/taobao/maven/bin
- java -version
- mvn -version
- mvn clean package -Dmaven.test.skip=true -Ptest
outputs:
- name: registry.tgz
paths: ["./distribution-enterprise/alipay/target/registry.tgz"]
- mvn clean package -Dmaven.test.skip=true -Pdev

发布JAR包:
stage: 发布JAR包
Expand All @@ -48,4 +59,4 @@ STC扫描:
- mvn -version
- sed -i '/<mirrors>/,/<\/mirrors>/d' /opt/taobao/maven_settings/settings-release.xml
- sed -i '/<profiles>/,/<\/profiles>/d' /opt/taobao/maven_settings/settings-release.xml
- mvn clean deploy -Dmaven.test.skip=true -s /opt/taobao/maven_settings/settings-release.xml -Ptest -Pantcode-release
- mvn clean deploy -Dmaven.test.skip=true -s /opt/taobao/maven_settings/settings-release.xml -Pdev -Pantcode-release
32 changes: 24 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
<rocksdbjni.version>6.4.6</rocksdbjni.version>
<main.user.dir>${user.dir}</main.user.dir>
<argLine>-Dnetwork_interface_denylist=docker0</argLine>
<!-- for linke 添加isSkipUT, isSkipIT参数声明,防止编译时产生错误 -->
<isSkipUT>false</isSkipUT>
<isSkipIT>false</isSkipIT>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -409,14 +412,6 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<forkMode>once</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand All @@ -440,6 +435,27 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<!-- 根据JDK版本配置,jdk8: -Xmx1024m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -->
<argLine>-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m</argLine>
<skipTests>${isSkipUT}</skipTests>
<includes>
<!-- 这里需要根据自己的需要指定要跑的单元测试 -->
<include>**/*Test.java</include>
</includes>
<excludes>
<!-- 这里需要根据自己的需要指定要排除单元测试 -->
<!-- <exclude>com/alipay/**/*.java</exclude>-->
</excludes>
<!-- 如无特殊需求,将forkMode设置为once -->
<forkMode>once</forkMode>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
40 changes: 40 additions & 0 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

<properties>
<main.user.dir>../</main.user.dir>
<!-- for linke 引入jacoco.path的参数定义 -->
<jacoco.path>${project.build.directory}/jacoco-it.exec</jacoco.path>
</properties>

<dependencies>
Expand Down Expand Up @@ -76,4 +78,42 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<skipTests>${isSkipIT}</skipTests>
<includes>
<!-- 这里需要根据自己的需要指定要跑的测试类 -->
<include>**/*Test.java</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<executions>
<execution>
<id>test-testng</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<junitArtifactName>none:none</junitArtifactName>
<testNGArtifactName>org.testng:com.springsource.org.testng</testNGArtifactName>
<argLine>-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m</argLine>
<suiteXmlFiles>
<!-- 这里需要根据自己配置的testng的xml指定对应的路径 -->
<suiteXmlFile>src/test/resources/testSuiteCore.xml</suiteXmlFile>
</suiteXmlFiles>
<!-- 如无特殊需求,将forkMode设置为once -->
<forkMode>once</forkMode>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 9334fed

Please sign in to comment.