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
56 changes: 51 additions & 5 deletions .github/workflows/dev-release-cli.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Build and Release Yaci CLI Zip
name: Dev Build and Upload Yaci CLI Zip

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

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

jobs:
buildAndPush:
Expand All @@ -22,7 +25,7 @@ jobs:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.2'
version: '21.0.5'
native-image-job-reports: 'true'
- name: Get Tag from version file
run: |
Expand Down Expand Up @@ -52,3 +55,46 @@ jobs:
with:
name: yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}
path: ./applications/cli/build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}.zip

windowsBuild:
strategy:
matrix:
os: ["windows-latest"]
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.5'
native-image-job-reports: 'true'
- name: Get Tag from (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$TAG = (Get-Content config/version | Where-Object { $_ -match "^tag=" } | ForEach-Object { $_.Split('=')[1].Trim() })
Add-Content -Path $env:GITHUB_ENV -Value "TAG=$TAG"
- name: Windows specific env
run: |
Add-Content -Path $env:GITHUB_ENV -Value "os_prefix=windows"
- name: Set lowercase architecture (Windows)
shell: pwsh
run: |
$arch = "${{ runner.arch }}".ToLower()
Add-Content -Path $env:GITHUB_ENV -Value "arch=$arch"
- 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 }}-${{ env.arch }}.zip
- uses: actions/upload-artifact@v4
with:
name: yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}
path: ./applications/cli/build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}.zip
2 changes: 1 addition & 1 deletion .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.2'
version: '21.0.5'
native-image-job-reports: 'true'
- name: Get Tag from version file
run: |
Expand Down
3 changes: 2 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ cli-docker:
ARG EARTHLY_TARGET_NAME
ARG EARTHLY_GIT_SHORT_HASH

BUILD ./applications/cli+docker-build --BUILD_TYPE=${build_type} --REGISTRY_ORG=${REGISTRY_ORG} --APP_VERSION=${tag} --COMMIT_ID=${EARTHLY_GIT_SHORT_HASH}
#BUILD ./applications/cli+docker-build --BUILD_TYPE=${build_type} --REGISTRY_ORG=${REGISTRY_ORG} --APP_VERSION=${tag} --COMMIT_ID=${EARTHLY_GIT_SHORT_HASH}
BUILD ./applications/cli+docker-build-native --BUILD_TYPE=${build_type} --REGISTRY_ORG=${REGISTRY_ORG} --APP_VERSION=${tag} --COMMIT_ID=${EARTHLY_GIT_SHORT_HASH}

viewer:
ARG EARTHLY_TARGET_NAME
Expand Down
75 changes: 75 additions & 0 deletions applications/cli/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,78 @@ docker-build:
ENTRYPOINT ["sh", "/app/yaci-cli.sh"]

SAVE IMAGE --push ${REGISTRY_ORG}/yaci-cli:${APP_VERSION}

docker-build-native:
FROM ubuntu:22.04

ARG TARGETOS
ARG TARGETARCH
ARG BUILD_TYPE
ARG APP_VERSION
ARG REGISTRY_ORG
ARG COMMIT_ID

COPY docker/install-packages.sh .
RUN chmod -R 755 install-packages.sh
RUN ./install-packages.sh

#RUN apk update && apk --no-cache add wget && apk --no-cache add zip && apk --no-cache add unzip
#RUN apk --no-cache add zstd
#RUN apk --no-cache add curl
#RUN apk --no-cache add socat

RUN mkdir "/app"

WORKDIR /app

COPY docker/download-$TARGETARCH.sh .
RUN sh download-$TARGETARCH.sh

#Ogmios download
COPY docker/download-ogmios.sh .
RUN sh download-ogmios.sh $TARGETARCH

#Kupo download
COPY docker/download-kupo.sh .
RUN sh download-kupo.sh $TARGETARCH

#Yaci Store download
COPY docker/download-yaci-store.sh .
RUN sh download-yaci-store.sh $TARGETARCH

#RUN apk --no-cache add curl

RUN echo "I'm building for $TARGETOS/$TARGETARCH"

RUN mkdir -p /app/store/config
COPY docker/store-application.properties /app/store/config/application.properties


RUN echo "Build type: $BUILD_TYPE"
IF [ "$BUILD_TYPE" = "native" ]
COPY (+cli-native/yaci-cli* --APP_VERSION=${APP_VERSION}) /app/
ELSE IF [ "$BUILD_TYPE" = "native-ci" ]
COPY (+cli-native-ci/yaci-cli* --APP_VERSION=${APP_VERSION}) /app/
END

COPY docker/yaci-cli.sh /app/
RUN chmod +x /app/yaci-cli.sh

RUN mkdir -p /app/config
COPY docker/application.properties /app/config/

ENV PATH="$PATH:/app/cardano-bin"
ENV CARDANO_NODE_SOCKET_PATH=/clusters/nodes/default/node/node.sock
ENV PROTOCOL_MAGIC=42

WORKDIR /app
EXPOSE 3001
EXPOSE 8090
EXPOSE 10000
EXPOSE 8080
EXPOSE 1337
EXPOSE 1442

ENTRYPOINT ["sh", "/app/yaci-cli.sh"]

