Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Native

on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release version'
required: true
developmentVersion:
description: 'Next development version'
required: true
prerelease:
description: 'Is pre release'
required: false
default: 'true'

jobs:
build:
name: WebApp on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:

- name: Show input parameters
run: |
echo "Release version: ${{ github.event.inputs.releaseVersion }}"
echo "Development version: ${{ github.event.inputs.developmentVersion }}"
echo "Is prerelease: ${{ github.event.inputs.prerelease == 'true' }}"

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'

- name: compile
run: mvn -B -Pnative package

- name: Upload non-Windows binary
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: elephlink-${{ matrix.os }}
path: target/elephlink

- name: Upload Windows binary
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: elephlink-${{ matrix.os }}
path: target/elephlink.exe

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: elephlink-ubuntu-latest
path: build/linux

- name: Download macOS binary
uses: actions/download-artifact@v4
with:
name: elephlink-macos-latest
path: build/macos

- name: Download Windows binary
uses: actions/download-artifact@v4
with:
name: elephlink-windows-latest
path: build/windows

- name: Rename binaries for release
run: |
mv build/linux/elephlink output/elephlink-linux-${{ github.event.inputs.releaseVersion }}
mv build/macos/elephlink output/elephlink-macos-${{ github.event.inputs.releaseVersion }}
mv build/windows/elephlink.exe output/elephlink-windows-${{ github.event.inputs.releaseVersion }}.exe

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.event.inputs.releaseVersion }}
name: Release v${{ github.event.inputs.releaseVersion }}
generate_release_notes: true
files: |
output/elephlink-*
draft: false
prerelease: ${{ github.event.inputs.prerelease == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<puppycrawl.version>10.23.1</puppycrawl.version>
<assembly.plugin.version>3.7.1</assembly.plugin.version>
<release.plugin.version>3.0.1</release.plugin.version>
<native.maven.plugin.version>0.10.6</native.maven.plugin.version>

<slfj.version>2.0.17</slfj.version>
<logback.version>1.5.18</logback.version>
Expand Down Expand Up @@ -148,6 +149,38 @@
</plugins>
</build>

<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native.maven.plugin.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<distributionManagement>
<repository>
<id>github</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -14,10 +17,10 @@ public class YmlParser {

@SuppressWarnings("unchecked")
public Map<String, Object> parse(String fileName) {
try (FileInputStream fis = new FileInputStream(Path.of(fileName).toFile())) {
try (FileInputStream fis = new FileInputStream(Path.of(fileName).toFile()); Reader reader = new InputStreamReader(fis, StandardCharsets.UTF_8)) {
LoadSettings settings = LoadSettings.builder().build();
Load load = new Load(settings);
return (Map<String, Object>) load.loadFromInputStream(fis);
return (Map<String, Object>) load.loadFromReader(reader);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("File '" + fileName + "' not found.", e);
} catch (IOException e) {
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/META-INF/native-image/reflect-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"name": "com.roomelephant.elephlink.adapters.cloudflare.TokenVerifyResponse",
"allDeclaredConstructors": true,
"allDeclaredFields": true
}
]
Loading