1
0
Fork 0
forked from lthn/blockchain

Update build process and genesis data for static builds

Refactors Makefile and Dockerfile to support static builds via a STATIC variable, simplifying static build targets. Updates genesis transaction data and public key in generated files. Improves GitHub Actions artifact upload by refining tag and prerelease logic.
This commit is contained in:
Snider 2025-10-01 13:57:08 +01:00
parent 763d70bec2
commit cf14549cee
6 changed files with 35 additions and 38 deletions

View file

@ -6,7 +6,7 @@ inputs:
required: true
description: 'The chain network name to use in filenames, mainnet or testnet'
assets:
description: "A \\n separated string list of filenames to archive; if asset is a abs path, it's respected"
description: "A EOL separated string list of filenames to archive; if asset is a abs path, it's respected"
required: false
asset-type:
required: true
@ -37,6 +37,20 @@ runs:
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
if [ "${{ github.event_name }}" == "pull_request" ]; then
TAG_SUFFIX="-${{ github.event.number }}"
PRERELEASE=true
elif [ "${{ inputs.chain-network }}" != "mainnet" ]; then
TAG_SUFFIX="-beta"
PRERELEASE=true
else
TAG_SUFFIX=""
PRERELEASE=false
fi
TAG_NAME="${VERSION}${TAG_SUFFIX}+${{ github.run_number }}"
echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT"
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
# Format the output to be a multi-line string.
# This is the correct way to pass a multi-line string in GITHUB_OUTPUT.
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@ -70,7 +84,7 @@ runs:
- name: Make Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.asset.outputs.version }}${{ inputs.chain-network == 'mainnet' && '' || '-pre' }}+${{ github.run_number }}
prerelease: ${{ contains(inputs.chain-network, 'testnet') }}
tag_name: ${{ steps.asset.outputs.tag_name }}
prerelease: ${{ steps.asset.outputs.prerelease }}
files: ${{ inputs.asset-directory }}/lethean-*
target_commitish: ${{ github.sha }}
target_commitish: ${{ github.sha }}

View file

