Skip to content

Commit

Permalink
RATIS-1313. Use matrix build for unit tests to reduce CI time (apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored and symious committed Feb 20, 2024
1 parent 92929ba commit 947253b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/post-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ jobs:
unit:
name: unit
runs-on: ubuntu-18.04
strategy:
matrix:
profile:
- grpc
- server
- misc
steps:
- uses: actions/checkout@master
- name: Cache for maven dependencies
Expand All @@ -90,14 +96,14 @@ jobs:
restore-keys: |
maven-repo-${{ hashFiles('**/pom.xml') }}
maven-repo-
- run: ./dev-support/checks/unit.sh
- run: ./dev-support/checks/unit.sh -P${{ matrix.profile }}-tests
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
if: ${{ !cancelled() }}
- uses: actions/upload-artifact@master
if: always()
if: ${{ !cancelled() }}
with:
name: unit
name: unit-${{ matrix.profile }}
path: target/unit
- name: Delete temporary build artifacts
run: rm -rf ~/.m2/repository/org/apache/ratis
Expand Down
2 changes: 1 addition & 1 deletion dev-support/checks/unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export MAVEN_OPTS="-Xmx4096m"
mvn -B -fae test "$@" | tee "${REPORT_DIR}/output.log"
rc=$?

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

if [[ -s "$REPORT_DIR/summary.txt" ]] ; then
Expand Down
52 changes: 52 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1083,5 +1083,57 @@
</plugins>
</build>
</profile>

<profile>
<id>grpc-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>org.apache.ratis.grpc.**</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>server-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>org.apache.ratis.datastream.**</include>
<include>org.apache.ratis.server.**</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>misc-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>org.apache.ratis.datastream.**</exclude>
<exclude>org.apache.ratis.grpc.**</exclude>
<exclude>org.apache.ratis.server.**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 947253b

Please sign in to comment.