diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 8653b93..092dec1 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -22,17 +22,17 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '17.0.8+101' + java-version: '17' cache: 'gradle' - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build --no-daemon + run: ./gradlew githubWorkflowTest --no-daemon -i - name: Run Test Coverage - run: ./gradlew jacocoTestReport + run: ./gradlew jacocoTestReport -i -PexecutionData='/home/runner/work/java-interview-coding/java-interview-coding/build/jacoco/jacocoTest.exec' - name: Generate JaCoCo Badge uses: cicirello/jacoco-badge-generator@v2 diff --git a/build.gradle b/build.gradle index 2577d5a..056b4db 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ tasks.withType(Javadoc) { options.encoding = 'UTF-8' } -test { +tasks.withType(Test) { testLogging { events "passed", "skipped", "failed", // "standardOut", // Uncomment to get all logs during tests execution @@ -59,11 +59,17 @@ test { } finalizedBy jacocoTestReport // report is always generated after tests run + jacoco { + destinationFile = layout.buildDirectory.file('jacoco/jacocoTest.exec').get().asFile + classDumpDir = layout.buildDirectory.dir('jacoco/classpathdumps').get().asFile + } } jacocoTestReport { reports { csv.required = true + xml.required = true + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { @@ -75,3 +81,9 @@ jacocoTestReport { })) } } + +task githubWorkflowTest(type: Test) { + exclude '**/**AddMultithreadingTest.class' + exclude '**/**BlockingQueueTest.class' + exclude '**/**DeadlockTest.class' +} diff --git a/src/test/java/by/andd3dfx/multithreading/DeadlockTest.java b/src/test/java/by/andd3dfx/multithreading/DeadlockTest.java index 6a2c163..f8b37d7 100644 --- a/src/test/java/by/andd3dfx/multithreading/DeadlockTest.java +++ b/src/test/java/by/andd3dfx/multithreading/DeadlockTest.java @@ -1,6 +1,5 @@ package by.andd3dfx.multithreading; -import org.junit.Ignore; import org.junit.Test; import java.util.concurrent.CompletableFuture; @@ -10,7 +9,6 @@ public class DeadlockTest { - @Ignore("Fail of Github CI build") @Test public void makeDeadlock() throws InterruptedException { CompletableFuture future = CompletableFuture.supplyAsync(() -> {