Skip to content

Commit

Permalink
Cleanup build process and workflows (#1851)
Browse files Browse the repository at this point in the history
* Suppress depends related superfluous warnings

* Fix passthrough string quote

* Fix windres, bcrypt failures

* Cleanup build, workflows, dockerfiles

* Cleanup comments

* Refactor default var setup

* Cleanup comments

* Add safe_rm_rf and simplify left file list

* Fix shellcheck

* Fix arm core images

* More cleanup, unify packaging, safer rm

* Apply default conf across all arch, conf args append

* Apply glibc compat only on linux builds

* Clean up obsolete comments
  • Loading branch information
prasannavl authored Apr 4, 2023
1 parent 80f249c commit 44a1f8b
Show file tree
Hide file tree
Showing 15 changed files with 260 additions and 300 deletions.
43 changes: 20 additions & 23 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,22 @@ on:
- "!v*"
branches:
- master
- testnet
- epic/*
- t/*
- e/*
- v*
- "[0-9]+.[0-9]+.x"
pull_request:
branches:
- master
- testnet
- epic/*
- t/*
- e/*
- v*
- "[0-9]+.[0-9]+.x"

env:
MAKE_CONF_ARGS: --disable-bench
BUILD_VERSION: latest # Computed

jobs:

linux:
linux-x64:
# We use a matrix since it's easier to migrate upwards, add new
# test on multiple, then remove old without creating friction.
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
env:
BUILD_VERSION: latest # Computed

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -69,14 +55,28 @@ jobs:
repository: defi/defichain
tags: ${{ env.BUILD_VERSION }}

windows:
linux-armhf:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
env:
BUILD_VERSION: latest # Computed
steps:
- uses: actions/checkout@v3

- name: Build and package
run: DOCKERFILE="arm-linux-gnueabihf" TARGET="arm-linux-gnueabihf" ./make.sh docker-release-git

- name: Publish artifact - arm-linux-gnueabihf
uses: actions/upload-artifact@v3
with:
name: defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf
path: ./build/defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf.tar.gz

win-x64:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3

Expand All @@ -89,14 +89,11 @@ jobs:
name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32
path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.tar.gz

macos:
mac-x64:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
env:
BUILD_VERSION: latest # Computed

steps:
- uses: actions/checkout@v3

Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Build - Release

on:
workflow_dispatch:
release:
types: [published]

jobs:
env:
BUILD_VERSION: latest # Computed

jobs:
linux:
runs-on: ubuntu-20.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')

steps:
Expand Down Expand Up @@ -47,8 +48,6 @@ jobs:

windows:
runs-on: ubuntu-20.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')

steps:
Expand All @@ -65,8 +64,6 @@ jobs:

macos:
runs-on: ubuntu-20.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')

steps:
Expand All @@ -87,8 +84,6 @@ jobs:
- windows
- macos
runs-on: ubuntu-20.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')

steps:
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
name: Lint

on:
workflow_dispatch:
push:
tags:
- "!v*"
branches:
- master
- staging
- develop
- ci/*
- epic/*
- v*
pull_request:
branches:
- master
- develop
- staging
- ci/*
- epic/*
- v*
- "[0-9]+.[0-9]+.x"


jobs:
unit_tests:
name: Lint
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/misc-prune-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: Misc - Prune Artifacts
# filling up the storage space

on:
workflow_dispatch:
schedule:
# Every day at 1am
- cron: '0 1 * * *'
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/tests-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
name: Tests - E2E

on:
workflow_dispatch:
push:
tags:
- "!v*"
branches:
- master
- staging
- develop
- ci/*
- epic/*
- v*
- "[0-9]+.[0-9]+.x"
pull_request:
branches:
- master
- develop
- staging
- ci/*
- epic/*
- v*
- "[0-9]+.[0-9]+.x"

jobs:
unit_tests:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/tests-jellyfish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: Tests - Jellyfish

on:
push:
branches:
- epic/*
workflow_dispatch:
pull_request:
branches:
- master
- epic/*

jobs:
test:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/tests-sync.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: Tests - Sync
on:
pull_request:
branches:
- master
- epic/*
types: [labeled, opened, reopened, synchronize]
workflow_dispatch:
inputs:
block_ranges:
description: 'Optionally restrict to specific block ranges. Should be formatted as multiple start block, such as "350000 50000 750000". Defaults to all block ranges'
required: false
name:
description: 'Workflow run custom name'
require: false
required: false
pull_request:
branches:
- master
types: [labeled, opened, reopened, synchronize]

run-name: ${{ inputs.name || github.event.pull_request.title || github.ref_name }}

Expand Down
54 changes: 54 additions & 0 deletions contrib/dockerfiles/aarch64-linux-gnu.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ARG TARGET=aarch64-linux-gnu

# -----------
FROM ubuntu:20.04 as builder-base
ARG TARGET
LABEL org.defichain.name="defichain-builder-base"
LABEL org.defichain.arch=${TARGET}

WORKDIR /work
COPY ./make.sh .

RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_update_base
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_arm64

# -----------
FROM builder-base as depends-builder
ARG TARGET
LABEL org.defichain.name="defichain-depends-builder"
LABEL org.defichain.arch=${TARGET}

WORKDIR /work
COPY ./depends ./depends

RUN ./make.sh clean-depends && ./make.sh build-deps

# -----------
FROM builder-base as builder
ARG TARGET
ARG BUILD_VERSION=

LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}

WORKDIR /work

COPY . .
RUN ./make.sh purge && rm -rf ./depends
COPY --from=depends-builder /work/depends ./depends

RUN ./make.sh build-conf && ./make.sh build-make

RUN mkdir /app && make prefix=/ DESTDIR=/app install && cp /work/README.md /app/.

# -----------
### Actual image that contains defi binaries
FROM arm64v8/ubuntu:20.04
ARG TARGET
LABEL org.defichain.name="defichain"
LABEL org.defichain.arch=${TARGET}

WORKDIR /app

COPY --from=builder /app/. ./
43 changes: 14 additions & 29 deletions contrib/dockerfiles/arm-linux-gnueabihf.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,40 @@ ARG TARGET
LABEL org.defichain.name="defichain-builder-base"
LABEL org.defichain.arch=${TARGET}

RUN apt update && apt dist-upgrade -y

# Setup DeFiChain build dependencies. Refer to depends/README.md and doc/build-unix.md
# from the source root for info on the builder setup

RUN apt install -y software-properties-common build-essential git libtool autotools-dev automake \
pkg-config bsdmainutils python3 libssl-dev libevent-dev libboost-system-dev \
libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev \
libminiupnpc-dev libzmq3-dev libqrencode-dev \
curl cmake \
g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
WORKDIR /work
COPY ./make.sh .

# For Berkeley DB - but we don't need as we do a depends build.
# RUN apt install -y libdb-dev
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_update_base
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_armhf

# -----------
FROM builder-base as depends-builder
ARG TARGET
LABEL org.defichain.name="defichain-depends-builder"
LABEL org.defichain.arch=${TARGET}

WORKDIR /work/depends
COPY ./depends .
# XREF: #make-deps
RUN make HOST=${TARGET} -j $(nproc)
WORKDIR /work
COPY ./depends ./depends

RUN ./make.sh clean-depends && ./make.sh build-deps

# -----------
FROM builder-base as builder
ARG TARGET
ARG BUILD_VERSION=

LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}

WORKDIR /work

COPY --from=depends-builder /work/depends ./depends
COPY . .
RUN ./make.sh purge && rm -rf ./depends
COPY --from=depends-builder /work/depends ./depends

RUN ./autogen.sh

# XREF: #make-configure
RUN ./configure --prefix=`pwd`/depends/${TARGET} \
--enable-glibc-back-compat \
--enable-reduce-exports \
LDFLAGS="-static-libstdc++"

ARG BUILD_VERSION=
RUN ./make.sh build-conf && ./make.sh build-make

RUN make -j $(nproc)
RUN mkdir /app && make prefix=/ DESTDIR=/app install && cp /work/README.md /app/.

# -----------
Expand All @@ -66,4 +52,3 @@ LABEL org.defichain.arch=${TARGET}
WORKDIR /app

COPY --from=builder /app/. ./

Loading

0 comments on commit 44a1f8b

Please sign in to comment.