From 893b3ed1ff99058978c319954ff7acb8f631611b Mon Sep 17 00:00:00 2001 From: snider Date: Mon, 6 Oct 2025 15:39:42 +0100 Subject: [PATCH] Remove Conan installation steps from CI configurations and update asset paths --- .github/workflows/build-docs.yml | 21 ++++-------- .github/workflows/build-linux-arm64.yml | 9 +---- .github/workflows/build-linux-intel.yml | 8 +---- .github/workflows/build-macos-arm64.yml | 8 +---- .github/workflows/build-macos-intel.yml | 9 +---- .github/workflows/build-windows-intel.yml | 8 +---- Makefile | 41 ++++++++++------------- cmake/CPackConfig.cmake | 2 +- cmake/conan_provider.cmake | 14 +++++++- utils/docker/images/lthn-chain/Dockerfile | 2 +- 10 files changed, 43 insertions(+), 79 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 336e75c3..ad99155f 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -17,12 +17,6 @@ jobs: with: python-version: 3.x - - name: Install Conan - uses: conan-io/setup-conan@v1 - with: - home: ${{ github.workspace }}/build/sdk - cache_packages: true - - uses: actions/cache@v4 with: key: ${{ github.ref }} @@ -34,13 +28,10 @@ jobs: - name: Build Offline Version run: make docs - - name: Zip Build - run: | - cd build/docs - zip -qq -r ../documentation.zip * - - - name: Upload Artifacts - uses: actions/upload-artifact@v4.6.2 + - name: CLI Artifacts + uses: ./.github/actions/upload-artifacts with: - name: Documentation - path: build/documentation.zip + chain-network: ${{ inputs.chain-network }} + assets: * + asset-type: 'docs' + asset-directory: ${{ github.workspace }}/build/docs diff --git a/.github/workflows/build-linux-arm64.yml b/.github/workflows/build-linux-arm64.yml index 73fa8155..e38c6fbe 100644 --- a/.github/workflows/build-linux-arm64.yml +++ b/.github/workflows/build-linux-arm64.yml @@ -36,13 +36,6 @@ jobs: - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" - - - name: Install Conan - uses: conan-io/setup-conan@v1 - with: - home: ${{ github.workspace }}/build/sdk - cache_packages: false - - name: Compile Release run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} @@ -52,4 +45,4 @@ jobs: chain-network: ${{ inputs.chain-network }} assets: lethean-* asset-type: 'cli' - asset-directory: ${{ github.workspace }}/build/release/packages + asset-directory: ${{ github.workspace }}/build/packages diff --git a/.github/workflows/build-linux-intel.yml b/.github/workflows/build-linux-intel.yml index bb30c892..465e6c5e 100644 --- a/.github/workflows/build-linux-intel.yml +++ b/.github/workflows/build-linux-intel.yml @@ -35,12 +35,6 @@ jobs: python-version: 3.x - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" - - name: Install Conan - uses: conan-io/setup-conan@v1 - with: - home: ${{ github.workspace }}/build/sdk - cache_packages: false - - name: Compile Release run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} @@ -50,4 +44,4 @@ jobs: chain-network: ${{ inputs.chain-network }} assets: lethean-* asset-type: 'cli' - asset-directory: ${{ github.workspace }}/build/release/packages + asset-directory: ${{ github.workspace }}/build/packages diff --git a/.github/workflows/build-macos-arm64.yml b/.github/workflows/build-macos-arm64.yml index 24c3249d..f5de4d66 100644 --- a/.github/workflows/build-macos-arm64.yml +++ b/.github/workflows/build-macos-arm64.yml @@ -35,12 +35,6 @@ jobs: - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" - - name: Install Conan - uses: conan-io/setup-conan@v1 - with: - home: ${{ github.workspace }}/build/sdk - cache_packages: false - # - name: Compile Release # run: make apple-clang-armv8 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} @@ -54,4 +48,4 @@ jobs: chain-network: ${{ inputs.chain-network }} assets: lethean-* asset-type: 'cli' - asset-directory: ${{ github.workspace }}/build/release/packages + asset-directory: ${{ github.workspace }}/build/packages diff --git a/.github/workflows/build-macos-intel.yml b/.github/workflows/build-macos-intel.yml index 15b50386..be0b02ff 100644 --- a/.github/workflows/build-macos-intel.yml +++ b/.github/workflows/build-macos-intel.yml @@ -21,7 +21,6 @@ jobs: fetch-depth: 0 submodules: recursive - - name: Cache SDK Folder uses: actions/cache@v4 with: @@ -33,12 +32,6 @@ jobs: python-version: 3.x - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" - - name: Install Conan - uses: conan-io/setup-conan@v1 - with: - home: ${{ github.workspace }}/build/sdk - cache_packages: false - - name: Compile Release run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} @@ -48,4 +41,4 @@ jobs: chain-network: ${{ inputs.chain-network }} assets: lethean-* asset-type: 'cli' - asset-directory: ${{ github.workspace }}/build/release/packages + asset-directory: ${{ github.workspace }}/build/packages diff --git a/.github/workflows/build-windows-intel.yml b/.github/workflows/build-windows-intel.yml index 1d59e014..369b746f 100644 --- a/.github/workflows/build-windows-intel.yml +++ b/.github/workflows/build-windows-intel.yml @@ -32,12 +32,6 @@ jobs: python-version: 3.x - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" - - name: Install Conan - uses: conan-io/setup-conan@v1 - with: - home: ${{ github.workspace }}/build/sdk - cache_packages: false - - name: Compile Release run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} @@ -47,4 +41,4 @@ jobs: chain-network: ${{ inputs.chain-network }} assets: lethean-* asset-type: 'cli' - asset-directory: ${{ github.workspace }}/build/release/packages + asset-directory: ${{ github.workspace }}/build/packages diff --git a/Makefile b/Makefile index e0b51891..7c87c19e 100644 --- a/Makefile +++ b/Makefile @@ -52,32 +52,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) - # ----------------------------------------------------------------- # Safety net – ensure we always have a positive integer. # ----------------------------------------------------------------- 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/*)) SORTED_PROFILES := $(sort $(PROFILES)) CONAN_CACHE := $(CURDIR)/build/sdk DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/profiles/default +CONAN_EXECUTABLE := $(CURDIR)/build/bin/conan CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile # Detect if we are on Windows ifeq ($(OS), Windows_NT) @@ -91,37 +78,40 @@ all: help release: docs build (cd $(BUILD_FOLDER) && cpack) + @rm -rf $(CURDIR)/build/packages/_CPack_Packages build: configure cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) debug: conan-profile-detect @echo "Building profile: debug" - $(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/debug --build=missing -s build_type=Debug + $(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) 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 -DTESTNET=$(TESTNET) cmake --build build/debug --config=Debug --parallel=$(CPU_CORES) build-deps: conan-profile-detect @echo "Build Dependencies: $(BUILD_TYPE) testnet=$(TESTNET)" - $(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) conan install . --build=missing -s build_type=$(BUILD_TYPE) + $(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --build=missing -s build_type=$(BUILD_TYPE) configure: build-deps @echo "Running Configure: $(BUILD_TYPE) testnet=$(TESTNET)" cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) +get-conan: + cmake -P cmake/GetConan.cmake -conan-profile-detect: +conan-profile-detect: get-conan @if [ ! -f "$(DEFAULT_CONAN_PROFILE)" ]; then \ echo "Default conan profile not found. Detecting a new one..."; \ - CONAN_HOME=$(CONAN_CACHE) conan profile detect --name=default --force; \ + CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) profile detect --name=default --force; \ fi # Rule for each profile $(PROFILES): conan-profile-detect @echo "Building profile: $@" - CFLAGS="" CXXFLAGS="" CONAN_HOME=$(CONAN_CACHE) conan install . -pr:h=cmake/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE) + CFLAGS="" CXXFLAGS="" CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . -pr:h=cmake/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE) cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) (cd $(BUILD_FOLDER) && cpack) @@ -129,6 +119,7 @@ $(PROFILES): conan-profile-detect help: @echo "Available targets:" @printf " %-42s %s\n" "make clean" "Clean all build directories" + @printf " %-42s %s\n" "make get-conan" "Download and install conan locally" @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" @@ -147,14 +138,14 @@ help: test: test-release test-release: @echo "Building profile: test-release" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/test-release --build=missing -s build_type=$(BUILD_TYPE) + CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-release --build=missing -s build_type=$(BUILD_TYPE) cmake -S . -B build/test-release -DCMAKE_TOOLCHAIN_FILE=build/test-release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON cmake --build build/test-release --config=Release --parallel=$(CPU_CORES) $(MAKE) test test-debug: @echo "Building profile: test-debug" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/test-debug --build=missing -s build_type=$(BUILD_TYPE) + CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-debug --build=missing -s build_type=$(BUILD_TYPE) cmake -S . -B build/test-debug -DCMAKE_TOOLCHAIN_FILE=build/test-debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -D BUILD_TESTS=ON cmake --build build/test-debug --config=Debug --parallel=$(CPU_CORES) $(MAKE) test @@ -168,11 +159,13 @@ docs-dev: configure @echo "Building Documentation" cmake --build build/release --target=serve_docs --config=Release - clean: + @cmake -P cmake/CleanBuild.cmake + +clean-build: rm -rf build tags: ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest -.PHONY: all release docker-chain-node debug docs docs-dev configure static static-release test test-release test-debug clean tags conan-profile-detect $(PROFILES) +.PHONY: all release docker-chain-node debug docs docs-dev configure static static-release test test-release test-debug clean tags conan-profile-detect get-conan $(PROFILES) diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake index 47f03de9..c120a637 100644 --- a/cmake/CPackConfig.cmake +++ b/cmake/CPackConfig.cmake @@ -56,7 +56,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt") # set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") - set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/packages") + set(CPACK_PACKAGE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/packages") install(FILES README.md LICENSE.txt DESTINATION "share/doc/${PROJECT_NAME}" diff --git a/cmake/conan_provider.cmake b/cmake/conan_provider.cmake index d39187c6..cffc6751 100644 --- a/cmake/conan_provider.cmake +++ b/cmake/conan_provider.cmake @@ -565,7 +565,19 @@ macro(conan_provide_dependency method package_name) set_property(GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED TRUE) get_property(_conan_install_success GLOBAL PROPERTY CONAN_INSTALL_SUCCESS) if(NOT _conan_install_success) - find_program(CONAN_COMMAND "conan" REQUIRED) + set(CONAN_COMMAND "${CMAKE_SOURCE_DIR}/build/bin/conan/bin/conan") + if(NOT EXISTS ${CONAN_COMMAND}) + message(STATUS "CMake-Conan: Local conan not found, attempting to download it.") + execute_process(COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_DIR}/GetConan.cmake + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + if(NOT result EQUAL 0) + message(FATAL_ERROR "Failed to download conan.") + endif() + endif() + if(NOT EXISTS ${CONAN_COMMAND}) + message(FATAL_ERROR "Conan executable not found at ${CONAN_COMMAND} after trying to download it. Also, make sure it has execution permissions.") + endif() conan_get_version(${CONAN_COMMAND} CONAN_CURRENT_VERSION) conan_version_check(MINIMUM ${CONAN_MINIMUM_VERSION} CURRENT ${CONAN_CURRENT_VERSION}) message(STATUS "CMake-Conan: first find_package() found. Installing dependencies with Conan") diff --git a/utils/docker/images/lthn-chain/Dockerfile b/utils/docker/images/lthn-chain/Dockerfile index aecf275a..6b7d08a4 100644 --- a/utils/docker/images/lthn-chain/Dockerfile +++ b/utils/docker/images/lthn-chain/Dockerfile @@ -19,7 +19,7 @@ RUN apt install -y build-essential pkgconf \ g++ llvm clang lld cmake python-is-python3 \ git python3 python3-pip python3-dev xz-utils gperf -RUN pip3 install conan mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging] --break-system-packages +RUN pip3 install mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging] --break-system-packages WORKDIR /