SAVE IMAGE --push ${REGISTRY_ORG}/yaci-cli:${APP_VERSION}
2 changes: 1 addition & 1 deletion applications/cli/docker/download-arm64.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
file=cardano-10_1_2-aarch64-static-musl-ghc_966.tar.zst
dir=cardano-10_1_2-aarch64-static-musl-ghc_966
wget https://github.com/armada-alliance/cardano-node-binaries/raw/main/static-binaries/$file?raw=true -O - | tar -I zstd -xv
wget https://github.com/armada-alliance/cardano-node-binaries/raw/main/static-binaries/$file?raw=true -O - | zstd -dc | tar -xvf -

#unzip $file
mv $dir cardano-node
Expand Down
30 changes: 30 additions & 0 deletions applications/cli/docker/download-yaci-store.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Assign the architecture based on user input and determine the correct suffix
case $1 in
amd64)
SUFFIX="x86_64"
;;
arm64)
SUFFIX="aarch64"
;;
*)
echo "Error: Invalid architecture specified. Use 'amd64' or 'arm64'."
exit 1
;;
esac


version=0.1.1-graalvm-preview2
file=yaci-store-${version}-linux-musl-x64-n2c.zip
wget https://github.com/bloxbean/yaci-store/releases/download/rel-graal-${version}/$file

mkdir /app/store
unzip $file -d /app/store

cp /app/store/yaci-store-${version}-n2c/yaci-store /app/store/yaci-store
rm -rf /app/store/yaci-store-${version}-n2c

chmod +x /app/store/yaci-store

rm $file
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,14 @@ private void updateSubmitApiFiles(Path destPath, long protocolMagic, int submitA
values.put("SUBMIT_API_PORT", String.valueOf(submitApiPort));
values.put("PROTOCOL_MAGIC", String.valueOf(protocolMagic));

Path submitApiSh;
//Update submit api script
Path submitApiSh = destPath.resolve("submit-api.sh");
if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) {
submitApiSh = destPath.resolve("submit-api.bat");
} else {
submitApiSh = destPath.resolve("submit-api.sh");
}

try {
templateEngine.replaceValues(submitApiSh, values);
} catch (Exception e) {
Expand Down Expand Up @@ -441,7 +447,12 @@ public void saveClusterInfo(Path clusterFolder, ClusterInfo clusterInfo) throws
throw new IllegalStateException("Cluster folder not found - " + clusterFolder);
}

String socketPath = clusterFolder.resolve(NODE_FOLDER_PREFIX).resolve("node.sock").toString();
String socketPath;
if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) {
socketPath = "\\\\.\\pipe\\node.sock";
} else {
socketPath = clusterFolder.resolve(NODE_FOLDER_PREFIX).resolve("node.sock").toString();
}
clusterInfo.setSocketPath(socketPath);

String clusterInfoPath = clusterFolder.resolve(ClusterConfig.CLUSTER_INFO_FILE).toAbsolutePath().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private Process startNode(Path clusterFolder, ClusterInfo clusterInfo, Consumer<

ProcessBuilder builder = new ProcessBuilder();
if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) {
builder.command("cmd.exe", startScript + ".bat");
builder.command("cmd", "/c", startScript + ".bat");
} else {
builder.command("sh", startScript + ".sh");
}
Expand Down Expand Up @@ -220,6 +220,9 @@ private Process startSubmitApi(ClusterInfo clusterInfo, Path clusterFolder, Cons

//Check if cardano-submit-api exists
String cardanoSubmitCli = "cardano-submit-api";
if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS)
cardanoSubmitCli = "cardano-submit-api.exe";

Path binFolder = Path.of(clusterConfig.getCLIBinFolder());
Path cardanoSubmitCliPath = binFolder.resolve(cardanoSubmitCli);
if (!Files.exists(cardanoSubmitCliPath)) {
Expand All @@ -229,7 +232,11 @@ private Process startSubmitApi(ClusterInfo clusterInfo, Path clusterFolder, Cons
}

ProcessBuilder builder = new ProcessBuilder();
builder.command("sh", "submit-api.sh");
if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) {
builder.command("cmd", "/c", "submit-api.bat");
} else {
builder.command("sh", "submit-api.sh");
}

File submitApiStartDir = new File(clusterFolderPath);
builder.directory(submitApiStartDir);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Args = -H:+StaticExecutableWithDynamicLibC --initialize-at-run-time=io.netty.channel.epoll.Epoll \
Args = -H:+StaticExecutableWithDynamicLibC -march=compatibility --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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Args = --static --libc=musl --initialize-at-run-time=io.netty.channel.epoll.Epoll \
Args = --static --libc=musl -march=compatibility --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
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off
setlocal enabledelayedexpansion

"${BIN_FOLDER}\cardano-node.exe" run ^
--config configuration.yaml ^
--topology topology.json ^
--database-path "db" ^
--socket-path "\\.\pipe\node.sock" ^
--shelley-kes-key .\pool-keys\kes.skey ^
--shelley-vrf-key .\pool-keys\vrf.skey ^
--byron-delegation-certificate .\pool-keys\byron-delegation.cert ^
--byron-signing-key .\pool-keys\byron-delegate.key ^
--shelley-operational-certificate .\pool-keys\opcert.cert ^
--port ${port} >> node.log 2>&1

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
setlocal enabledelayedexpansion

"${BIN_FOLDER}\cardano-submit-api.exe" --config submit-api-config.yaml ^
--testnet-magic ${PROTOCOL_MAGIC} ^
--socket-path node\node.sock ^
--port ${SUBMIT_API_PORT} ^
--listen-address 0.0.0.0 ^
--metrics-port 0
2 changes: 1 addition & 1 deletion config/version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
tag=0.10.0-preview2
tag=0.10.0-preview2-alpine
revision=
Loading