diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 517907a..e9b58f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,21 +10,25 @@ jobs: ci: permissions: pull-requests: write - runs-on: ubuntu-latest + strategy: + matrix: + os: [ macos-12, ubuntu-latest ] + version: [ 17, 21 ] + runs-on: ${{ matrix.os }} + name: ci-${{ matrix.os }}-jdk-${{ matrix.version }} steps: - uses: actions/checkout@v4 - name: Set up JDK uses: graalvm/setup-graalvm@v1 with: - java-version: '21' # See 'Options' section below for all supported versions - distribution: 'graalvm' # See 'Options' section below for all available distributions + java-version: ${{ matrix.version }} + distribution: 'graalvm' - name: Check Gradle Version run: | chmod +x gradlew ./gradlew --version - - name: Install Graphviz - run: | - sudo apt install -y graphviz + - name: Setup Graphviz + uses: ts-graphviz/setup-graphviz@v2 - name: Test run: | ./gradlew --parallel --max-workers=4 build @@ -36,13 +40,16 @@ jobs: if: success() run: | JAR_FILE=$(ls -al ./heo-cli/build/libs/ | tail -1 | awk '{print $9}') - java -jar ./heo-cli/build/libs/$JAR_FILE -d $(pwd) -p dev.heowc.heo.core -o ${{ github.event.pull_request.number }}.png + java -jar ./heo-cli/build/libs/$JAR_FILE \ + -d $(pwd) \ + -p dev.heowc.heo.core \ + -o interg-report.png - name: Upload self report file if: success() && github.event.pull_request.number != '' uses: actions/upload-artifact@v4 with: - path: ${{ github.event.pull_request.number }}.png - name: interg-reports + path: interg-report.png + name: interg-reports-${{ github.event.pull_request.number }}-${{ github.run_id }}-${{ matrix.os }}-jdk-${{ matrix.version }} retention-days: 7 - name: If failure then upload test reports diff --git a/heo-core/src/main/java/dev/heowc/heo/core/visualization/ReportVisualizationService.java b/heo-core/src/main/java/dev/heowc/heo/core/visualization/ReportVisualizationService.java index 3ed55ec..d557fb7 100644 --- a/heo-core/src/main/java/dev/heowc/heo/core/visualization/ReportVisualizationService.java +++ b/heo-core/src/main/java/dev/heowc/heo/core/visualization/ReportVisualizationService.java @@ -2,8 +2,10 @@ import java.io.File; import java.io.IOException; +import java.lang.reflect.Field; +import java.util.List; -import guru.nidi.graphviz.engine.GraphvizJdkEngine; +import guru.nidi.graphviz.engine.GraphvizEngine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -18,6 +20,22 @@ public class ReportVisualizationService { private static final Logger logger = LoggerFactory.getLogger(ReportVisualizationService.class); + static { + logger.debug("Available engines: {}", detectAvailableEngines()); + } + + private static List detectAvailableEngines() { + try { + Graphviz.useDefaultEngines(); + final Field field = Graphviz.class.getDeclaredField("availableEngines"); + field.setAccessible(true); + return (List) field.get(null); + } catch (Throwable e) { + logger.debug("Could not detect available engines", e); + } + return List.of(); + } + public void createFile(String report, String destination) { try { final File file = new File(destination);