Skip to content

Commit 31234a5

Browse files
committed
Refactor github actions workflow into different jobs, add Linux and macOS test steps.
1 parent 6ee9922 commit 31234a5

File tree

2 files changed

+69
-22
lines changed

2 files changed

+69
-22
lines changed

.github/workflows/workflow.yml

Lines changed: 68 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,22 @@ on:
1919
- master
2020
- dev
2121

22+
env:
23+
JAVA_VERSION: '14.0.2'
24+
TEST_SCREEN_WIDTH: '1920'
25+
TEST_SCREEN_HEIGHT: '1080'
26+
2227
jobs:
23-
Build:
24-
runs-on: ${{ matrix.os }}
25-
strategy:
26-
matrix:
27-
os: [ubuntu-latest, macOS-latest, windows-latest]
28-
fail-fast: false
29-
name: ${{ matrix.os }}
28+
Build-and-Test-Windows:
29+
runs-on: windows-latest
30+
name: Build and Test (Windows)
3031
steps:
3132
- name: Git checkout
3233
uses: actions/checkout@v2
3334
- name: Set up JDK
3435
uses: actions/setup-java@v1
3536
with:
36-
java-version: '14.0.2'
37+
java-version: ${{ env.JAVA_VERSION }}
3738
- name: Cache Gradle packages
3839
uses: actions/cache@v2
3940
with:
@@ -44,41 +45,87 @@ jobs:
4445
uses: gradle/wrapper-validation-action@v1
4546
- name: Build
4647
run: ./gradlew --info --stacktrace build -x test
47-
- name: Set screen resolution
48-
if: runner.os == 'Windows'
48+
- name: Test setup
4949
run: |
5050
choco install -y change-screen-resolution
51-
changescreenresolution 1920 1080
51+
changescreenresolution $TEST_SCREEN_WIDTH $TEST_SCREEN_HEIGHT
5252
- name: Test
53-
if: runner.os == 'Windows'
5453
run: ./gradlew --info --stacktrace test
5554
- name: Publish coverage report
56-
if: runner.os == 'Windows'
5755
uses: codecov/codecov-action@v1
5856
with:
5957
directory: build/reports/
6058
- name: Jpackage
6159
run: ./gradlew --info --stacktrace jpackage
62-
- name: Upload installer (Windows, exe)
63-
if: runner.os == 'Windows'
60+
- name: Upload installer (exe)
6461
uses: actions/upload-artifact@v2
6562
with:
6663
name: BoundingBoxEditor-Windows-exe
6764
path: build/jpackage/*.exe
68-
- name: Upload installer (Linux, deb)
69-
if: runner.os == 'Linux'
65+
Build-and-Test-Linux:
66+
runs-on: ubuntu-latest
67+
name: Build and Test (Linux)
68+
steps:
69+
- name: Git checkout
70+
uses: actions/checkout@v2
71+
- name: Set up JDK
72+
uses: actions/setup-java@v1
73+
with:
74+
java-version: ${{ env.JAVA_VERSION }}
75+
- name: Cache Gradle packages
76+
uses: actions/cache@v2
77+
with:
78+
path: ~/.gradle/caches
79+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
80+
restore-keys: ${{ runner.os }}-gradle
81+
- name: Verify Gradle wrapper
82+
uses: gradle/wrapper-validation-action@v1
83+
- name: Build
84+
run: ./gradlew --info --stacktrace build -x test
85+
- name: Test setup
86+
run: sudo apt-get install xvfb
87+
- name: Test
88+
run: xvfb-run --auto-servernum --server-args="-screen 0, ${TEST_SCREEN_WIDTH}x${TEST_SCREEN_HEIGHT}x24" ./gradlew --stacktrace --info test
89+
- name: Jpackage
90+
run: ./gradlew --info --stacktrace jpackage
91+
- name: Upload installer (deb)
7092
uses: actions/upload-artifact@v2
7193
with:
7294
name: BoundingBoxEditor-Linux-deb
7395
path: build/jpackage/*.deb
74-
- name: Upload installer (Linux, rpm)
75-
if: runner.os == 'Linux'
96+
- name: Upload installer (rpm)
7697
uses: actions/upload-artifact@v2
7798
with:
7899
name: BoundingBoxEditor-Linux-rpm
79100
path: build/jpackage/*.rpm
80-
- name: Upload installer (macOS, dmg)
81-
if: runner.os == 'macOS'
101+
Build-and-Test-macOS:
102+
runs-on: macOS-latest
103+
name: Build and Test (macOS)
104+
steps:
105+
- name: Git checkout
106+
uses: actions/checkout@v2
107+
- name: Set up JDK
108+
uses: actions/setup-java@v1
109+
with:
110+
java-version: ${{ env.JAVA_VERSION }}
111+
- name: Cache Gradle packages
112+
uses: actions/cache@v2
113+
with:
114+
path: ~/.gradle/caches
115+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
116+
restore-keys: ${{ runner.os }}-gradle
117+
- name: Verify Gradle wrapper
118+
uses: gradle/wrapper-validation-action@v1
119+
- name: Build
120+
run: ./gradlew --info --stacktrace build -x test
121+
- name: Test setup
122+
run: |
123+
"/Library/Application Support/VMware Tools/vmware-resolutionSet" $TEST_SCREEN_WIDTH $TEST_SCREEN_HEIGHT
124+
- name: Test
125+
run: ./gradlew --info --stacktrace test
126+
- name: Jpackage
127+
run: ./gradlew --info --stacktrace jpackage
128+
- name: Upload installer (dmg)
82129
uses: actions/upload-artifact@v2
83130
with:
84131
name: BoundingBoxEditor-macOS-dmg

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ javafx {
6666
test {
6767
useJUnitPlatform()
6868

69-
jvmArgs '-Dtestfx.robot=awt'
69+
jvmArgs = ['-Dtestfx.robot=awt', '-Xmx3072m']
7070

7171
moduleOptions {
7272
runOnClasspath = true

0 commit comments

Comments
 (0)