diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 82e47bcd..124e8e78 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,55 +1,27 @@ -name: Java CI Tests +name: Test Build on: push: - branches: [ master ] + branches: [ "master" ] pull_request: - branches: [ master ] + branches: [ "master" ] jobs: - test: + build: runs-on: ubuntu-latest - defaults: - run: - working-directory: diylc steps: - - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - - - name: Run Tests - run: mvn test - - # Generate and report coverage without failing - - name: Generate Coverage Report - run: mvn jacoco:report - - - name: Report Coverage - run: | - COVERAGE=$(mvn jacoco:report | grep -oP 'Total coverage: \K[0-9.]+' || echo "unknown") - echo "Current test coverage: $COVERAGE%" - - - name: Upload Coverage Report - uses: actions/upload-artifact@v4 - with: - name: coverage-report - path: diylc/target/site/jacoco/ - retention-days: 5 - - # Optional: Comment test results on PR - - name: Add Test Results Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' - with: - message: | - ### Test Results Summary - ✅ Tests completed - 📊 Coverage: ${{ env.COVERAGE }}% - - Coverage report available in workflow artifacts + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: | + cd diylc + mvn -B test diff --git a/diylc/.github/workflows/test.yml b/diylc/.github/workflows/test.yml deleted file mode 100644 index 0b7d7c72..00000000 --- a/diylc/.github/workflows/test.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Test Build - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - path: diy-layout-creator - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - - - name: Build with Maven - run: | - cd diy-layout-creator/diylc - mvn -B test --file pom.xml \ No newline at end of file diff --git a/diylc/.github/workflows/tests.yml b/diylc/.github/workflows/tests.yml deleted file mode 100644 index f9d01b4d..00000000 --- a/diylc/.github/workflows/tests.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Java CI Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - java-version: '11' # Adjust version as needed - distribution: 'temurin' - cache: maven - - - name: Run Tests - run: mvn test - - # Generate and report coverage without failing - - name: Generate Coverage Report - run: mvn jacoco:report - - - name: Report Coverage - run: | - COVERAGE=$(mvn jacoco:report | grep -oP 'Total coverage: \K[0-9.]+' || echo "unknown") - echo "Current test coverage: $COVERAGE%" - - - name: Upload Coverage Report - uses: actions/upload-artifact@v3 - with: - name: coverage-report - path: target/site/jacoco/ - - # Optional: Comment test results on PR - - name: Add Test Results Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' - with: - message: | - ### Test Results Summary - ✅ Tests completed - 📊 Coverage: ${{ env.COVERAGE }}% - - Coverage report available in workflow artifacts \ No newline at end of file diff --git a/diylc/diylc-core/.project b/diylc/diylc-core/.project new file mode 100644 index 00000000..02064572 --- /dev/null +++ b/diylc/diylc-core/.project @@ -0,0 +1,23 @@ + + + diylc-core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/diylc/diylc-core/src/main/java/org/diylc/utils/Constants.java b/diylc/diylc-core/src/main/java/org/diylc/utils/Constants.java index 7d71e266..61990f40 100644 --- a/diylc/diylc-core/src/main/java/org/diylc/utils/Constants.java +++ b/diylc/diylc-core/src/main/java/org/diylc/utils/Constants.java @@ -21,17 +21,15 @@ */ package org.diylc.utils; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Stroke; -import java.awt.Toolkit; +import java.awt.*; import org.diylc.core.Theme; public class Constants { public static final int PIXELS_PER_INCH = 200; - public static final double PIXEL_SIZE = 1d * PIXELS_PER_INCH / Toolkit.getDefaultToolkit().getScreenResolution(); + public static final double PIXEL_SIZE = 1d * PIXELS_PER_INCH / + (GraphicsEnvironment.isHeadless() ? 96 : Toolkit.getDefaultToolkit().getScreenResolution()); public static Color CANVAS_COLOR = Color.white;