Skip to content

Commit

Permalink
CI Fix: Native image link issue for Linux binary (#60)
Browse files Browse the repository at this point in the history
* chore: Fix native image issue

* Revert "chore: Fix native image issue"

This reverts commit 107ecb1.

* chore: To fix netty linking issue

* Revert "chore: To fix netty linking issue"

This reverts commit 45cfefe.

* chore: To fix graalvm issue

* chore: Get correct jre path for non docker

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Mostly static image test

* chore: Bump version. Clean release action file
  • Loading branch information
satran004 authored Aug 13, 2024
1 parent 8e4dbfb commit 41c0259
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 10 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/dev-release-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and Release Yaci CLI Zip

on:
push:
tags:
- 'rel-dev-*'

jobs:
buildAndPush:
strategy:
matrix:
os: ["ubuntu-20.04", "macos-14"]
runs-on: ${{ matrix.os }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.2'
native-image-job-reports: 'true'
- name: Get Tag from version file
run: |
TAG=$(grep "tag=" config/version | cut -d'=' -f2)
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: Grant execute permission for gradlew
working-directory: applications/cli
run: chmod +x gradlew
- name: Copy CI specific native-image properties
working-directory: applications/cli
if: runner.os == 'Linux'
run: |
echo "os_prefix=linux" >> $GITHUB_ENV
- name: MacOS specific env
if: runner.os == 'macOS'
run: |
echo "os_prefix=macos" >> $GITHUB_ENV
- name: Build with Gradle
working-directory: applications/cli
run: ./gradlew --no-daemon -i -Pversion=${{ env.TAG }} clean build nativeCompile cliZip
- name: Copy artifacts
working-directory: applications/cli
run: mv build/yaci-cli-${{ env.TAG }}.zip build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ runner.arch }}.zip
- uses: actions/upload-artifact@v4
with:
name: yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ runner.arch }}
path: ./applications/cli/build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ runner.arch }}.zip
9 changes: 4 additions & 5 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
buildAndPush:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
os: ["ubuntu-20.04", "macos-14"]
runs-on: ${{ matrix.os }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -20,9 +20,9 @@ jobs:
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
native-image-musl: 'true'
distribution: 'liberica'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.2'
native-image-job-reports: 'true'
- name: Get Tag from version file
run: |
Expand All @@ -35,8 +35,7 @@ jobs:
working-directory: applications/cli
if: runner.os == 'Linux'
run: |
cp src/main/resources/META-INF/native-image/yaci-cli/native-image.properties.ci src/main/resources/META-INF/native-image/yaci-cli/native-image.properties
echo "os_prefix=ubuntu" >> $GITHUB_ENV
echo "os_prefix=linux" >> $GITHUB_ENV
- name: MacOS specific env
if: runner.os == 'macOS'
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bloxbean.cardano.yacicli.commands.common;

import com.bloxbean.cardano.yacicli.localcluster.ClusterConfig;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
Expand All @@ -15,11 +16,19 @@ public class JreResolver {
private static String JRE_MAC_OS_BIN = "jdk-21+35-jre/Contents/Home/bin";
private static String JRE_LINUX_BIN = "jdk-21+35-jre/bin";

@Value("${store.custom.jre.folder:#{null}}")
private String jreFolder;
private final ClusterConfig clusterConfig;

@Value("${is.docker:false}")
private boolean isDocker;

public String getJavaCommand() {
if (jreFolder == null)
if (isDocker) {
return JAVA;
}

String jreFolder = clusterConfig.getJreHome();

if (jreFolder == null || jreFolder.isEmpty())
return JAVA;
else {
String javaCommand = Paths.get(jreFolder, getJreRelativeBinPath(), JAVA).toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ private Process startStoreApp(ClusterInfo clusterInfo, Era era) throws IOExcepti
builder.command(javaExecPath, "-Dstore.cardano.n2c-era=" + era.name(), "-Dstore.cardano.protocol-magic=" + clusterInfo.getProtocolMagic(), "-jar", clusterConfig.getYaciStoreBinPath() + File.separator + "yaci-store.jar");
}

writeLn(info("Java Path: " + javaExecPath));

Process process = builder.start();

writeLn(success("Yaci store starting ..."));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Args = --initialize-at-run-time=io.netty.channel.epoll.Epoll \
Args = -H:+StaticExecutableWithDynamicLibC --initialize-at-run-time=io.netty.channel.epoll.Epoll \
--initialize-at-run-time=io.netty.channel.epoll.Native \
--initialize-at-run-time=io.netty.channel.epoll.EpollEventLoop \
--initialize-at-run-time=io.netty.channel.epoll.EpollEventArray \
Expand Down
2 changes: 1 addition & 1 deletion config/version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
tag=0.9.0-beta
tag=0.9.1-beta
revision=

0 comments on commit 41c0259

Please sign in to comment.