Last active
December 13, 2021 09:58
-
-
Save keiththompson/e7b6932bfbf515a5c2b656f49b202825 to your computer and use it in GitHub Desktop.
CircleCI’s parallelization: junit tests with Gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
testFiles=$(find ./{app}/src/test/java/{your}/{package}/{name} -name '*.java' | sort | awk "NR % ${CIRCLE_NODE_TOTAL} == ${CIRCLE_NODE_INDEX}") | |
./gradlew test -PtestFilter="$testFiles" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testOptions { | |
unitTests.all { | |
if (project.hasProperty("testFilter")) { | |
ArrayList props = project.getProperties().get("testFilter") | |
.replaceAll("./app/src/test/java/{your}/{package}/{name}/", "**/") | |
.replaceAll(".java", ".class") | |
.split("\\s+") | |
for (String item : props) { | |
include item | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test: | |
override: | |
- sh ./balancing.sh: | |
parallel: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment