forked from lthn/blockchain
Update CI workflows and Makefile for improved builds
Refactors the Docker build workflow to use a matrix for multi-arch builds, updates build arguments, and improves Docker image tagging. Disables Conan package caching on Linux ARM64 and macOS Intel workflows. Changes the Windows build to use the 'msvc-194-x86_64' target and updates artifact paths accordingly. Enhances the Makefile to pass additional CMake variables and run cpack after building.
This commit is contained in:
parent
370ec64a53
commit
973baa12c0
5 changed files with 83 additions and 35 deletions
107
.github/workflows/build-docker.yml
vendored
107
.github/workflows/build-docker.yml
vendored
|
|
@ -15,55 +15,102 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
|
||||
env:
|
||||
LTHN_TAG: ${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}"
|
||||
runs-on: ubuntu-24.04
|
||||
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
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4.2.2
|
||||
- uses: actions/checkout@v4
|
||||
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: Login to DockerHub
|
||||
- name: Log in to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
env:
|
||||
DOCKER_BUILD_SUMMARY: false
|
||||
with:
|
||||
file: utils/docker/images/lthn-chain/Dockerfile
|
||||
context: ${{ github.workspace }}
|
||||
file: utils/docker/images/lthn-chain/Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
target: chain-service
|
||||
build-args: |
|
||||
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
BUILD_THREADS=2
|
||||
target: builder
|
||||
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
||||
cache-from: type=registry,ref=lthn/chain:buildcache
|
||||
cache-to: type=registry,ref=lthn/chain:buildcache,mode=max
|
||||
|
||||
- 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
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
BUILD_THREADS=2
|
||||
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
||||
cache-from: type=registry,ref=lthn/chain:buildcache
|
||||
THREADS=2
|
||||
BUILD_LOCAL=1
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: lthn/chain:${{ env.LTHN_TAG }}${{ matrix.tag }}
|
||||
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' }}
|
||||
#
|
||||
|
|
|
|||
2
.github/workflows/build-linux-arm64.yml
vendored
2
.github/workflows/build-linux-arm64.yml
vendored
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
uses: conan-io/setup-conan@v1
|
||||
with:
|
||||
home: ${{ github.workspace }}/build/sdk
|
||||
cache_packages: true
|
||||
cache_packages: false
|
||||
|
||||
- name: Compile Release
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
|
|
|||
2
.github/workflows/build-macos-intel.yml
vendored
2
.github/workflows/build-macos-intel.yml
vendored
|
|
@ -37,7 +37,7 @@ jobs:
|
|||
uses: conan-io/setup-conan@v1
|
||||
with:
|
||||
home: ${{ github.workspace }}/build/sdk
|
||||
cache_packages: true
|
||||
cache_packages: false
|
||||
|
||||
- name: Compile Release
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
|
|
|||
4
.github/workflows/build-windows-intel.yml
vendored
4
.github/workflows/build-windows-intel.yml
vendored
|
|
@ -39,7 +39,7 @@ jobs:
|
|||
cache_packages: false
|
||||
|
||||
- name: Compile Release
|
||||
run: make release STATIC=1 CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
run: make msvc-194-x86_64 STATIC=1 CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
@ -47,4 +47,4 @@ jobs:
|
|||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/release/packages
|
||||
asset-directory: ${{ github.workspace }}/build/msvc-194-x86_64/packages
|
||||
|
|
|
|||
3
Makefile
3
Makefile
|
|
@ -131,8 +131,9 @@ conan-profile-detect:
|
|||
$(PROFILES): conan-profile-detect
|
||||
@echo "Building profile: $@"
|
||||
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/$@ -pr:b=$(DEFAULT_CONAN_PROFILE) -pr:h=cmake/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE)
|
||||
cmake -S . -B build/$@ -DCMAKE_TOOLCHAIN_FILE=build/$@/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=$(TESTNET)
|
||||
cmake -S . -B build/$@ -DCMAKE_TOOLCHAIN_FILE=build/$@/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
|
||||
cmake --build build/$@ --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
|
||||
(cd build/$@ && cpack)
|
||||
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue