Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into feature/failure-on-cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
heowc committed Jun 8, 2024
2 parents 2a3ca04 + 9cde319 commit d789a67
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<GraphvizEngine> detectAvailableEngines() {
try {
Graphviz.useDefaultEngines();
final Field field = Graphviz.class.getDeclaredField("availableEngines");
field.setAccessible(true);
return (List<GraphvizEngine>) 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);
Expand Down

0 comments on commit d789a67

Please sign in to comment.