From 87605db373ecf92428574dad01a76151a98c1a8e Mon Sep 17 00:00:00 2001 From: Snider Date: Wed, 1 Oct 2025 21:55:16 +0100 Subject: [PATCH] Update Docker build workflow and CPack config Refactored the Docker build workflow to use a single job with multi-platform support and removed the manifest creation step. Cleaned up the macOS build workflow by removing unnecessary Homebrew installs. Updated CPackConfig.cmake to set the install prefix by default and fixed the documentation install destination to use PROJECT_NAME. --- .github/workflows/build-docker.yml | 85 +++++-------------------- .github/workflows/build-macos-arm64.yml | 1 - cmake/CPackConfig.cmake | 10 +-- 3 files changed, 20 insertions(+), 76 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 379c9b8f..bdf6e18a 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -15,99 +15,44 @@ on: required: false type: string -env: - LTHN_TAG: ${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }} - jobs: build: - runs-on: ${{ matrix.runner }} - strategy: - matrix: - include: - - arch: amd64 - runner: ubuntu-latest - tag: "-amd64" - platform: linux/amd64 - - arch: arm64 - runner: ubuntu-24.04-arm - tag: "-arm64" - platform: linux/arm64 + name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}" + runs-on: ubuntu-24.04-arm steps: - - uses: actions/checkout@v4 + - name: Checkout Project + uses: actions/checkout@v4.2.2 with: fetch-depth: 0 submodules: recursive + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to DockerHub + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push image + + - name: Build and push + id: docker_build uses: docker/build-push-action@v6 with: - context: ${{ github.workspace }} file: utils/docker/images/lthn-chain/Dockerfile + context: ${{ github.workspace }} push: true + platforms: linux/amd64,linux/arm64 build-args: | BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} THREADS=2 + BUILD_TARGET=gcc-linux-x86_64 BUILD_LOCAL=1 - platforms: ${{ matrix.platform }} - tags: lthn/chain:${{ env.LTHN_TAG }}${{ matrix.tag }} + tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }} cache-from: type=gha cache-to: type=gha,mode=max - manifest: - needs: build - runs-on: ubuntu-latest - steps: - - name: Log in to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Create and push manifest - run: | - docker manifest create lthn/chain:${{ env.LTHN_TAG }} \ - lthn/chain:${{ env.LTHN_TAG }}-amd64 \ - lthn/chain:${{ env.LTHN_TAG }}-arm64 - docker manifest push lthn/chain:${{ env.LTHN_TAG }} -# build: -# name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}" -# runs-on: ubuntu-24.04 -# steps: -# - name: Checkout Project -# uses: actions/checkout@v4.2.2 -# with: -# fetch-depth: 0 -# submodules: recursive -# -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v3 -# -# - name: Login to DockerHub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# -# -# - name: Build and push -# id: docker_build -# uses: docker/build-push-action@v6 -# with: -# file: utils/docker/images/lthn-chain/Dockerfile -# context: ${{ github.workspace }} -# push: true -# build-args: | -# BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} -# THREADS=2 -# BUILD_LOCAL=1 -# tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }} -# diff --git a/.github/workflows/build-macos-arm64.yml b/.github/workflows/build-macos-arm64.yml index 79ac634c..27b9a6ff 100644 --- a/.github/workflows/build-macos-arm64.yml +++ b/.github/workflows/build-macos-arm64.yml @@ -33,7 +33,6 @@ jobs: with: python-version: 3.x - - run: brew install cairo freetype libffi libjpeg libpng zlib pngquant - 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 diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake index 4140328c..0f641b61 100644 --- a/cmake/CPackConfig.cmake +++ b/cmake/CPackConfig.cmake @@ -8,10 +8,10 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CPACK_PACKAGE_CONTACT "${package_contact}") set(CPACK_PACKAGE_HOMEPAGE_URL "${package_website}") -# set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") # Linux/macOS default -# if(WIN32) -# set(CPACK_PACKAGING_INSTALL_PREFIX "C:/Program Files/${PROJECT_NAME}") -# endif() + set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") # Linux/macOS default + if(WIN32) + set(CPACK_PACKAGING_INSTALL_PREFIX "C:/Program Files/${PROJECT_NAME}") + endif() if(APPLE) if("${package_macos_installer}" STREQUAL "DMG") @@ -59,7 +59,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/packages") install(FILES README.md LICENSE.txt - DESTINATION "share/doc/${CPACK_PACKAGE_NAME}" + DESTINATION "share/doc/${PROJECT_NAME}" ) set(_arch "${CMAKE_SYSTEM_PROCESSOR}")