From 8d3a54e08517da6c93887ba674d8ee46266516de Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Wed, 11 Dec 2019 22:05:24 +0700 Subject: [PATCH 1/6] Run build tests against every push --- .github/workflows/test.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4fe54e9..6fc12ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,6 @@ -name: Build bitcoind on master push +name: Build bitcoind on push -on: - push: - branches: - - master +on: push jobs: build: From 878b5327cd9436e9ebe1bb86a516217848aea556 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Wed, 11 Dec 2019 23:49:23 +0700 Subject: [PATCH 2/6] Skip non native builds on non master pushes --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fc12ec..0f92ff9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,10 @@ jobs: - amd64 steps: + - name: Skip non native builds on non master pushes + if: github.ref != 'master' && matrix.arch != 'amd64' + run: exit 1 + - uses: actions/checkout@v1.0.0 - name: Register self-compiled qemu From d52cbcd5090571f9c9c605d70ec8238186523b76 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 12 Dec 2019 13:55:43 +0700 Subject: [PATCH 3/6] Add duplicate action for non-master branches --- .github/workflows/test-master.yml | 68 +++++++++++++++++++++++++++++++ .github/workflows/test.yml | 7 ---- 2 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/test-master.yml diff --git a/.github/workflows/test-master.yml b/.github/workflows/test-master.yml new file mode 100644 index 0000000..e5a6878 --- /dev/null +++ b/.github/workflows/test-master.yml @@ -0,0 +1,68 @@ +name: Build bitcoind on master push + +on: + push: + branches: + - master + +jobs: + build: + name: Build Bitcoind + runs-on: ubuntu-18.04 + + # NOTE: qemu v3.1.1 used instead of currently newest v4.1.0, because v4 is **much** slower for aarch64, see: + # https://github.com/meeDamian/docker-berkeleydb/commit/9e87d11314c2522726497f0c6059e61a31298e7f/checks + env: + QEMU_VERSION: v3.1.1 + DOCKER_BUILDKIT: 1 + + strategy: + fail-fast: false + matrix: + subver: + - '0.16' + - '0.17' + - '0.18' + - '0.19' + + arch: + - arm32v7 + - arm64 + - amd64 + + steps: + - uses: actions/checkout@v1.0.0 + + - name: Register self-compiled qemu + if: matrix.arch != 'amd64' + run: docker run --rm --privileged meedamian/simple-qemu:${QEMU_VERSION}-${{matrix.arch}} -p yes + + # Alter `Dockerfile` to reference used architecture/image combos explicitly. Places changed are: + # * all `FROM` statements (ex. `FROM alpine…` -> `FROM arm64v8/alpine…`) + # * BerkeleyDB `COPY` statement (`COPY --from=lncm/berkeleydb:db-4.8.30.NC` gets suffixed with ex. `-arm64`) + # `sed` `--expression`s change it in the following way: + # 1st: Matches all occurrences of `FROM alpine`, and injects arch prefix before `alpine`, ex: `arm64v8/alpine` + # 2nd: Matches BDB version, and appends "-${{matrix.arch}}" to it (note that `&` represents match). + - name: Change Dockerfile to use arch-specific base images + if: matrix.arch != 'amd64' + run: | + CPU=${{matrix.arch}} + if [[ "${CPU}" == "arm64" ]]; then + CPU="arm64v8" + fi + + sed -i ${{matrix.subver}}/Dockerfile \ + -e "s|^FROM alpine|FROM $CPU/alpine|g" \ + -e "s|db-4.8.30.NC|&-${{matrix.arch}}|g" + + # NOTE: Don't build 32-bit version of 0.17.1, as it's broken & non-essential: + # https://github.com/bitcoin/bitcoin/pull/15950 + - name: Build Bitcoind + if: matrix.subver != '0.17' || matrix.arch != 'arm32v7' + run: docker build -t bitcoind ${{matrix.subver}}/ + + - name: Print Bitcoind version + if: matrix.subver != '0.17' || matrix.arch != 'arm32v7' + run: | + docker run --rm --entrypoint=uname bitcoind -a + docker run --rm bitcoind --version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f92ff9..158427e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,15 +23,9 @@ jobs: - '0.19' arch: - - arm32v7 - - arm64 - amd64 steps: - - name: Skip non native builds on non master pushes - if: github.ref != 'master' && matrix.arch != 'amd64' - run: exit 1 - - uses: actions/checkout@v1.0.0 - name: Register self-compiled qemu @@ -67,4 +61,3 @@ jobs: run: | docker run --rm --entrypoint=uname bitcoind -a docker run --rm bitcoind --version - From 5e18ac18041f14dde7a6195014d6e48bceda4ce7 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 12 Dec 2019 14:02:15 +0700 Subject: [PATCH 4/6] Only run on PRs not all pushes --- .github/workflows/{test-master.yml => pull-request.yml} | 9 ++------- .github/workflows/test.yml | 9 +++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) rename .github/workflows/{test-master.yml => pull-request.yml} (95%) diff --git a/.github/workflows/test-master.yml b/.github/workflows/pull-request.yml similarity index 95% rename from .github/workflows/test-master.yml rename to .github/workflows/pull-request.yml index e5a6878..ce2541c 100644 --- a/.github/workflows/test-master.yml +++ b/.github/workflows/pull-request.yml @@ -1,9 +1,6 @@ -name: Build bitcoind on master push +name: Build bitcoind on push -on: - push: - branches: - - master +on: pull_request jobs: build: @@ -26,8 +23,6 @@ jobs: - '0.19' arch: - - arm32v7 - - arm64 - amd64 steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 158427e..e5a6878 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,9 @@ -name: Build bitcoind on push +name: Build bitcoind on master push -on: push +on: + push: + branches: + - master jobs: build: @@ -23,6 +26,8 @@ jobs: - '0.19' arch: + - arm32v7 + - arm64 - amd64 steps: From 0c2925421dd7adce375f7ceece3cb55791078de2 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 12 Dec 2019 14:06:49 +0700 Subject: [PATCH 5/6] Remove multi-arch config from PR action --- .github/workflows/pull-request.yml | 32 ------------------------------ 1 file changed, 32 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index ce2541c..37b040f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,10 +7,7 @@ jobs: name: Build Bitcoind runs-on: ubuntu-18.04 - # NOTE: qemu v3.1.1 used instead of currently newest v4.1.0, because v4 is **much** slower for aarch64, see: - # https://github.com/meeDamian/docker-berkeleydb/commit/9e87d11314c2522726497f0c6059e61a31298e7f/checks env: - QEMU_VERSION: v3.1.1 DOCKER_BUILDKIT: 1 strategy: @@ -22,42 +19,13 @@ jobs: - '0.18' - '0.19' - arch: - - amd64 - steps: - uses: actions/checkout@v1.0.0 - - name: Register self-compiled qemu - if: matrix.arch != 'amd64' - run: docker run --rm --privileged meedamian/simple-qemu:${QEMU_VERSION}-${{matrix.arch}} -p yes - - # Alter `Dockerfile` to reference used architecture/image combos explicitly. Places changed are: - # * all `FROM` statements (ex. `FROM alpine…` -> `FROM arm64v8/alpine…`) - # * BerkeleyDB `COPY` statement (`COPY --from=lncm/berkeleydb:db-4.8.30.NC` gets suffixed with ex. `-arm64`) - # `sed` `--expression`s change it in the following way: - # 1st: Matches all occurrences of `FROM alpine`, and injects arch prefix before `alpine`, ex: `arm64v8/alpine` - # 2nd: Matches BDB version, and appends "-${{matrix.arch}}" to it (note that `&` represents match). - - name: Change Dockerfile to use arch-specific base images - if: matrix.arch != 'amd64' - run: | - CPU=${{matrix.arch}} - if [[ "${CPU}" == "arm64" ]]; then - CPU="arm64v8" - fi - - sed -i ${{matrix.subver}}/Dockerfile \ - -e "s|^FROM alpine|FROM $CPU/alpine|g" \ - -e "s|db-4.8.30.NC|&-${{matrix.arch}}|g" - - # NOTE: Don't build 32-bit version of 0.17.1, as it's broken & non-essential: - # https://github.com/bitcoin/bitcoin/pull/15950 - name: Build Bitcoind - if: matrix.subver != '0.17' || matrix.arch != 'arm32v7' run: docker build -t bitcoind ${{matrix.subver}}/ - name: Print Bitcoind version - if: matrix.subver != '0.17' || matrix.arch != 'arm32v7' run: | docker run --rm --entrypoint=uname bitcoind -a docker run --rm bitcoind --version From 48859493f877647066d589aaa609f7d91b535e91 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 12 Dec 2019 14:10:38 +0700 Subject: [PATCH 6/6] Fix PR action name --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 37b040f..953441b 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,4 @@ -name: Build bitcoind on push +name: Build bitcoind on pull request on: pull_request