Skip to content

Commit f0942d0

Browse files
authored
RATIS-1313. Use matrix build for unit tests to reduce CI time (#422)
1 parent fbe430c commit f0942d0

File tree

3 files changed

+63
-5
lines changed

3 files changed

+63
-5
lines changed

.github/workflows/post-commit.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ jobs:
8080
unit:
8181
name: unit
8282
runs-on: ubuntu-18.04
83+
strategy:
84+
matrix:
85+
profile:
86+
- grpc
87+
- server
88+
- misc
8389
steps:
8490
- uses: actions/checkout@master
8591
- name: Cache for maven dependencies
@@ -90,14 +96,14 @@ jobs:
9096
restore-keys: |
9197
maven-repo-${{ hashFiles('**/pom.xml') }}
9298
maven-repo-
93-
- run: ./dev-support/checks/unit.sh
99+
- run: ./dev-support/checks/unit.sh -P${{ matrix.profile }}-tests
94100
- name: Summary of failures
95101
run: cat target/${{ github.job }}/summary.txt
96-
if: always()
102+
if: ${{ !cancelled() }}
97103
- uses: actions/upload-artifact@master
98-
if: always()
104+
if: ${{ !cancelled() }}
99105
with:
100-
name: unit
106+
name: unit-${{ matrix.profile }}
101107
path: target/unit
102108
- name: Delete temporary build artifacts
103109
run: rm -rf ~/.m2/repository/org/apache/ratis

dev-support/checks/unit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export MAVEN_OPTS="-Xmx4096m"
2626
mvn -B -fae test "$@" | tee "${REPORT_DIR}/output.log"
2727
rc=$?
2828

29-
# shellcheck source=hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
29+
# shellcheck source=dev-support/checks/_mvn_unit_report.sh
3030
source "$DIR/_mvn_unit_report.sh"
3131

3232
if [[ -s "$REPORT_DIR/summary.txt" ]] ; then

pom.xml

+52
Original file line numberDiff line numberDiff line change
@@ -1083,5 +1083,57 @@
10831083
</plugins>
10841084
</build>
10851085
</profile>
1086+
1087+
<profile>
1088+
<id>grpc-tests</id>
1089+
<build>
1090+
<plugins>
1091+
<plugin>
1092+
<groupId>org.apache.maven.plugins</groupId>
1093+
<artifactId>maven-surefire-plugin</artifactId>
1094+
<configuration>
1095+
<includes>
1096+
<include>org.apache.ratis.grpc.**</include>
1097+
</includes>
1098+
</configuration>
1099+
</plugin>
1100+
</plugins>
1101+
</build>
1102+
</profile>
1103+
<profile>
1104+
<id>server-tests</id>
1105+
<build>
1106+
<plugins>
1107+
<plugin>
1108+
<groupId>org.apache.maven.plugins</groupId>
1109+
<artifactId>maven-surefire-plugin</artifactId>
1110+
<configuration>
1111+
<includes>
1112+
<include>org.apache.ratis.datastream.**</include>
1113+
<include>org.apache.ratis.server.**</include>
1114+
</includes>
1115+
</configuration>
1116+
</plugin>
1117+
</plugins>
1118+
</build>
1119+
</profile>
1120+
<profile>
1121+
<id>misc-tests</id>
1122+
<build>
1123+
<plugins>
1124+
<plugin>
1125+
<groupId>org.apache.maven.plugins</groupId>
1126+
<artifactId>maven-surefire-plugin</artifactId>
1127+
<configuration>
1128+
<excludes>
1129+
<exclude>org.apache.ratis.datastream.**</exclude>
1130+
<exclude>org.apache.ratis.grpc.**</exclude>
1131+
<exclude>org.apache.ratis.server.**</exclude>
1132+
</excludes>
1133+
</configuration>
1134+
</plugin>
1135+
</plugins>
1136+
</build>
1137+
</profile>
10861138
</profiles>
10871139
</project>

0 commit comments

Comments
 (0)