From 3d7e7166f24810806c68f76046490a07dbe73e3b Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 25 Sep 2025 17:54:52 +0100 Subject: [PATCH] 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. --- .github/workflows/build-linux.yml | 2 +- .github/workflows/build-macos-arm64.yml | 2 +- .github/workflows/build-macos-intel.yml | 2 +- Makefile | 53 ++++++++++++++----------- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index cbf8df4f..358c8819 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -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 diff --git a/.github/workflows/build-macos-arm64.yml b/.github/workflows/build-macos-arm64.yml index a5f3cde0..15d75b10 100644 --- a/.github/workflows/build-macos-arm64.yml +++ b/.github/workflows/build-macos-arm64.yml @@ -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 diff --git a/.github/workflows/build-macos-intel.yml b/.github/workflows/build-macos-intel.yml index c81ee9a6..6151daab 100644 --- a/.github/workflows/build-macos-intel.yml +++ b/.github/workflows/build-macos-intel.yml @@ -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 diff --git a/Makefile b/Makefile index 589a5afb..d8651f48 100644 --- a/Makefile +++ b/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