From 7d5b50641c69be0a0e805a4972e7a3e77ebd86af Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 24 Mar 2025 01:44:39 -0700 Subject: [PATCH] Add OS matrix to test the project and examples on Ubuntu, Windows and macOS --- .github/workflows/bld.yml | 22 ++++++++++++------- .../bld/extension/DetektOperationBuild.java | 12 ++++++---- .../bld/extension/DetektOperationTest.java | 3 +++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index 15f647d..cfed82f 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -1,14 +1,16 @@ name: bld-ci -on: [push, pull_request, workflow_dispatch] +on: [ push, pull_request, workflow_dispatch ] jobs: build-bld-project: - runs-on: ubuntu-latest - strategy: matrix: - java-version: [17, 21, 24] + java-version: [ 17, 21, 24 ] + kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + + runs-on: ${{ matrix.os }} steps: - name: Checkout source repository @@ -22,12 +24,16 @@ jobs: distribution: "zulu" java-version: ${{ matrix.java-version }} - - name: Download dependencies - run: ./bld download - - name: Download dependencies [examples] working-directory: examples run: ./bld download - - name: Run tests + - name: Run tests [examples] + working-directory: examples run: ./bld compile test + + - name: Download dependencies + run: ./bld download + + - name: Run tests + run: ./bld compile test \ No newline at end of file diff --git a/src/bld/java/rife/bld/extension/DetektOperationBuild.java b/src/bld/java/rife/bld/extension/DetektOperationBuild.java index 515bb9e..78f1a3e 100644 --- a/src/bld/java/rife/bld/extension/DetektOperationBuild.java +++ b/src/bld/java/rife/bld/extension/DetektOperationBuild.java @@ -23,6 +23,7 @@ import rife.bld.publish.PublishLicense; import rife.bld.publish.PublishScm; import java.util.List; +import java.util.Locale; import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Scope.compile; @@ -97,10 +98,13 @@ public class DetektOperationBuild extends Project { @Override public void test() throws Exception { - new ExecOperation() - .fromProject(this) - .command("scripts/cliargs.sh") - .execute(); + var os = System.getProperty("os.name"); + if (os != null && os.toLowerCase(Locale.US).contains("linux")) { + new ExecOperation() + .fromProject(this) + .command("scripts/cliargs.sh") + .execute(); + } super.test(); } diff --git a/src/test/java/rife/bld/extension/DetektOperationTest.java b/src/test/java/rife/bld/extension/DetektOperationTest.java index ecc510a..16e6345 100644 --- a/src/test/java/rife/bld/extension/DetektOperationTest.java +++ b/src/test/java/rife/bld/extension/DetektOperationTest.java @@ -19,6 +19,8 @@ package rife.bld.extension; import org.assertj.core.api.AutoCloseableSoftAssertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; import rife.bld.BaseProject; import rife.bld.blueprints.BaseProjectBlueprint; import rife.bld.extension.detekt.Report; @@ -92,6 +94,7 @@ class DetektOperationTest { } @Test + @EnabledOnOs(OS.LINUX) @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") void testCheckAllParameters() throws IOException { var args = Files.readAllLines(Paths.get("src", "test", "resources", "detekt-args.txt"));