Skip to content

Commit 9e288bd

Browse files
committed
Add github workflow test for native image
1 parent ee173a5 commit 9e288bd

File tree

8 files changed

+158
-3
lines changed

8 files changed

+158
-3
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ indent_style = space
1010
insert_final_newline = true
1111
trim_trailing_whitespace = true
1212
spaces_around_operators = true
13+
14+
[*.json]
15+
indent_size = 1
16+
indent_style = space

.github/workflows/native-image.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: avaje-config native image
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '40 0 1 1 6'
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
permissions:
12+
contents: read
13+
packages: write
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
os: [ubuntu-latest]
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: graalvm/setup-graalvm@v1
22+
with:
23+
java-version: '21'
24+
distribution: 'graalvm'
25+
cache: 'maven'
26+
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Versions
29+
run: |
30+
echo "GRAALVM_HOME: $GRAALVM_HOME"
31+
echo "JAVA_HOME: $JAVA_HOME"
32+
java --version
33+
native-image --version
34+
- name: Build with Maven
35+
run: |
36+
mvn clean install -DskipTests
37+
cd tests/test-native-image
38+
mvn clean package -Pnative
39+
./target/test-native
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"resources": [
3+
{
4+
"pattern": "application.properties"
5+
},
6+
{
7+
"pattern": "application.yaml"
8+
},
9+
{
10+
"pattern": "application.yml"
11+
}
12+
]
13+
}

pom.xml

+16-3
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,31 @@
44
<parent>
55
<groupId>org.avaje</groupId>
66
<artifactId>java11-oss</artifactId>
7-
<version>3.10</version>
7+
<version>3.12</version>
8+
<relativePath/>
89
</parent>
910

1011
<groupId>io.avaje</groupId>
11-
<artifactId>avaje-config-reactor</artifactId>
12+
<artifactId>tests-config-reactor</artifactId>
1213
<version>1</version>
1314
<packaging>pom</packaging>
14-
<name>avaje config reactor</name>
1515

1616
<modules>
1717
<module>avaje-config</module>
18+
<!-- <module>tests</module>-->
1819
</modules>
1920

21+
<!-- <profiles>-->
22+
<!-- <profile>-->
23+
<!-- <id>central</id>-->
24+
<!-- </profile>-->
25+
<!-- <profile>-->
26+
<!-- <id>native</id>-->
27+
<!-- <modules>-->
28+
<!-- <module>tests</module>-->
29+
<!-- </modules>-->
30+
<!-- </profile>-->
31+
<!-- </profiles>-->
32+
2033
</project>
2134

tests/pom.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.avaje</groupId>
6+
<artifactId>java11-oss</artifactId>
7+
<version>3.12</version>
8+
<relativePath/>
9+
</parent>
10+
11+
<artifactId>tests</artifactId>
12+
<packaging>pom</packaging>
13+
14+
<modules>
15+
<module>test-native-image</module>
16+
</modules>
17+
18+
</project>

tests/test-native-image/pom.xml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>test-native</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.release>21</maven.compiler.release>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<version.plugin.nativeimage>0.9.27</version.plugin.nativeimage>
15+
<mainClass>org.example.Main</mainClass>
16+
</properties>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>io.avaje</groupId>
21+
<artifactId>avaje-config</artifactId>
22+
<version>3.9-SNAPSHOT</version>
23+
</dependency>
24+
</dependencies>
25+
26+
<profiles>
27+
<profile>
28+
<id>native</id>
29+
<build>
30+
<plugins>
31+
<plugin>
32+
<groupId>org.graalvm.buildtools</groupId>
33+
<artifactId>native-maven-plugin</artifactId>
34+
<version>${version.plugin.nativeimage}</version>
35+
<executions>
36+
<execution>
37+
<id>build-native</id>
38+
<goals>
39+
<goal>build</goal>
40+
</goals>
41+
<phase>package</phase>
42+
<configuration>
43+
<buildArgs>
44+
<buildArg>--no-fallback</buildArg>
45+
<buildArg>--allow-incomplete-classpath</buildArg>
46+
</buildArgs>
47+
</configuration>
48+
</execution>
49+
</executions>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
</profile>
54+
</profiles>
55+
56+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.example;
2+
3+
import io.avaje.config.Config;
4+
5+
public class Main {
6+
7+
public static void main(String[] args) {
8+
String val = Config.get("hello.world", "not-set");
9+
System.out.println("Hello - " + val);
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello.world=Rob

0 commit comments

Comments
 (0)