forked from lthn/blockchain
Add TESTNET flag to build workflows and Makefile
Introduces a TESTNET variable to the Makefile and passes it from GitHub Actions workflows based on the chain-network input. Updates CMake build commands to include the TESTNET flag, improves help output formatting, and comments out unused genesis targets for clarity.
This commit is contained in:
parent
b02addf264
commit
3d7e7166f2
4 changed files with 32 additions and 27 deletions
2
.github/workflows/build-linux.yml
vendored
2
.github/workflows/build-linux.yml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
|||
cache_packages: true
|
||||
|
||||
- name: Compile Release
|
||||
run: make gcc-linux-amd64-release
|
||||
run: make gcc-linux-amd64-release TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
|
|||
2
.github/workflows/build-macos-arm64.yml
vendored
2
.github/workflows/build-macos-arm64.yml
vendored
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
cache_packages: true
|
||||
|
||||
- name: Compile Release
|
||||
run: make apple-clang-arm64-release
|
||||
run: make apple-clang-arm64-release TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
|
|||
2
.github/workflows/build-macos-intel.yml
vendored
2
.github/workflows/build-macos-intel.yml
vendored
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
cache_packages: true
|
||||
|
||||
- name: Compile Release
|
||||
run: make apple-clang-arm64-release
|
||||
run: make apple-clang-arm64-release TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
|
|||
53
Makefile
53
Makefile
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
# Default to “unknown” – will be overwritten below.
|
||||
CPU_CORES := 1
|
||||
TESTNET ?= 0
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Unix‑like systems (Linux, macOS, *BSD, etc.)
|
||||
|
|
@ -47,19 +48,19 @@ ifeq ($(OS),Windows_NT)
|
|||
endif
|
||||
endif
|
||||
|
||||
testnet-genesis-new:
|
||||
$(eval command += $(cmake_release) $(testnet))
|
||||
$(call CMAKE,$(dir_release),$(command) -DGENERATE_PREMINE_WALLET=1 -DPREMINE_WALLET_PASSWORD=12345678) && cmake --build ./src --target premine_wallet || true
|
||||
$(eval command += $(cmake_release) $(testnet))
|
||||
$(call CMAKE,$(dir_release),$(command) -DGENERATE_FRESH_GENESIS=1) && cmake --build ./src --target genesis_generator
|
||||
$(eval command += $(cmake_release) $(testnet))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
genesis-new:
|
||||
$(eval command += $(cmake_release))
|
||||
$(call CMAKE,$(dir_release),$(command) -DGENERATE_FRESH_GENESIS=1) && cmake --build ./src --target genesis_generator
|
||||
$(eval command += $(cmake_release))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
#testnet-genesis-new:
|
||||
# $(eval command += $(cmake_release) $(testnet))
|
||||
# $(call CMAKE,$(dir_release),$(command) -DGENERATE_PREMINE_WALLET=1 -DPREMINE_WALLET_PASSWORD=12345678) && cmake --build ./src --target premine_wallet || true
|
||||
# $(eval command += $(cmake_release) $(testnet))
|
||||
# $(call CMAKE,$(dir_release),$(command) -DGENERATE_FRESH_GENESIS=1) && cmake --build ./src --target genesis_generator
|
||||
# $(eval command += $(cmake_release) $(testnet))
|
||||
# $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
#
|
||||
#genesis-new:
|
||||
# $(eval command += $(cmake_release))
|
||||
# $(call CMAKE,$(dir_release),$(command) -DGENERATE_FRESH_GENESIS=1) && cmake --build ./src --target genesis_generator
|
||||
# $(eval command += $(cmake_release))
|
||||
# $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Safety net – ensure we always have a positive integer.
|
||||
|
|
@ -79,20 +80,20 @@ all: help
|
|||
release: conan-profile-detect
|
||||
@echo "Building profile: release"
|
||||
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=Release
|
||||
cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
||||
cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DTESTNET=$(TESTNET)
|
||||
cmake --build build/release --config=Release --parallel=$(CPU_CORES)
|
||||
|
||||
debug: conan-profile-detect
|
||||
@echo "Building profile: debug"
|
||||
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/debug --build=missing -s build_type=Debug
|
||||
cmake -S . -B build/debug -DCMAKE_TOOLCHAIN_FILE=build/debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug
|
||||
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
|
||||
cmake -S . -B build/release-static -DCMAKE_TOOLCHAIN_FILE=build/release-static/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -D STATIC=ON
|
||||
cmake -S . -B build/release-static -DCMAKE_TOOLCHAIN_FILE=build/release-static/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -D STATIC=ON -DTESTNET=$(TESTNET)
|
||||
cmake --build build/release-static --config=Release --parallel=$(CPU_CORES)
|
||||
|
||||
conan-profile-detect:
|
||||
|
|
@ -106,18 +107,22 @@ conan-profile-detect:
|
|||
$(PROFILES): conan-profile-detect
|
||||
@echo "Building profile: $@"
|
||||
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/$@ --profile=cmake/profiles/$@ --build=missing
|
||||
cmake -S . -B build/$@ -DCMAKE_TOOLCHAIN_FILE=build/$@/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
||||
cmake -S . -B build/$@ -DCMAKE_TOOLCHAIN_FILE=build/$@/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DTESTNET=$(TESTNET)
|
||||
cmake --build build/$@ --config=Release --parallel=$(CPU_CORES)
|
||||
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@printf " %-22s %s\n" "all:" "Build all profiles"
|
||||
@printf " %-22s %s\n" "clean:" "Clean all build directories"
|
||||
@printf " %-22s %s\n" "release:" "Build release"
|
||||
@printf " %-22s %s\n" "static:" "Build static release"
|
||||
@printf " %-22s %s\n" "debug:" "Build debug"
|
||||
@$(foreach profile,$(SORTED_PROFILES),printf " %-22s %s\n" "make $(profile):" "Build the $(profile) profile";)
|
||||
@printf " %-22s %s\n" "help:" "Show this help message"
|
||||
@printf " %-42s %s\n" "make clean" "Clean all build directories"
|
||||
@printf " %-42s %s\n" "make release" "Build release"
|
||||
@printf " %-42s %s\n" "make static" "Build static release"
|
||||
@printf " %-42s %s\n" "make debug" "Build debug"
|
||||
@printf " %-42s %s\n" "make test" "Build & run tests"
|
||||
@printf " %-42s %s\n" "make docs" "Builds offline documentation website"
|
||||
@printf " %-42s %s\n" "make docs-dev" "Runs local doc server, for editing/adding docs"
|
||||
@printf " %-42s %s\n" "make conan-profile-detect" "Creates host config"
|
||||
@printf " %-42s %s\n" "make configure" "Runs a cmake configure within conan build flow"
|
||||
@$(foreach profile,$(SORTED_PROFILES),printf " %-42s %s\n" "make $(profile)" "Build the $(profile) profile";)
|
||||
@printf " %-42s %s\n" "make help" "Show this help message"
|
||||
|
||||
#
|
||||
# Tests
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue