Skip to content

Commit f30d8af

Browse files
committed
Initial integration test for macos
1 parent 56b3710 commit f30d8af

File tree

11 files changed

+512
-0
lines changed

11 files changed

+512
-0
lines changed

.github/workflows/integration.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Integration Tests
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
test_macos:
8+
runs-on: macos-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Install java
12+
uses: actions/setup-java@v3
13+
with:
14+
distribution: 'temurin'
15+
java-version: '21'
16+
- name: Build javapackager
17+
run: ./gradlew publishToMavenLocal
18+
- name: Run gradle integration tests
19+
working-directory: integration/gradle/app
20+
run: ./gradlew test
21+
# TODO: Add maven integration tests
22+
# TODO windows
23+
# TODO linux

integration/gradle/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
}
5+
dependencies {
6+
classpath 'io.github.fvarrui:javapackager:1.7.7-SNAPSHOT'
7+
}
8+
}
9+
10+
plugins {
11+
id 'application'
12+
}
13+
apply plugin: 'io.github.fvarrui.javapackager.plugin'
14+
15+
version = '1.0.0-SNAPSHOT'
16+
17+
repositories {
18+
mavenCentral()
19+
}
20+
21+
dependencies {
22+
// Include a dependency to ensure that dependency packaging works correctly
23+
implementation 'org.apache.commons:commons-lang3:3.20.0'
24+
}
25+
26+
java {
27+
toolchain {
28+
languageVersion = JavaLanguageVersion.of(21)
29+
}
30+
}
31+
32+
application {
33+
mainClass = 'org.example.App'
34+
}
35+
36+
tasks.register("packageForMac", io.github.fvarrui.javapackager.gradle.PackageTask) {
37+
dependsOn(tasks.build)
38+
39+
mainClass = 'org.example.App'
40+
bundleJre = true
41+
generateInstaller = true
42+
administratorRequired = false
43+
platform = "mac"
44+
macConfig {
45+
appId = "org.example.javapackagerdemo"
46+
generateDmg = true
47+
generatePkg = true
48+
macStartup = io.github.fvarrui.javapackager.model.MacStartup.UNIVERSAL
49+
}
50+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.example;
2+
3+
import org.apache.commons.lang3.SystemUtils;
4+
5+
import java.io.IOException;
6+
import java.nio.file.Files;
7+
import java.nio.file.Path;
8+
9+
public class App {
10+
public static void main(String[] args) throws IOException {
11+
String targetDir;
12+
// Use hardcoded directories to make the test script simple. This may not run correctly on all systems, as long
13+
// as it runs correctly on the github actions runners it is good enough
14+
if(SystemUtils.IS_OS_WINDOWS) {
15+
targetDir = "C:\\Windows\\Temp";
16+
} else if(SystemUtils.IS_OS_LINUX) {
17+
targetDir = "/tmp";
18+
} else if(SystemUtils.IS_OS_MAC) {
19+
targetDir = "/tmp";
20+
} else {
21+
throw new RuntimeException("Unsupported OS");
22+
}
23+
Path targetFile = Path.of(targetDir, "javapackager-testfile.txt");
24+
Files.write(targetFile, Long.toString(System.currentTimeMillis()).getBytes());
25+
}
26+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3+
4+
org.gradle.configuration-cache=false
5+
44.4 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

integration/gradle/gradlew

Lines changed: 251 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)