Skip to content

Commit

Permalink
Run headless tests (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
jperedadnr authored Dec 6, 2024
1 parent 501ff69 commit fab017f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 25 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,22 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'oracle'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN

- name: Build project (macOS)
if: runner.os == 'macOS'
- name: Build project (Linux/macOS)
if: runner.os != 'Windows'
run: |
./mvnw -B -ntp verify -f rta
./mvnw -B -ntp -Ptest verify -f rta
- name: Build project (Windows)
if: runner.os == 'Windows'
run: |
.\mvnw -B -ntp verify -f rta
- name: Build project (Linux)
if: runner.os == 'Linux'
run: |
export DISPLAY=:90
Xvfb -ac :90 -screen 0 1280x1024x24 > /dev/null 2>&1 &
./mvnw -B -ntp verify -f rta
.\mvnw -B -ntp -Ptest verify -f rta
- name: Publish Snapshots
if: github.ref == 'refs/heads/main' && runner.os == 'Linux'
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Java and Apache Maven
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'oracle'
cache: 'maven'
server-id: ossrh
Expand All @@ -39,9 +39,8 @@ jobs:
- name: Publish to Maven Central
id: deploy
run: |
export DISPLAY=:90
Xvfb -ac :90 -screen 0 1280x1024x24 > /dev/null 2>&1 &
./mvnw -B -ntp -Prelease deploy -f rta
./mvnw -B -ntp -Ptest verify -f rta
./mvnw -B -Dmaven.test.skip=true -Prelease deploy -f rta
echo ::set-output name=exit_code::$?
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
Expand Down
57 changes: 48 additions & 9 deletions rta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<javafx.version>23.0.1</javafx.version>
<gpg.plugin.version>3.2.7</gpg.plugin.version>
<emoji.version>1.1.0</emoji.version>
<test.headless/>
<test.javafx.version>24-headless+0-2024-12-02-101029</test.javafx.version>
</properties>

<dependencies>
Expand All @@ -37,16 +39,36 @@
<artifactId>offline</artifactId>
<version>${emoji.version}</version>
</dependency>

<!-- TEST -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-core</artifactId>
<version>4.0.19-gluon-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-junit5</artifactId>
<version>4.0.18</version>
<version>4.0.19-gluon-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -107,6 +129,17 @@
</repository>
</distributionManagement>

<repositories>
<repository>
<id>Gluon Releases</id>
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
</repository>
<repository>
<id>Gluon Snapshots</id>
<url>https://nexus.gluonhq.com/nexus/content/repositories/public-snapshots/</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -150,21 +183,14 @@
<version>3.5.2</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<argLine>--add-opens javafx.graphics/com.sun.javafx.application=ALL-UNNAMED</argLine>
<argLine>${test.headless} --add-opens javafx.graphics/com.sun.javafx.application=ALL-UNNAMED</argLine>
<systemProperties>
<property>
<name>java.util.logging.config.file</name>
<value>src/test/resources/logging.properties</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down Expand Up @@ -210,5 +236,18 @@
</plugins>
</build>
</profile>
<profile>
<id>test</id>
<properties>
<test.headless>-Dtestfx.headless=true</test.headless>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${test.javafx.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

0 comments on commit fab017f

Please sign in to comment.