From 046d9a2962b658339b6a2c7d6db11503f6b9711e Mon Sep 17 00:00:00 2001 From: Niven Date: Thu, 13 Apr 2023 14:50:59 +0800 Subject: [PATCH 01/20] Enable aarch64-apple-darwin builds (#1893) (#1894) * Build pipeline for building on arm64 macOS host architecture. Included CI build workflow for building the arm64 binaries * Rename to aarch64-apple-darwin to resolve build dependency bug * Amended markdown documentation (cherry picked from commit 29e10bee147c68c22583f8a5752ee4db0e211689) --- .github/workflows/build-dev.yaml | 17 +++++++++++++ .../aarch64-apple-darwin.dockerfile | 24 +++++++++++++++++++ .../dockerfiles/aarch64-linux-gnu.dockerfile | 2 +- .../arm-linux-gnueabihf.dockerfile | 2 +- .../x86_64-apple-darwin.dockerfile | 2 +- .../x86_64-pc-linux-gnu-clang.dockerfile | 4 ++-- .../x86_64-pc-linux-gnu.dockerfile | 4 ++-- .../dockerfiles/x86_64-w64-mingw32.dockerfile | 2 +- doc/build-quick.md | 2 +- make.sh | 8 ++++++- 10 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 contrib/dockerfiles/aarch64-apple-darwin.dockerfile diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 52e5ac8680..9a28fde28d 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -95,3 +95,20 @@ jobs: with: name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz + + mac-aarch64: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="aarch64-apple-darwin" ./make.sh docker-release + + - name: Publish artifact - aarch64-apple-darwin + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin + path: ./build/defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz diff --git a/contrib/dockerfiles/aarch64-apple-darwin.dockerfile b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile new file mode 100644 index 0000000000..95eec30664 --- /dev/null +++ b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile @@ -0,0 +1,24 @@ +ARG TARGET=aarch64-apple-darwin + +# ----------- +FROM --platform=linux/amd64 ubuntu:latest as builder +ARG TARGET +LABEL org.defichain.name="defichain-builder" +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_osx_tools + +COPY . . +RUN ./make.sh clean-depends && ./make.sh build-deps +RUN ./make.sh clean-conf && ./make.sh build-conf +RUN ./make.sh build-make + +RUN mkdir /app && cd build/${TARGET} && \ + make -s prefix=/ DESTDIR=/app install + +# NOTE: These are not runnable images. So we do not add into a scratch base image. diff --git a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile index 2cbd6f017f..360fb7357d 100644 --- a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile +++ b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile @@ -1,7 +1,7 @@ ARG TARGET=aarch64-linux-gnu # ----------- -FROM ubuntu:latest as builder +FROM --platform=linux/amd64 ubuntu:latest as builder ARG TARGET LABEL org.defichain.name="defichain-builder" LABEL org.defichain.arch=${TARGET} diff --git a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile index 26c268cafe..54da268018 100644 --- a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile +++ b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile @@ -1,7 +1,7 @@ ARG TARGET=arm-linux-gnueabihf # ----------- -FROM ubuntu:latest as builder +FROM --platform=linux/amd64 ubuntu:latest as builder ARG TARGET LABEL org.defichain.name="defichain-builder" LABEL org.defichain.arch=${TARGET} diff --git a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile index bd64484409..965642ae45 100644 --- a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile +++ b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile @@ -1,7 +1,7 @@ ARG TARGET=x86_64-apple-darwin # ----------- -FROM ubuntu:latest as builder +FROM --platform=linux/amd64 ubuntu:latest as builder ARG TARGET LABEL org.defichain.name="defichain-builder" LABEL org.defichain.arch=${TARGET} diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile index cd1e18f61d..bae87a224f 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile @@ -1,7 +1,7 @@ ARG TARGET=x86_64-pc-linux-gnu # ----------- -FROM debian:10 as builder +FROM --platform=linux/amd64 debian:10 as builder ARG TARGET ARG CLANG_VERSION=15 LABEL org.defichain.name="defichain-builder" @@ -31,7 +31,7 @@ RUN mkdir /app && cd build/${TARGET} && \ # ----------- ### Actual image that contains defi binaries -FROM debian:10 +FROM --platform=linux/amd64 debian:10 ARG TARGET LABEL org.defichain.name="defichain" LABEL org.defichain.arch=${TARGET} diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile index 53d8cbbe86..8a79ca7b06 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile @@ -1,7 +1,7 @@ ARG TARGET=x86_64-pc-linux-gnu # ----------- -FROM ubuntu:latest as builder +FROM --platform=linux/amd64 ubuntu:latest as builder ARG TARGET LABEL org.defichain.name="defichain-builder" LABEL org.defichain.arch=${TARGET} @@ -23,7 +23,7 @@ RUN mkdir /app && cd build/${TARGET} && \ # ----------- ### Actual image that contains defi binaries -FROM ubuntu:latest +FROM --platform=linux/amd64 ubuntu:latest ARG TARGET LABEL org.defichain.name="defichain" LABEL org.defichain.arch=${TARGET} diff --git a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile index d6af1ddb85..35d1f50278 100644 --- a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile +++ b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile @@ -1,7 +1,7 @@ ARG TARGET=x86_64-w64-mingw32 # ----------- -FROM ubuntu:latest as builder +FROM --platform=linux/amd64 ubuntu:latest as builder ARG TARGET LABEL org.defichain.name="defichain-builder" LABEL org.defichain.arch=${TARGET} diff --git a/doc/build-quick.md b/doc/build-quick.md index 82c702b0ec..feeddce2c7 100644 --- a/doc/build-quick.md +++ b/doc/build-quick.md @@ -61,7 +61,7 @@ an environment with correct arch and pre-requisites configured. - aarch64-linux-gnu - arm-linux-gnueabihf -- arm-apple-darwin +- aarch64-apple-darwin ## Defined `env` variables diff --git a/make.sh b/make.sh index 8bb9d589a3..645a2d3cf7 100755 --- a/make.sh +++ b/make.sh @@ -584,7 +584,13 @@ clean() { _get_default_target() { local default_target="" if [[ "${OSTYPE}" == "darwin"* ]]; then - default_target="x86_64-apple-darwin" + local macos_arch="" + macos_arch=$(uname -m || true) + if [[ "$macos_arch" == "x86_64" ]]; then + default_target="x86_64-apple-darwin" + else + default_target="aarch64-apple-darwin" + fi elif [[ "${OSTYPE}" == "msys" ]]; then default_target="x86_64-w64-mingw32" else From f79e25a667f6efb29cdeda8dafdc6d9d48eeb818 Mon Sep 17 00:00:00 2001 From: Niven Date: Thu, 13 Apr 2023 17:26:27 +0800 Subject: [PATCH 02/20] CI workflow fixes for dev, staging and production pipelines --- .github/workflows/build-dev.yaml | 34 ------ .github/workflows/build-release.yaml | 150 ++++++++++++++++++++++++--- .github/workflows/build-staging.yaml | 139 +++++++++++++++++++++++++ 3 files changed, 277 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/build-staging.yaml diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 9a28fde28d..e10c54f518 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -45,23 +45,6 @@ jobs: docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${ver} docker push defi/defichain:${ver} - linux-armhf: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Populate environment - run: GIT_VERSION=1 ./make.sh ci-export-vars - - - name: Build and package - run: GIT_VERSION=1 TARGET="arm-linux-gnueabihf" ./make.sh docker-release - - - 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: ubuntu-latest steps: @@ -95,20 +78,3 @@ jobs: with: name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz - - mac-aarch64: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Populate environment - run: GIT_VERSION=1 ./make.sh ci-export-vars - - - name: Build and package - run: GIT_VERSION=1 TARGET="aarch64-apple-darwin" ./make.sh docker-release - - - name: Publish artifact - aarch64-apple-darwin - uses: actions/upload-artifact@v3 - with: - name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin - path: ./build/defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 93f816093a..3fcecf0cca 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -10,7 +10,7 @@ env: DOCKER_HUB_USER: defi jobs: - linux: + linux-x64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -42,8 +42,46 @@ jobs: docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag} done docker push defi/defichain:${ver} + + linux-armhf: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="arm-linux-gnueabihf" ./make.sh docker-release - windows: + - 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 + + linux-aarch64: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="aarch64-linux-gnu" ./make.sh docker-release + + - name: Publish artifact - aarch64-linux-gnu + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu + path: ./build/defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu.tar.gz + + win-x64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -62,7 +100,7 @@ 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: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -81,11 +119,33 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz + mac-aarch64: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="aarch64-apple-darwin" ./make.sh docker-release + + - name: Publish artifact - aarch64-apple-darwin + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin + path: ./build/defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz + create-release: needs: - - linux - - windows - - macos + - linux-x64 + - linux-armhf + - linux-aarch64 + - win-x64 + - mac-x64 + - mac-aarch64 runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -101,7 +161,7 @@ jobs: - name: Get artifacts uses: actions/download-artifact@v3 - - name: zip package for windows + - name: zip package for win-x64 run: | set -e; ver=${{ env.BUILD_VERSION }} cd defichain-${ver}-x86_64-w64-mingw32 @@ -121,12 +181,18 @@ jobs: set -e; ver=${{ env.BUILD_VERSION }} cd ./defichain-${ver}-x86_64-pc-linux-gnu sha256sum ./defichain-${ver}-x86_64-pc-linux-gnu.tar.gz > ./defichain-${ver}-x86_64-pc-linux-gnu.tar.gz.SHA256 + cd ./defichain-${ver}-arm-linux-gnueabihf + sha256sum ./defichain-${ver}-arm-linux-gnueabihf.tar.gz > ./defichain-${ver}-arm-linux-gnueabihf.tar.gz.SHA256 + cd ./defichain-${ver}-aarch64-linux-gnu + sha256sum ./defichain-${ver}-aarch64-linux-gnu.tar.gz > ./defichain-${ver}-aarch64-linux-gnu.tar.gz.SHA256 cd .. && cd ./defichain-${ver}-x86_64-w64-mingw32 sha256sum ./defichain-${ver}-x86_64-w64-mingw32.zip > ./defichain-${ver}-x86_64-w64-mingw32.zip.SHA256 cd .. && cd ./defichain-${ver}-x86_64-apple-darwin sha256sum ./defichain-${ver}-x86_64-apple-darwin.tar.gz > ././defichain-${ver}-x86_64-apple-darwin.tar.gz.SHA256 + cd .. && cd ./defichain-${ver}-aarch64-apple-darwin + sha256sum ./defichain-${ver}-aarch64-apple-darwin.tar.gz > ././defichain-${ver}-aarch64-apple-darwin.tar.gz.SHA256 - - name: Upload release asset - linux + - name: Upload release asset - linux-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -136,7 +202,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz asset_content_type: application/gzip - - name: Upload checksum - linux + - name: Upload checksum - linux-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -145,8 +211,48 @@ jobs: asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu/defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz.SHA256 asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz.SHA256 asset_content_type: text/plain + + - name: Upload release asset - linux-armhf + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }} + asset_path: ./defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf/defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf.tar.gz + asset_name: defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf.tar.gz + asset_content_type: application/gzip + + - name: Upload checksum - linux-armhf + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }} + asset_path: ./defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf/defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf.tar.gz.SHA256 + asset_name: defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf.tar.gz.SHA256 + asset_content_type: text/plain + + - name: Upload release asset - linux-aarch64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }} + asset_path: ./defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu/defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu.tar.gz + asset_name: defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu.tar.gz + asset_content_type: application/gzip + + - name: Upload checksum - linux-aarch64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }} + asset_path: ./defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu/defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu.tar.gz.SHA256 + asset_name: defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu.tar.gz.SHA256 + asset_content_type: text/plain - - name: Upload release asset - windows + - name: Upload release asset - win-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -156,7 +262,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip asset_content_type: application/zip - - name: Upload checksum asset - windows + - name: Upload checksum asset - win-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -166,7 +272,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip.SHA256 asset_content_type: text/plain - - name: Upload release asset - macos + - name: Upload release asset - mac-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -185,3 +291,23 @@ jobs: asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz.SHA256 asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz.SHA256 asset_content_type: text/plain + + - name: Upload release asset - mac-aarch64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }} + asset_path: ./defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin/defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz + asset_name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz + asset_content_type: application/gzip + + - name: Upload checksum asset - mac-aarch64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }} + asset_path: ./defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin/defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz.SHA256 + asset_name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz.SHA256 + asset_content_type: text/plain diff --git a/.github/workflows/build-staging.yaml b/.github/workflows/build-staging.yaml new file mode 100644 index 0000000000..e5c832e802 --- /dev/null +++ b/.github/workflows/build-staging.yaml @@ -0,0 +1,139 @@ +name: Build - Staging + +on: + workflow_dispatch: + release: + types: [created] + +env: + BUILD_VERSION: latest # Computed + DOCKER_HUB_USER: defi + +jobs: + linux-x64: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 DOCKERFILE="x86_64-pc-linux-gnu-clang" TARGET="x86_64-pc-linux-gnu" ./make.sh docker-release + + - name: Publish artifacts + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu + path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ env.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Push to Docker Hub + run: | + set -e; ver=${{ env.BUILD_VERSION }} + for tag in $(echo $ver latest); do + docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag} + done + docker push defi/defichain:${ver} + + linux-armhf: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="arm-linux-gnueabihf" ./make.sh docker-release + + - 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 + + linux-aarch64: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="aarch64-linux-gnu" ./make.sh docker-release + + - name: Publish artifact - aarch64-linux-gnu + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu + path: ./build/defichain-${{ env.BUILD_VERSION }}-aarch64-linux-gnu.tar.gz + + win-x64: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="x86_64-w64-mingw32" ./make.sh docker-release + + - name: Publish artifact - x86_64-w64-mingw32 + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32 + path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.tar.gz + + mac-x64: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="x86_64-apple-darwin" ./make.sh docker-release + + - name: Publish artifact - x86_64-apple-darwin + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin + path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz + + mac-aarch64: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v3 + + - name: Populate environment + run: GIT_VERSION=1 ./make.sh ci-export-vars + + - name: Build and package + run: GIT_VERSION=1 TARGET="aarch64-apple-darwin" ./make.sh docker-release + + - name: Publish artifact - aarch64-apple-darwin + uses: actions/upload-artifact@v3 + with: + name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin + path: ./build/defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz \ No newline at end of file From 09c502fa2aa245e111591478bd18d7de986d6450 Mon Sep 17 00:00:00 2001 From: Niven Date: Thu, 13 Apr 2023 17:43:33 +0800 Subject: [PATCH 03/20] Fix naming bug --- .github/workflows/build-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 3fcecf0cca..50e06dee7c 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -282,7 +282,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz asset_content_type: application/gzip - - name: Upload checksum asset - macos + - name: Upload checksum asset - mac-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From dde95371e94f5271400e7b4474f570a5836b4db2 Mon Sep 17 00:00:00 2001 From: Niven Date: Thu, 13 Apr 2023 18:33:37 +0800 Subject: [PATCH 04/20] Removed publishing to dockerhub pipeline in build staging workflow, and renamed "mac" to "osx" --- .github/workflows/build-dev.yaml | 2 +- .github/workflows/build-release.yaml | 16 ++++++++-------- .github/workflows/build-staging.yaml | 22 ++-------------------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index e10c54f518..354b3f7eff 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -62,7 +62,7 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32 path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.tar.gz - mac-x64: + osx-x64: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 50e06dee7c..fd38361ebb 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -100,7 +100,7 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32 path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.tar.gz - mac-x64: + osx-x64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -119,7 +119,7 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz - mac-aarch64: + osx-aarch64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -144,8 +144,8 @@ jobs: - linux-armhf - linux-aarch64 - win-x64 - - mac-x64 - - mac-aarch64 + - osx-x64 + - osx-aarch64 runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -272,7 +272,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip.SHA256 asset_content_type: text/plain - - name: Upload release asset - mac-x64 + - name: Upload release asset - osx-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -282,7 +282,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz asset_content_type: application/gzip - - name: Upload checksum asset - mac-x64 + - name: Upload checksum asset - osx-x64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -292,7 +292,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz.SHA256 asset_content_type: text/plain - - name: Upload release asset - mac-aarch64 + - name: Upload release asset - osx-aarch64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -302,7 +302,7 @@ jobs: asset_name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz asset_content_type: application/gzip - - name: Upload checksum asset - mac-aarch64 + - name: Upload checksum asset - osx-aarch64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-staging.yaml b/.github/workflows/build-staging.yaml index e5c832e802..eb62714d8a 100644 --- a/.github/workflows/build-staging.yaml +++ b/.github/workflows/build-staging.yaml @@ -5,10 +5,6 @@ on: release: types: [created] -env: - BUILD_VERSION: latest # Computed - DOCKER_HUB_USER: defi - jobs: linux-x64: runs-on: ubuntu-latest @@ -28,20 +24,6 @@ jobs: with: name: defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ env.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - - - name: Push to Docker Hub - run: | - set -e; ver=${{ env.BUILD_VERSION }} - for tag in $(echo $ver latest); do - docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag} - done - docker push defi/defichain:${ver} linux-armhf: runs-on: ubuntu-latest @@ -100,7 +82,7 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32 path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.tar.gz - mac-x64: + osx-x64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -119,7 +101,7 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz - mac-aarch64: + osx-aarch64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') From 0e5b509ecdd9e6173467ee326bcd95741e462e99 Mon Sep 17 00:00:00 2001 From: Niven Date: Thu, 13 Apr 2023 18:53:27 +0800 Subject: [PATCH 05/20] Added workflow to push arm build image into Dockerhub. Rename docker tag convention to differentiate arm and x64 build images. --- .github/workflows/build-dev.yaml | 2 +- .github/workflows/build-release.yaml | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 354b3f7eff..93fe6d59d1 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -42,7 +42,7 @@ jobs: - name: Push to Docker Hub run: | set -e; ver=${{ env.BUILD_VERSION }} - docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${ver} + docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${ver}-linux-x64 docker push defi/defichain:${ver} win-x64: diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index fd38361ebb..a47d1396f3 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -39,7 +39,7 @@ jobs: run: | set -e; ver=${{ env.BUILD_VERSION }} for tag in $(echo $ver latest); do - docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag} + docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag}-linux-x64 done docker push defi/defichain:${ver} @@ -62,6 +62,20 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf path: ./build/defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf.tar.gz + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ env.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Push to Docker Hub + run: | + set -e; ver=${{ env.BUILD_VERSION }} + for tag in $(echo $ver latest); do + docker tag defichain-arm-linux-gnueabihf:${ver} defi/defichain:${tag}-linux-arm + done + docker push defi/defichain:${ver} + linux-aarch64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') From 7d8aaecb2e455b76ad2afcae8329caffef5ca421 Mon Sep 17 00:00:00 2001 From: Niven Date: Thu, 13 Apr 2023 21:28:54 +0800 Subject: [PATCH 06/20] Fix docker tags --- .github/workflows/build-dev.yaml | 2 +- .github/workflows/build-release.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 93fe6d59d1..354b3f7eff 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -42,7 +42,7 @@ jobs: - name: Push to Docker Hub run: | set -e; ver=${{ env.BUILD_VERSION }} - docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${ver}-linux-x64 + docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${ver} docker push defi/defichain:${ver} win-x64: diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index a47d1396f3..85697b700d 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -39,7 +39,7 @@ jobs: run: | set -e; ver=${{ env.BUILD_VERSION }} for tag in $(echo $ver latest); do - docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag}-linux-x64 + docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag} done docker push defi/defichain:${ver} @@ -72,7 +72,7 @@ jobs: run: | set -e; ver=${{ env.BUILD_VERSION }} for tag in $(echo $ver latest); do - docker tag defichain-arm-linux-gnueabihf:${ver} defi/defichain:${tag}-linux-arm + docker tag defichain-arm-linux-gnueabihf:${ver} defi/defichain:${tag} done docker push defi/defichain:${ver} From fa561721bb72892b85330ea3932a56c413638409 Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 18 Apr 2023 14:17:05 +0800 Subject: [PATCH 07/20] Reverting changes to pushing only linux-x64 into dockerhub registry. --- .github/workflows/build-release.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 85697b700d..fd38361ebb 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -62,20 +62,6 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf path: ./build/defichain-${{ env.BUILD_VERSION }}-arm-linux-gnueabihf.tar.gz - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ env.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - - - name: Push to Docker Hub - run: | - set -e; ver=${{ env.BUILD_VERSION }} - for tag in $(echo $ver latest); do - docker tag defichain-arm-linux-gnueabihf:${ver} defi/defichain:${tag} - done - docker push defi/defichain:${ver} - linux-aarch64: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') From b980638086fcce0cf1531f306d41562ed21e31b1 Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 18 Apr 2023 23:13:20 +0800 Subject: [PATCH 08/20] Include image layer to install rust dependencies --- contrib/dockerfiles/aarch64-apple-darwin.dockerfile | 1 + contrib/dockerfiles/aarch64-linux-gnu.dockerfile | 1 + contrib/dockerfiles/arm-linux-gnueabihf.dockerfile | 1 + contrib/dockerfiles/x86_64-apple-darwin.dockerfile | 1 + contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile | 1 + contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile | 1 + contrib/dockerfiles/x86_64-w64-mingw32.dockerfile | 1 + 7 files changed, 7 insertions(+) diff --git a/contrib/dockerfiles/aarch64-apple-darwin.dockerfile b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile index 95eec30664..59e7bcb38b 100644 --- a/contrib/dockerfiles/aarch64-apple-darwin.dockerfile +++ b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile @@ -11,6 +11,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_osx_tools COPY . . diff --git a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile index 360fb7357d..0f68697803 100644 --- a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile +++ b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile @@ -11,6 +11,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_arm64 COPY . . diff --git a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile index 54da268018..5934f456c2 100644 --- a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile +++ b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile @@ -11,6 +11,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_armhf COPY . . diff --git a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile index 965642ae45..c59c6eae68 100644 --- a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile +++ b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile @@ -11,6 +11,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_osx_tools COPY . . diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile index bae87a224f..ecfef13087 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile @@ -12,6 +12,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_llvm COPY . . diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile index 8a79ca7b06..4245a41c69 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile @@ -11,6 +11,7 @@ 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_rust COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile index 35d1f50278..30a35a1b36 100644 --- a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile +++ b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile @@ -11,6 +11,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_mingw_x86_64 RUN update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix From 3ad2ff7f66e858285414604127f1e11e5d827e13 Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 18 Apr 2023 23:14:31 +0800 Subject: [PATCH 09/20] Install protobuf-compiler pkg dep --- make.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make.sh b/make.sh index 645a2d3cf7..4f123884c7 100755 --- a/make.sh +++ b/make.sh @@ -403,7 +403,7 @@ pkg_install_deps() { libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev \ libminiupnpc-dev libzmq3-dev libqrencode-dev wget \ libdb-dev libdb++-dev libdb5.3 libdb5.3-dev libdb5.3++ libdb5.3++-dev \ - curl cmake unzip + curl cmake unzip protobuf-compiler _fold_end } From 506d8fadb4f6e35f9c76bd183d8e809fc558686f Mon Sep 17 00:00:00 2001 From: Niven Date: Tue, 18 Apr 2023 23:28:56 +0800 Subject: [PATCH 10/20] bug fixes --- contrib/dockerfiles/aarch64-apple-darwin.dockerfile | 1 + contrib/dockerfiles/aarch64-linux-gnu.dockerfile | 1 + contrib/dockerfiles/arm-linux-gnueabihf.dockerfile | 1 + contrib/dockerfiles/x86_64-apple-darwin.dockerfile | 1 + contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile | 1 + contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile | 1 + contrib/dockerfiles/x86_64-w64-mingw32.dockerfile | 1 + make.sh | 2 +- 8 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/dockerfiles/aarch64-apple-darwin.dockerfile b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile index 59e7bcb38b..82100cba7b 100644 --- a/contrib/dockerfiles/aarch64-apple-darwin.dockerfile +++ b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile @@ -13,6 +13,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_osx_tools +ENV PATH="/root/.cargo/bin:${PATH}" COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile index 0f68697803..6a627e9e0b 100644 --- a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile +++ b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile @@ -13,6 +13,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_arm64 +ENV PATH="/root/.cargo/bin:${PATH}" COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile index 5934f456c2..cefb9c742a 100644 --- a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile +++ b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile @@ -13,6 +13,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_armhf +ENV PATH="/root/.cargo/bin:${PATH}" COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile index c59c6eae68..fb445d00df 100644 --- a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile +++ b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile @@ -13,6 +13,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_osx_tools +ENV PATH="/root/.cargo/bin:${PATH}" COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile index ecfef13087..b3166ace42 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile @@ -14,6 +14,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_llvm +ENV PATH="/root/.cargo/bin:${PATH}" COPY . . RUN ./make.sh clean-depends && \ diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile index 4245a41c69..6e10458924 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile @@ -12,6 +12,7 @@ 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_rust +ENV PATH="/root/.cargo/bin:${PATH}" COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile index 30a35a1b36..42984bcbb8 100644 --- a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile +++ b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile @@ -13,6 +13,7 @@ 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_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_mingw_x86_64 +ENV PATH="/root/.cargo/bin:${PATH}" RUN update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix RUN update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix diff --git a/make.sh b/make.sh index 4f123884c7..8869f4fbdd 100755 --- a/make.sh +++ b/make.sh @@ -472,7 +472,7 @@ pkg_install_llvm() { } pkg_install_rust() { - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y } clean_pkg_local_osx_sysroot() { From 95b53c64caaef92c8c4e057693cee5fe0e0f4ca7 Mon Sep 17 00:00:00 2001 From: Niven Date: Sat, 15 Apr 2023 11:25:39 +0800 Subject: [PATCH 11/20] Fix bug in pkg_local_ensure_osx_sysroot function that does not exit out of entered dir if the package exists. Include new gnu-tar support for macos in platform_init function to support tar --transform on macos --- make.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/make.sh b/make.sh index 8869f4fbdd..f9cfb07ca6 100755 --- a/make.sh +++ b/make.sh @@ -224,7 +224,7 @@ package() { echo "> packaging: ${pkg_name} from ${versioned_release_dir}" _ensure_enter_dir "${versioned_release_dir}" - tar --transform "s,^./,${versioned_name}/," -czf "${pkg_path}" ./* + _tar ${versioned_name} ${pkg_path} _exit_dir echo "> package: ${pkg_path}" @@ -450,7 +450,10 @@ pkg_local_ensure_osx_sysroot() { local release_depends_dir=${DEPENDS_DIR} _ensure_enter_dir "$release_depends_dir/SDKs" - if [[ -d "${sdk_name}" ]]; then return; fi + if [[ -d "${sdk_name}" ]]; then + _exit_dir + return + fi _fold_start "pkg-local-mac-sdk" @@ -650,6 +653,23 @@ _platform_init() { readlink -m "$@" } fi + + if [[ $(command -v gtar) ]]; then + _tar() { + gtar --transform "s,^./,${1}/," -czf "${2}" ./* + } + else + if [[ $(command -v tar ) ]]; then + _tar() { + tar --transform "s,^./,${1}/," -czf "${2}" ./* + } + else + echo "error: GNU version of tar is required for \`--transform\` support" + echo "tip: debian/ubunti: apt install tar" + echo "tip: osx: brew install gnu-tar" + exit 1 + fi + fi } _nproc() { From b154628dc1c3a4813404c88714b94027b1e00f91 Mon Sep 17 00:00:00 2001 From: Niven Date: Wed, 19 Apr 2023 00:05:39 +0800 Subject: [PATCH 12/20] Install target toolchains in dockerfiles --- contrib/dockerfiles/aarch64-apple-darwin.dockerfile | 1 + contrib/dockerfiles/aarch64-linux-gnu.dockerfile | 1 + contrib/dockerfiles/arm-linux-gnueabihf.dockerfile | 1 + contrib/dockerfiles/x86_64-apple-darwin.dockerfile | 1 + contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile | 1 + contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile | 1 + contrib/dockerfiles/x86_64-w64-mingw32.dockerfile | 1 + 7 files changed, 7 insertions(+) diff --git a/contrib/dockerfiles/aarch64-apple-darwin.dockerfile b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile index 82100cba7b..be55ea8312 100644 --- a/contrib/dockerfiles/aarch64-apple-darwin.dockerfile +++ b/contrib/dockerfiles/aarch64-apple-darwin.dockerfile @@ -14,6 +14,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_osx_tools ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add aarch64-apple-darwin COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile index 6a627e9e0b..be259aa678 100644 --- a/contrib/dockerfiles/aarch64-linux-gnu.dockerfile +++ b/contrib/dockerfiles/aarch64-linux-gnu.dockerfile @@ -14,6 +14,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_arm64 ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add aarch64-unknown-linux-gnu COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile index cefb9c742a..371aa1f3bf 100644 --- a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile +++ b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile @@ -14,6 +14,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_armhf ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add arm-unknown-linux-gnueabihf COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile index fb445d00df..39a4ab0150 100644 --- a/contrib/dockerfiles/x86_64-apple-darwin.dockerfile +++ b/contrib/dockerfiles/x86_64-apple-darwin.dockerfile @@ -14,6 +14,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_osx_tools ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add x86_64-apple-darwin COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile index b3166ace42..96ee972ec7 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile @@ -15,6 +15,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_llvm ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add x86_64-unknown-linux-gnu COPY . . RUN ./make.sh clean-depends && \ diff --git a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile index 6e10458924..3f1ac80a5e 100644 --- a/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile +++ b/contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile @@ -13,6 +13,7 @@ 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_rust ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add x86_64-unknown-linux-gnu COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps diff --git a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile index 42984bcbb8..76a89cbc1c 100644 --- a/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile +++ b/contrib/dockerfiles/x86_64-w64-mingw32.dockerfile @@ -14,6 +14,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_mingw_x86_64 ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add x86_64-pc-windows-gnu RUN update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix RUN update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix From 31ff90fc45837398fe32b0bced5f95f79e221e8e Mon Sep 17 00:00:00 2001 From: Niven Date: Wed, 19 Apr 2023 00:12:44 +0800 Subject: [PATCH 13/20] Fix target toolchain for linux-arm docker build --- contrib/dockerfiles/arm-linux-gnueabihf.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile index 371aa1f3bf..3a0a95019d 100644 --- a/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile +++ b/contrib/dockerfiles/arm-linux-gnueabihf.dockerfile @@ -14,7 +14,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_rust RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_armhf ENV PATH="/root/.cargo/bin:${PATH}" -RUN rustup target add arm-unknown-linux-gnueabihf +RUN rustup target add armv7-unknown-linux-gnueabihf COPY . . RUN ./make.sh clean-depends && ./make.sh build-deps From 1a946dcd7ebacb7455aeebb4edaf0ef29ad5179f Mon Sep 17 00:00:00 2001 From: Niven Date: Wed, 19 Apr 2023 00:50:24 +0800 Subject: [PATCH 14/20] Resolve rustc toolchain bug --- lib/Makefile.am | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index e68943cb94..be0ae4b309 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,6 @@ CARGO ?= cargo -TARGET ?= $(RUST_TARGET) -TARGET ?= x86_64-unknown-linux-gnu +RUST_TARGET ?= x86_64-unknown-linux-gnu .PHONY: all: build-ain-rs-exports build-ain-grpc @@ -12,9 +11,9 @@ all: build-ain-rs-exports build-ain-grpc build-ain-rs-exports: build-ain-grpc @cd $(abs_srcdir) && \ CRATE_CC_NO_DEFAULTS=1 BUILD_DIR="$(abs_builddir)" $(CARGO) build --package ain-rs-exports \ - --release $(if $(TARGET),--target $(TARGET),) --target-dir $(abs_builddir)/target && \ + --release $(if $(RUST_TARGET),--target $(RUST_TARGET),) --target-dir $(abs_builddir)/target && \ mkdir -p $(abs_builddir)/gen/{include,lib,src} && \ - cp $(abs_builddir)/target/$(TARGET)/release/libain_rs_exports.a $(abs_builddir)/gen/lib/ && \ + cp $(abs_builddir)/target/$(RUST_TARGET)/release/libain_rs_exports.a $(abs_builddir)/gen/lib/ && \ cp $(abs_builddir)/ain_rs_exports.h $(abs_builddir)/gen/include/ && \ cp $(abs_builddir)/ain_rs_exports.cpp $(abs_builddir)/gen/src/ @@ -22,7 +21,7 @@ build-ain-rs-exports: build-ain-grpc build-ain-grpc: @cd $(abs_srcdir) && \ CRATE_CC_NO_DEFAULTS=1 BUILD_DIR="$(abs_builddir)" $(CARGO) build --package ain-grpc \ - --release $(if $(TARGET),--target $(TARGET),) --target-dir $(abs_builddir) + --release $(if $(RUST_TARGET),--target $(RUST_TARGET),) --target-dir $(abs_builddir) .PHONY: clean-local: From d9dc3c236f6dd3ec1f5509364ec44e0dadc4af50 Mon Sep 17 00:00:00 2001 From: Niven Date: Wed, 19 Apr 2023 11:55:07 +0800 Subject: [PATCH 15/20] Removed optional label in proto3 syntax to fix build error --- lib/proto/types/eth.proto | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/proto/types/eth.proto b/lib/proto/types/eth.proto index 8b2d7c2d01..d70d98ba64 100644 --- a/lib/proto/types/eth.proto +++ b/lib/proto/types/eth.proto @@ -6,13 +6,13 @@ message EthAccountsResult { } message EthTransactionInfo { - optional string from = 1; // The address from which the transaction is sent - optional string to = 2; // The address to which the transaction is addressed - optional uint64 gas = 3; // The integer of gas provided for the transaction execution - optional uint64 price = 4; // The integer of gas price used for each paid gas encoded as hexadecimal - optional uint64 value = 5; // The integer of value sent with this transaction encoded as hexadecimal - optional string data = 6; // The hash of the method signature and encoded parameters. - optional uint64 nonce = 7; // The integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. + string from = 1; // The address from which the transaction is sent + string to = 2; // The address to which the transaction is addressed + uint64 gas = 3; // The integer of gas provided for the transaction execution + uint64 price = 4; // The integer of gas price used for each paid gas encoded as hexadecimal + uint64 value = 5; // The integer of value sent with this transaction encoded as hexadecimal + string data = 6; // The hash of the method signature and encoded parameters. + uint64 nonce = 7; // The integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. } message EthChainIdResult { @@ -55,8 +55,8 @@ message EthTransactionReceipt { repeated string logs = 11; // Array of log objects, which this transaction generated. string logsBloom = 12; // Bloom filter for light clients to quickly retrieve related logs. string type = 13; // Integer of the transaction type, 0x00 for legacy transactions, 0x01 for access list types, 0x02 for dynamic fees. It also returns either : - optional string root = 14; // 32 bytes of post-transaction stateroot (pre Byzantium) - optional string status = 15; // Either 1 (success) or 0 (failure) + string root = 14; // 32 bytes of post-transaction stateroot (pre Byzantium) + string status = 15; // Either 1 (success) or 0 (failure) } message EthCallInput { @@ -181,8 +181,8 @@ message EthSendRawTransactionResult { } message EthEstimateGasInput { - optional EthTransactionInfo transactionInfo = 1; // Transaction info - optional string blockNumber = 2; // Block number in hexadecimal format or the string latest, earliest, pending, safe or finalized + EthTransactionInfo transactionInfo = 1; // Transaction info + string blockNumber = 2; // Block number in hexadecimal format or the string latest, earliest, pending, safe or finalized } message EthEstimateGasResult { @@ -354,6 +354,6 @@ message EthSyncingInfo { // TODO make it oneof message EthSyncingResult { - optional bool status = 1; - optional EthSyncingInfo syncInfo = 2; + bool status = 1; + EthSyncingInfo syncInfo = 2; } From cbc32c90f9e55b3cffb3fc8358099d02983f89ee Mon Sep 17 00:00:00 2001 From: Niven Date: Fri, 21 Apr 2023 11:22:15 +0800 Subject: [PATCH 16/20] Fix _tar func in make.sh to pass all args to gnu-tar, and fix docker release build workflow to only push x64 linux to docker registry. --- .github/workflows/build-release.yaml | 2 +- make.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index fd38361ebb..1977418353 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -42,7 +42,7 @@ jobs: docker tag defichain-x86_64-pc-linux-gnu:${ver} defi/defichain:${tag} done docker push defi/defichain:${ver} - + linux-armhf: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') diff --git a/make.sh b/make.sh index 2212eb73b9..96708a6463 100755 --- a/make.sh +++ b/make.sh @@ -225,7 +225,7 @@ package() { echo "> packaging: ${pkg_name} from ${versioned_release_dir}" _ensure_enter_dir "${versioned_release_dir}" - _tar ${versioned_name} ${pkg_path} + _tar --transform "s,^./,${versioned_name}/," -czf ${pkg_path} ./* _exit_dir echo "> package: ${pkg_path}" @@ -479,7 +479,7 @@ pkg_local_ensure_osx_sysroot() { if [[ ! -f "${pkg}" ]]; then wget https://bitcoincore.org/depends-sources/sdks/${pkg} fi - tar -zxf "${pkg}" + _tar -zxf "${pkg}" rm "${pkg}" 2>/dev/null || true _exit_dir @@ -715,12 +715,12 @@ _platform_init() { if [[ $(command -v gtar) ]]; then _tar() { - gtar --transform "s,^./,${1}/," -czf "${2}" ./* + gtar "$@" } else if [[ $(command -v tar ) ]]; then _tar() { - tar --transform "s,^./,${1}/," -czf "${2}" ./* + tar "$@" } else echo "error: GNU version of tar is required for \`--transform\` support" From 9445b8c3a628390e41ff9492ec54d6e04716ab3a Mon Sep 17 00:00:00 2001 From: Niven Date: Fri, 21 Apr 2023 11:30:22 +0800 Subject: [PATCH 17/20] Re-order build targets to select major dev envs first. --- test/functional/test_framework/test_framework.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 78839467d1..dfc2c1774d 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -80,13 +80,14 @@ def __new__(cls, clsname, bases, dct): def get_default_config_path(): current_file_path=os.path.abspath(os.path.dirname(os.path.realpath(__file__))) default_config_paths = [ - current_file_path + "/../../../build/test/config.ini", - current_file_path + "/../../config.ini", + # priority build selections for standard dev envs current_file_path + "/../../../build/x86_64-pc-linux-gnu/test/config.ini", + current_file_path + "/../../../build/aarch64-apple-darwin/test/config.ini", current_file_path + "/../../../build/x86_64-apple-darwin/test/config.ini", - current_file_path + "/../../../build/x86_64-w64-mingw32/test/config.ini", - current_file_path + "/../../../build/aarch64-linux-gnu/test/config.ini", + current_file_path + "/../../../build/x86_64-w64-migw32/test/config.ini", + # aarch64 / arm builds current_file_path + "/../../../build/arm-linux-gnueabihf/test/config.ini", + current_file_path + "/../../../build/aarch64-linux-gnu/test/config.ini", ] for p in default_config_paths: if os.path.exists(p): From d1ecf6d9477cca55aea7ffdcacc1963c9dff0993 Mon Sep 17 00:00:00 2001 From: Niven Date: Fri, 21 Apr 2023 11:59:16 +0800 Subject: [PATCH 18/20] Fix merge errors --- lib/ain-grpc/src/gen/types.rs | 327 +++++++++++++++++----------------- lib/proto/types/eth.proto | 6 +- 2 files changed, 167 insertions(+), 166 deletions(-) diff --git a/lib/ain-grpc/src/gen/types.rs b/lib/ain-grpc/src/gen/types.rs index 3636b0ed20..dd800c73df 100644 --- a/lib/ain-grpc/src/gen/types.rs +++ b/lib/ain-grpc/src/gen/types.rs @@ -156,150 +156,6 @@ pub struct PubKey { #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] #[allow(clippy::derive_partial_eq_without_eq)] -pub struct Block { - /// Block hash (same as input, if any) - #[prost(string, tag = "1")] - #[serde(skip_serializing_if = "String::is_empty")] - pub hash: ::prost::alloc::string::String, - /// The number of confirmations, or -1 if the block is not on the main chain - #[prost(int64, tag = "2")] - pub confirmations: i64, - /// Block size - #[prost(uint64, tag = "3")] - pub size: u64, - /// Block size without witness data - #[prost(uint64, tag = "4")] - pub strippedsize: u64, - /// The block weight as defined in BIP 141 - #[prost(uint64, tag = "5")] - pub weight: u64, - /// The block height or index - #[prost(uint64, tag = "6")] - pub height: u64, - /// The block version - #[prost(uint64, tag = "7")] - pub version: u64, - /// The block version in hex - #[prost(string, tag = "8")] - #[serde(skip_serializing_if = "String::is_empty")] - pub version_hex: ::prost::alloc::string::String, - /// The merkle root - #[prost(string, tag = "9")] - #[serde(skip_serializing_if = "String::is_empty")] - pub merkleroot: ::prost::alloc::string::String, - /// List of transaction IDs - #[prost(message, repeated, tag = "10")] - #[serde(skip_serializing_if = "Vec::is_empty")] - pub tx: ::prost::alloc::vec::Vec, - /// The block time in seconds since UNIX epoch - #[prost(uint64, tag = "11")] - pub time: u64, - /// The median block time in seconds since UNIX epoch - #[prost(uint64, tag = "12")] - pub mediantime: u64, - /// The nonce used to generate the block (property exists only when PoW is used) - #[prost(uint64, tag = "13")] - pub nonce: u64, - /// The bits which represent the target difficulty - #[prost(string, tag = "14")] - #[serde(skip_serializing_if = "String::is_empty")] - pub bits: ::prost::alloc::string::String, - /// The difficulty of the block - #[prost(double, tag = "15")] - pub difficulty: f64, - /// Expected number of hashes required to produce the chain up to this block (in hex) - #[prost(string, tag = "16")] - #[serde(skip_serializing_if = "String::is_empty")] - pub chainwork: ::prost::alloc::string::String, - /// Number of transactions in the block - #[prost(uint32, tag = "17")] - pub n_tx: u32, - /// The hash of the previous block - #[prost(string, tag = "18")] - #[serde(skip_serializing_if = "String::is_empty")] - #[serde(rename = "previousblockhash")] - pub previous_block_hash: ::prost::alloc::string::String, - /// The hash of the next block - #[prost(string, tag = "19")] - #[serde(skip_serializing_if = "String::is_empty")] - #[serde(rename = "nextblockhash")] - pub next_block_hash: ::prost::alloc::string::String, - /// DeFiChain fields - #[prost(string, tag = "101")] - #[serde(skip_serializing_if = "String::is_empty")] - pub masternode: ::prost::alloc::string::String, - #[prost(string, tag = "102")] - #[serde(skip_serializing_if = "String::is_empty")] - pub minter: ::prost::alloc::string::String, - #[prost(uint64, tag = "103")] - pub minted_blocks: u64, - #[prost(string, tag = "104")] - #[serde(skip_serializing_if = "String::is_empty")] - pub stake_modifier: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "105")] - #[serde(skip_serializing_if = "Vec::is_empty")] - pub nonutxo: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct NonUtxo { - #[prost(double, tag = "1")] - pub anchor_reward: f64, - #[prost(double, tag = "2")] - pub burnt: f64, - #[prost(double, tag = "3")] - pub incentive_funding: f64, - #[prost(double, tag = "4")] - pub loan: f64, - #[prost(double, tag = "5")] - pub options: f64, - #[prost(double, tag = "6")] - pub unknown: f64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[allow(clippy::derive_partial_eq_without_eq)] -pub struct BlockInput { - /// Block hash - #[prost(string, tag = "1")] - #[serde(skip_serializing_if = "String::is_empty")] - pub blockhash: ::prost::alloc::string::String, - /// 0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data [default: 1] - #[prost(uint32, tag = "2")] - pub verbosity: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -#[allow(clippy::derive_partial_eq_without_eq)] -pub struct BlockResult { - /// Hex-encoded data for block hash (for verbosity 0) - #[prost(string, tag = "1")] - pub hash: ::prost::alloc::string::String, - /// Block data (for verbosity 1 and 2) - #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[allow(clippy::derive_partial_eq_without_eq)] -pub struct BlockHashResult { - /// Hex-encoded data for block hash - #[prost(string, tag = "1")] - #[serde(skip_serializing_if = "String::is_empty")] - pub hash: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[allow(clippy::derive_partial_eq_without_eq)] pub struct EthAccountsResult { /// Accounts #[prost(string, repeated, tag = "1")] @@ -317,27 +173,25 @@ pub struct EthTransactionInfo { #[serde(skip_serializing_if = "String::is_empty")] pub from: ::prost::alloc::string::String, /// The address to which the transaction is addressed - #[prost(string, optional, tag = "2")] - pub to: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag = "2")] + #[serde(skip_serializing_if = "String::is_empty")] + pub to: ::prost::alloc::string::String, /// The integer of gas provided for the transaction execution #[prost(uint64, tag = "3")] pub gas: u64, /// The integer of gas price used for each paid gas encoded as hexadecimal - #[prost(string, tag = "4")] - #[serde(skip_serializing_if = "String::is_empty")] - pub price: ::prost::alloc::string::String, + #[prost(uint64, tag = "4")] + pub price: u64, /// The integer of value sent with this transaction encoded as hexadecimal - #[prost(string, tag = "5")] - #[serde(skip_serializing_if = "String::is_empty")] - pub value: ::prost::alloc::string::String, + #[prost(uint64, tag = "5")] + pub value: u64, /// The hash of the method signature and encoded parameters. #[prost(string, tag = "6")] #[serde(skip_serializing_if = "String::is_empty")] pub data: ::prost::alloc::string::String, /// The integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. - #[prost(string, tag = "7")] - #[serde(skip_serializing_if = "String::is_empty")] - pub nonce: ::prost::alloc::string::String, + #[prost(uint64, tag = "7")] + pub nonce: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -492,11 +346,13 @@ pub struct EthTransactionReceipt { #[serde(rename = "type")] pub field_type: ::prost::alloc::string::String, /// 32 bytes of post-transaction stateroot (pre Byzantium) - #[prost(string, optional, tag = "14")] - pub root: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag = "14")] + #[serde(skip_serializing_if = "String::is_empty")] + pub root: ::prost::alloc::string::String, /// Either 1 (success) or 0 (failure) - #[prost(string, optional, tag = "15")] - pub status: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag = "15")] + #[serde(skip_serializing_if = "String::is_empty")] + pub status: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -814,8 +670,9 @@ pub struct EthEstimateGasInput { #[prost(message, optional, tag = "1")] pub transaction_info: ::core::option::Option, /// Block number in hexadecimal format or the string latest, earliest, pending, safe or finalized - #[prost(string, optional, tag = "2")] - pub block_number: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag = "2")] + #[serde(skip_serializing_if = "String::is_empty")] + pub block_number: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1255,8 +1112,152 @@ pub struct EthSyncingInfo { #[serde(rename_all = "camelCase")] #[allow(clippy::derive_partial_eq_without_eq)] pub struct EthSyncingResult { - #[prost(bool, optional, tag = "1")] - pub status: ::core::option::Option, + #[prost(bool, tag = "1")] + pub status: bool, #[prost(message, optional, tag = "2")] pub sync_info: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +#[allow(clippy::derive_partial_eq_without_eq)] +pub struct Block { + /// Block hash (same as input, if any) + #[prost(string, tag = "1")] + #[serde(skip_serializing_if = "String::is_empty")] + pub hash: ::prost::alloc::string::String, + /// The number of confirmations, or -1 if the block is not on the main chain + #[prost(int64, tag = "2")] + pub confirmations: i64, + /// Block size + #[prost(uint64, tag = "3")] + pub size: u64, + /// Block size without witness data + #[prost(uint64, tag = "4")] + pub strippedsize: u64, + /// The block weight as defined in BIP 141 + #[prost(uint64, tag = "5")] + pub weight: u64, + /// The block height or index + #[prost(uint64, tag = "6")] + pub height: u64, + /// The block version + #[prost(uint64, tag = "7")] + pub version: u64, + /// The block version in hex + #[prost(string, tag = "8")] + #[serde(skip_serializing_if = "String::is_empty")] + pub version_hex: ::prost::alloc::string::String, + /// The merkle root + #[prost(string, tag = "9")] + #[serde(skip_serializing_if = "String::is_empty")] + pub merkleroot: ::prost::alloc::string::String, + /// List of transaction IDs + #[prost(message, repeated, tag = "10")] + #[serde(skip_serializing_if = "Vec::is_empty")] + pub tx: ::prost::alloc::vec::Vec, + /// The block time in seconds since UNIX epoch + #[prost(uint64, tag = "11")] + pub time: u64, + /// The median block time in seconds since UNIX epoch + #[prost(uint64, tag = "12")] + pub mediantime: u64, + /// The nonce used to generate the block (property exists only when PoW is used) + #[prost(uint64, tag = "13")] + pub nonce: u64, + /// The bits which represent the target difficulty + #[prost(string, tag = "14")] + #[serde(skip_serializing_if = "String::is_empty")] + pub bits: ::prost::alloc::string::String, + /// The difficulty of the block + #[prost(double, tag = "15")] + pub difficulty: f64, + /// Expected number of hashes required to produce the chain up to this block (in hex) + #[prost(string, tag = "16")] + #[serde(skip_serializing_if = "String::is_empty")] + pub chainwork: ::prost::alloc::string::String, + /// Number of transactions in the block + #[prost(uint32, tag = "17")] + pub n_tx: u32, + /// The hash of the previous block + #[prost(string, tag = "18")] + #[serde(skip_serializing_if = "String::is_empty")] + #[serde(rename = "previousblockhash")] + pub previous_block_hash: ::prost::alloc::string::String, + /// The hash of the next block + #[prost(string, tag = "19")] + #[serde(skip_serializing_if = "String::is_empty")] + #[serde(rename = "nextblockhash")] + pub next_block_hash: ::prost::alloc::string::String, + /// DeFiChain fields + #[prost(string, tag = "101")] + #[serde(skip_serializing_if = "String::is_empty")] + pub masternode: ::prost::alloc::string::String, + #[prost(string, tag = "102")] + #[serde(skip_serializing_if = "String::is_empty")] + pub minter: ::prost::alloc::string::String, + #[prost(uint64, tag = "103")] + pub minted_blocks: u64, + #[prost(string, tag = "104")] + #[serde(skip_serializing_if = "String::is_empty")] + pub stake_modifier: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "105")] + #[serde(skip_serializing_if = "Vec::is_empty")] + pub nonutxo: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct NonUtxo { + #[prost(double, tag = "1")] + pub anchor_reward: f64, + #[prost(double, tag = "2")] + pub burnt: f64, + #[prost(double, tag = "3")] + pub incentive_funding: f64, + #[prost(double, tag = "4")] + pub loan: f64, + #[prost(double, tag = "5")] + pub options: f64, + #[prost(double, tag = "6")] + pub unknown: f64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +#[allow(clippy::derive_partial_eq_without_eq)] +pub struct BlockInput { + /// Block hash + #[prost(string, tag = "1")] + #[serde(skip_serializing_if = "String::is_empty")] + pub blockhash: ::prost::alloc::string::String, + /// 0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data [default: 1] + #[prost(uint32, tag = "2")] + pub verbosity: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +#[allow(clippy::derive_partial_eq_without_eq)] +pub struct BlockResult { + /// Hex-encoded data for block hash (for verbosity 0) + #[prost(string, tag = "1")] + pub hash: ::prost::alloc::string::String, + /// Block data (for verbosity 1 and 2) + #[prost(message, optional, tag = "2")] + pub block: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +#[allow(clippy::derive_partial_eq_without_eq)] +pub struct BlockHashResult { + /// Hex-encoded data for block hash + #[prost(string, tag = "1")] + #[serde(skip_serializing_if = "String::is_empty")] + pub hash: ::prost::alloc::string::String, +} diff --git a/lib/proto/types/eth.proto b/lib/proto/types/eth.proto index 2f8819a2a0..5d34e48f6f 100644 --- a/lib/proto/types/eth.proto +++ b/lib/proto/types/eth.proto @@ -9,10 +9,10 @@ message EthTransactionInfo { string from = 1; // The address from which the transaction is sent string to = 2; // The address to which the transaction is addressed uint64 gas = 3; // The integer of gas provided for the transaction execution - uint64 price = 4; // The integer of gas price used for each paid gas encoded as hexadecimal - uint64 value = 5; // The integer of value sent with this transaction encoded as hexadecimal + string price = 4; // The integer of gas price used for each paid gas encoded as hexadecimal + string value = 5; // The integer of value sent with this transaction encoded as hexadecimal string data = 6; // The hash of the method signature and encoded parameters. - uint64 nonce = 7; // The integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. + string nonce = 7; // The integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. } message EthChainIdResult { From 2f38b99374a6675ea353263e1863c0b57e30e6d7 Mon Sep 17 00:00:00 2001 From: Niven Date: Fri, 21 Apr 2023 14:08:35 +0800 Subject: [PATCH 19/20] Revert to feature/evm branch version --- lib/proto/types/eth.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/proto/types/eth.proto b/lib/proto/types/eth.proto index 5d34e48f6f..2c48310994 100644 --- a/lib/proto/types/eth.proto +++ b/lib/proto/types/eth.proto @@ -7,7 +7,7 @@ message EthAccountsResult { message EthTransactionInfo { string from = 1; // The address from which the transaction is sent - string to = 2; // The address to which the transaction is addressed + optional string to = 2; // The address to which the transaction is addressed uint64 gas = 3; // The integer of gas provided for the transaction execution string price = 4; // The integer of gas price used for each paid gas encoded as hexadecimal string value = 5; // The integer of value sent with this transaction encoded as hexadecimal From ca4be69170d203cd82e14ef994f43a12aedc747e Mon Sep 17 00:00:00 2001 From: Niven Date: Fri, 21 Apr 2023 14:18:05 +0800 Subject: [PATCH 20/20] Reverting eth.proto version to feature/evm version t Please enter the commit message for your changes. Lines starting --- lib/proto/types/eth.proto | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/proto/types/eth.proto b/lib/proto/types/eth.proto index 2c48310994..c1fa13933f 100644 --- a/lib/proto/types/eth.proto +++ b/lib/proto/types/eth.proto @@ -55,8 +55,8 @@ message EthTransactionReceipt { repeated string logs = 11; // Array of log objects, which this transaction generated. string logsBloom = 12; // Bloom filter for light clients to quickly retrieve related logs. string type = 13; // Integer of the transaction type, 0x00 for legacy transactions, 0x01 for access list types, 0x02 for dynamic fees. It also returns either : - string root = 14; // 32 bytes of post-transaction stateroot (pre Byzantium) - string status = 15; // Either 1 (success) or 0 (failure) + optional string root = 14; // 32 bytes of post-transaction stateroot (pre Byzantium) + optional string status = 15; // Either 1 (success) or 0 (failure) } message EthCallInput { @@ -181,8 +181,8 @@ message EthSendRawTransactionResult { } message EthEstimateGasInput { - EthTransactionInfo transactionInfo = 1; // Transaction info - string blockNumber = 2; // Block number in hexadecimal format or the string latest, earliest, pending, safe or finalized + optional EthTransactionInfo transactionInfo = 1; // Transaction info + optional string blockNumber = 2; // Block number in hexadecimal format or the string latest, earliest, pending, safe or finalized } message EthEstimateGasResult { @@ -358,6 +358,6 @@ message EthSyncingInfo { // TODO make it oneof message EthSyncingResult { - bool status = 1; - EthSyncingInfo syncInfo = 2; + optional bool status = 1; + optional EthSyncingInfo syncInfo = 2; }