@ -12,6 +12,7 @@
# Default to “unknown” will be overwritten below.
CPU_CORES := 1
TESTNET:= 0
STATIC:= 0
BUILD_TYPE ?=Release
BUILD_VERSION:=6.0.1
@ -69,7 +70,7 @@ endif
# -----------------------------------------------------------------
CPU_CORES := $(or $(CPU_CORES),1)
CPU_CORES := $(shell expr $(CPU_CORES) + 0 2>/dev/null || echo 1)
CONAN_CPU_COUNT=$(CPU_CORES)
#CONAN_CPU_COUNT=$(CPU_CORES)
PROFILES := $(patsubst cmake/profiles/%,%,$(wildcard cmake/profiles/*))
@ -83,7 +84,7 @@ all: help
release: conan-profile-detect
@echo "Building profile: release $(TESTNET)"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=$(BUILD_TYPE)
cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
cmake --build build/release --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
(cd build/release && cpack)
@ -93,13 +94,6 @@ debug: conan-profile-detect
cmake -S . -B build/debug -DCMAKE_TOOLCHAIN_FILE=build/debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -DTESTNET=$(TESTNET)
cmake --build build/debug --config=Debug --parallel=$(CPU_CORES)
static: static-release
static-release: conan-profile-detect
@echo "Building profile: release-static"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release-static --build=missing -s build_type=$(BUILD_TYPE)
cmake -S . -B build/release-static -DCMAKE_TOOLCHAIN_FILE=build/release-static/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D STATIC=ON -DTESTNET=$(TESTNET)
cmake --build build/release-static --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
conan-profile-detect:
@if [ ! -f "$(DEFAULT_CONAN_PROFILE)" ]; then \
echo "Default conan profile not found. Detecting a new one..."; \

View file

@ -1,3 +1,3 @@
const genesis_tx_raw_data ggenesis_tx_raw = {{
0xe980800100000101,0xfbfa3a0316deb183,0x0e4d0bf7103b2df2,0x682df55627fc33ed,0xcd945b3d70689611,0x16050066b218269a,0x34af8b24a9c955d2,0x3f514b3a2be34ee9,0xb6525b442410e776,0x256d4d83666fb42a,0x6b61742074496b13,0x6e61766461207365,0x20666f2065676174,0x7574616e20656874,0x6e6920666f206572,0x6f6974616d726f66,0x20676e696562206e,0x206f742079736165,0x6220646165727073,0x2064726168207475,0x6c66697473206f74,0x746153202d202e65,0x6b614e206968736f,0x0b00156f746f6d61},
{0x02,0x8a,0x56,0x0e,0x0a,0x00,0x00}};
0xa080800100000101,0x03018ae3c8e0c8cf,0x7b0287d2a2218485,0x720c5b385edbe3dd,0x178e7c64d18a598f,0x98bb613ff63e6d03,0x3814f971f9160500,0x1c595f65f55d872e,0x835e5fd926b1f78d,0xf597c7f5a33b6131,0x2074496b139c8341,0x64612073656b6174,0x20656761746e6176,0x6e2065687420666f,0x666f206572757461,0x616d726f666e6920,0x696562206e6f6974,0x207973616520676e,0x6165727073206f74,0x6168207475622064,0x7473206f74206472,0x202d202e656c6669,0x206968736f746153,0x6f746f6d616b614e,0x0a0e0d66020b0015},
{0x00,0x00}};

View file

@ -1,5 +1,5 @@
struct genesis_tx_raw_data
{
uint64_t const v[42];
uint8_t const r[42];
uint64_t const v[25];
uint8_t const r[2];
};

View file

@ -1,6 +1,6 @@
const std::string ggenesis_tx_pub_key_str = "d255c9a9248baf34e94ee32b3a4b513f76e71024445b52b62ab46f66834d6d25";
const std::string ggenesis_tx_pub_key_str = "f971f914382e875df5655f591c8df7b126d95f5e8331613ba3f5c797f541839c";
const crypto::public_key ggenesis_tx_pub_key = epee::string_tools::parse_tpod_from_hex_string<crypto::public_key>(ggenesis_tx_pub_key_str);
extern const genesis_tx_dictionary_entry ggenesis_dict[1];
const genesis_tx_dictionary_entry ggenesis_dict[1] = {
{1056117391700764468ULL,0}
{16303433277431939751ULL,0}
};

View file

@ -2,9 +2,10 @@
FROM ubuntu:24.04 AS builder
LABEL authors="snider"
ARG THREADS=1
ARG BUILD_THREADS=1
ARG BUILD_BRANCH=dev
ARG BUILD_LOCAL=1
ARG BUILD_STATIC=0
ARG BUILD_REPO=https://github.com/letheanVPN/blockchain.git
ARG BUILD_TARGET=gcc-linux-x86_64
ARG BUILD_FOLDER=build/release
@ -39,26 +40,12 @@ RUN if [ "$BUILD_LOCAL" = "1" ]; then \
git clone --recursive --branch ${BUILD_BRANCH} ${BUILD_REPO} code; \
fi
VOLUME /code/build/sdk
WORKDIR /code
RUN conan profile detect --name=default --force
#RUN conan install . --output-folder=${BUILD_FOLDER} --build=missing -s build_type=${BUILD_TYPE} -pr:h=/code/cmake/profiles/$BUILD_TARGET
RUN set -eux; \
BCMD="conan install . \
--output-folder=${BUILD_FOLDER} \
--build=missing \
-s build_type=${BUILD_TYPE}"; \
if [ "${USE_CUSTOM_PROFILE}" = "1" ]; then \
BCMD="$BCMD -pr:h=/code/cmake/profiles/${BUILD_TARGET}"; \
fi; \
echo "Running: $BCMD"; \
eval $BCMD;
RUN cmake -S /code -B ${BUILD_FOLDER} -DCMAKE_TOOLCHAIN_FILE=${BUILD_FOLDER}/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DTESTNET=${BUILD_TESTNET}
RUN cmake --build ${BUILD_FOLDER} --config=${BUILD_TYPE} --parallel=${THREADS}
RUN make release CPU_CORES=${BUILD_THREADS} TESTNET=${BUILD_TESTNET} STATIC=${BUILD_STATIC}
#RUN cmake --build ${BUILD_FOLDER} --config=${BUILD_TYPE} --parallel=${THREADS}
# minor cmd-fu; TESTNEt and MAINNET, in docker context, use MAIINNET binaries names.
# do i like removing `-testnet`, no, but i dislike working around multiple names for ever more, so...
@ -83,3 +70,5 @@ FROM ubuntu:24.04 AS chain-service
COPY --from=build-artifacts --chmod=+x / /bin
RUN lethean-chain-node --help
ENTRYPOINT ["lethean-chain-node"]