diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml
new file mode 100644
index 0000000..0357b69
--- /dev/null
+++ b/.github/workflows/integration-test.yml
@@ -0,0 +1,110 @@
+name: Integration tests
+
+on:
+ push:
+ branches: ["**"]
+
+concurrency:
+ group: integration-test-${{ github.ref }}
+ cancel-in-progress: true
+
+env:
+ split-total: 4
+
+jobs:
+ generate-split-index-json:
+ name: Generate split indexes
+ runs-on: ubuntu-latest
+ outputs:
+ json: ${{ steps.generate.outputs.split-index-json }}
+ steps:
+ - name: Checkout split-tests-java-action
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+
+ - name: Generate split index list
+ id: generate
+ uses: ./generate-split-index-json
+ with:
+ split-total: ${{ env.split-total }}
+
+ integration-test:
+ name: "Test #${{ matrix.split-index }}"
+ runs-on: ubuntu-latest
+ needs:
+ - generate-split-index-json
+ permissions:
+ contents: read
+ checks: write
+ strategy:
+ fail-fast: false
+ matrix:
+ split-index: ${{ fromjson(needs.generate-split-index-json.outputs.json) }}
+ env:
+ DOWNLOAD_JAR: false
+ JAR_PATH: split-tests-java/build/libs/split-tests-java.jar
+ steps:
+ - name: Checkout split-tests-java-action
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+
+ - name: Checkout split-tests-java
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+ with:
+ repository: Donnerbart/split-tests-java
+ path: split-tests-java
+
+ - name: Set up JDK 21
+ uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4
+ with:
+ distribution: temurin
+ java-version: 21
+
+ - name: Set up Gradle
+ uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4
+
+ - name: Compile split-tests-java
+ working-directory: split-tests-java
+ run: ./gradlew shadowJar
+
+ - name: Split tests
+ id: split-tests
+ uses: ./
+ with:
+ split-index: ${{ matrix.split-index }}
+ split-total: ${{ env.split-total }}
+ glob: '**/integration-test/tests/*Test.java'
+ exclude-glob: '**/NoClassNameTest.java'
+ junit-glob: '**/integration-test/reports/*.xml'
+ format: 'list'
+ new-test-time: 'average'
+ calculate-optimal-total-split: true
+ debug: true
+
+ - name: Assert split tests
+ env:
+ SPLIT_INDEX: ${{ matrix.split-index }}
+ ACTUAL: ${{ steps.split-tests.outputs.test-suite }}
+ run: |
+ case "$SPLIT_INDEX" in
+ "0")
+ EXPECTED="de.donnerbart.example.SlowestTest"
+ ;;
+ "1")
+ EXPECTED="NoPackageTest de.donnerbart.example.ThirdPartyLibraryTest"
+ ;;
+ "2")
+ EXPECTED="de.donnerbart.example.NoTimingOneTest de.donnerbart.example.WhitespaceClassDefinitionTest"
+ ;;
+ "3")
+ EXPECTED="de.donnerbart.example.NoTimingTwoTest de.donnerbart.example.SlowTest de.donnerbart.example.FastTest"
+ ;;
+ *)
+ echo "Unexpected split index"
+ exit 1
+ ;;
+ esac
+ echo "Expected: $EXPECTED"
+ echo "Actual: $ACTUAL"
+ if [ "$ACTUAL" != "$EXPECTED" ]; then
+ echo "The split tests are not matching"
+ exit 1
+ fi
diff --git a/README.md b/README.md
index 9e25020..9c34c91 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
+[](https://github.com/Donnerbart/split-tests-java-action/actions/workflows/integration-test.yml)
+[](https://github.com/Donnerbart/split-tests-java-action/actions/workflows/release.yml)
+
# @donnerbart/split-tests-java-action
Divides a test suite into groups with equal execution time, based on prior test timings.
diff --git a/integration-test/reports/TEST-de.donnerbart.example.DeletedTest.xml b/integration-test/reports/TEST-de.donnerbart.example.DeletedTest.xml
new file mode 100644
index 0000000..9d7f8b3
--- /dev/null
+++ b/integration-test/reports/TEST-de.donnerbart.example.DeletedTest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/integration-test/reports/TEST-de.donnerbart.example.FastTest.xml b/integration-test/reports/TEST-de.donnerbart.example.FastTest.xml
new file mode 100644
index 0000000..e058f2f
--- /dev/null
+++ b/integration-test/reports/TEST-de.donnerbart.example.FastTest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/integration-test/reports/TEST-de.donnerbart.example.SlowTest.xml b/integration-test/reports/TEST-de.donnerbart.example.SlowTest.xml
new file mode 100644
index 0000000..e4dc56e
--- /dev/null
+++ b/integration-test/reports/TEST-de.donnerbart.example.SlowTest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/integration-test/reports/TEST-de.donnerbart.example.SlowestTest.xml b/integration-test/reports/TEST-de.donnerbart.example.SlowestTest.xml
new file mode 100644
index 0000000..5917324
--- /dev/null
+++ b/integration-test/reports/TEST-de.donnerbart.example.SlowestTest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/integration-test/tests/AbstractTest.java b/integration-test/tests/AbstractTest.java
new file mode 100644
index 0000000..85ee414
--- /dev/null
+++ b/integration-test/tests/AbstractTest.java
@@ -0,0 +1,6 @@
+package de.donnerbart.example;
+
+abstract class AbstractTest {
+
+ abstract void implementableMethod();
+}
diff --git a/integration-test/tests/BaseTest.java b/integration-test/tests/BaseTest.java
new file mode 100644
index 0000000..26435b2
--- /dev/null
+++ b/integration-test/tests/BaseTest.java
@@ -0,0 +1,6 @@
+package de.donnerbart.example;
+
+abstract class BaseTest {
+
+ abstract void implementableMethod();
+}
diff --git a/integration-test/tests/DisabledTest.java b/integration-test/tests/DisabledTest.java
new file mode 100644
index 0000000..559d330
--- /dev/null
+++ b/integration-test/tests/DisabledTest.java
@@ -0,0 +1,12 @@
+package de.donnerbart.example;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+@Disabled("This test should be skipped")
+class DisabledTest {
+
+ @Test
+ void testDisabled() {
+ }
+}
diff --git a/integration-test/tests/FastTest.java b/integration-test/tests/FastTest.java
new file mode 100644
index 0000000..78945c0
--- /dev/null
+++ b/integration-test/tests/FastTest.java
@@ -0,0 +1,10 @@
+package de.donnerbart.example;
+
+import org.junit.jupiter.api.Test;
+
+class FastTest {
+
+ @Test
+ void testFastMethod() {
+ }
+}
diff --git a/integration-test/tests/IgnoreTest.java b/integration-test/tests/IgnoreTest.java
new file mode 100644
index 0000000..fcee5d2
--- /dev/null
+++ b/integration-test/tests/IgnoreTest.java
@@ -0,0 +1,12 @@
+package de.donnerbart.example;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("This test should be skipped")
+class IgnoreTest {
+
+ @Test
+ void testIgnored() {
+ }
+}
diff --git a/integration-test/tests/InterfaceTest.java b/integration-test/tests/InterfaceTest.java
new file mode 100644
index 0000000..c2b29c0
--- /dev/null
+++ b/integration-test/tests/InterfaceTest.java
@@ -0,0 +1,6 @@
+package de.donnerbart.example;
+
+interface BaseTest {
+
+ void implementableMethod();
+}
diff --git a/integration-test/tests/NoClassNameTest.java b/integration-test/tests/NoClassNameTest.java
new file mode 100644
index 0000000..f2f06ff
--- /dev/null
+++ b/integration-test/tests/NoClassNameTest.java
@@ -0,0 +1,4 @@
+package de.donnerbart.example;
+
+record NoClassNameTest(String foo) {
+}
diff --git a/integration-test/tests/NoPackageTest.java b/integration-test/tests/NoPackageTest.java
new file mode 100644
index 0000000..2f36578
--- /dev/null
+++ b/integration-test/tests/NoPackageTest.java
@@ -0,0 +1,2 @@
+class NoPackageTest {
+}
diff --git a/integration-test/tests/NoTimingOneTest.java b/integration-test/tests/NoTimingOneTest.java
new file mode 100644
index 0000000..10e7874
--- /dev/null
+++ b/integration-test/tests/NoTimingOneTest.java
@@ -0,0 +1,10 @@
+package de.donnerbart.example;
+
+import org.junit.jupiter.api.Test;
+
+class NoTimingOneTest {
+
+ @Test
+ void testNoTimingMethod() {
+ }
+}
diff --git a/integration-test/tests/NoTimingTwoTest.java b/integration-test/tests/NoTimingTwoTest.java
new file mode 100644
index 0000000..2312045
--- /dev/null
+++ b/integration-test/tests/NoTimingTwoTest.java
@@ -0,0 +1,10 @@
+package de.donnerbart.example;
+
+import org.junit.jupiter.api.Test;
+
+class NoTimingTwoTest {
+
+ @Test
+ void testNoTimingMethod() {
+ }
+}
diff --git a/integration-test/tests/SlowTest.java b/integration-test/tests/SlowTest.java
new file mode 100644
index 0000000..a9d8a50
--- /dev/null
+++ b/integration-test/tests/SlowTest.java
@@ -0,0 +1,10 @@
+package de.donnerbart.example;
+
+import org.junit.jupiter.api.Test;
+
+class SlowTest {
+
+ @Test
+ void testSlowMethod() {
+ }
+}
diff --git a/integration-test/tests/SlowestTest.java b/integration-test/tests/SlowestTest.java
new file mode 100644
index 0000000..8e462e9
--- /dev/null
+++ b/integration-test/tests/SlowestTest.java
@@ -0,0 +1,10 @@
+package de.donnerbart.example;
+
+import org.junit.jupiter.api.Test;
+
+class SlowestTest {
+
+ @Test
+ void testSlowestMethod() {
+ }
+}
diff --git a/integration-test/tests/ThirdPartyLibraryTest.java b/integration-test/tests/ThirdPartyLibraryTest.java
new file mode 100644
index 0000000..219c1a5
--- /dev/null
+++ b/integration-test/tests/ThirdPartyLibraryTest.java
@@ -0,0 +1,12 @@
+package de.donnerbart.example;
+
+import com.example.test.Util;
+import org.junit.jupiter.api.Test;
+
+class ThirdPartyLibraryTest {
+
+ @Test
+ void testThirdPartyLibraryMethod() {
+ Util.test();
+ }
+}
diff --git a/integration-test/tests/WhitespaceClassDefinitionTest.java b/integration-test/tests/WhitespaceClassDefinitionTest.java
new file mode 100644
index 0000000..07f06f9
--- /dev/null
+++ b/integration-test/tests/WhitespaceClassDefinitionTest.java
@@ -0,0 +1,14 @@
+//@formatter:off
+package de.donnerbart.example
+ ;
+
+import org.junit.jupiter.api.Test;
+
+class WhitespaceClassDefinitionTest
+ extends FastTest {
+
+ @Test
+ void testFastMethod() {
+ }
+}
+//@formatter:on