From da72df9d9c473bf5962f63bf7c94659302f9ed01 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Tue, 16 Jun 2026 16:00:30 -0400 Subject: [PATCH 1/9] ci: update build process for crypto dependencies and enhance Makefile commands --- .github/workflows/ci-pr.yaml | 38 +++++++++++++++++++--------------- Makefile | 22 +++++++++++++------- scripts/build_crypto_deps.sh | 40 ++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 23 deletions(-) create mode 100755 scripts/build_crypto_deps.sh diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml index a92b074360..3eeb71d31e 100644 --- a/.github/workflows/ci-pr.yaml +++ b/.github/workflows/ci-pr.yaml @@ -58,19 +58,25 @@ jobs: go-version: '1.24.2' cache-dependency-path: go/src/github.com/harmony-one/harmony/go.sum - - &build-mcl - name: Build mcl - run: make -j4 - working-directory: go/src/github.com/harmony-one/mcl - - - &build-bls - name: Build bls - run: make BLS_SWAP_G=1 -j4 - working-directory: go/src/github.com/harmony-one/bls + - &cache-crypto-deps + name: Cache crypto dependency build outputs + uses: actions/cache@v4 + with: + path: | + go/src/github.com/harmony-one/mcl/bin + go/src/github.com/harmony-one/mcl/lib + go/src/github.com/harmony-one/bls/bin + go/src/github.com/harmony-one/bls/lib + key: ${{ runner.os }}-crypto-deps-${{ hashFiles('go/src/github.com/harmony-one/mcl/**', 'go/src/github.com/harmony-one/bls/**') }} + + - &build-crypto-deps + name: Build crypto deps + run: JOBS=4 make deps + working-directory: go/src/github.com/harmony-one/harmony - &build-harmony name: Build harmony - run: make + run: make exe working-directory: go/src/github.com/harmony-one/harmony go-checker: @@ -82,8 +88,8 @@ jobs: - *checkout-mcl - *checkout-bls - *setup-go - - *build-mcl - - *build-bls + - *cache-crypto-deps + - *build-crypto-deps - *build-harmony - name: Install tools @@ -107,8 +113,8 @@ jobs: - *checkout-mcl - *checkout-bls - *setup-go - - *build-mcl - - *build-bls + - *cache-crypto-deps + - *build-crypto-deps - *build-harmony - &checkout-harmony-test @@ -140,8 +146,8 @@ jobs: - *checkout-mcl - *checkout-bls - *setup-go - - *build-mcl - - *build-bls + - *cache-crypto-deps + - *build-crypto-deps - *build-harmony - *checkout-harmony-test diff --git a/Makefile b/Makefile index 844f6c5099..99ed655a78 100644 --- a/Makefile +++ b/Makefile @@ -14,13 +14,16 @@ SHELL := bash EPOCH_TO_WAIT ?=5 EXTRA_NODES_FILE ?="./test/configs/local-extra-nodes.txt" -.PHONY: all help libs exe race trace-pointer debug debug-ext debug-kill test test-go test-api test-api-attach linux_static deb_init deb_build deb debpub_dev debpub_prod rpm_init rpm_build rpm rpmpub_dev rpmpub_prod clean distclean docker go-vet go-test docker build_localnet_validator protofiles travis_go_checker travis_rpc_checker travis_rosetta_checker debug-start-log debug-stop-log debug-restart-log debug-delete-log +.PHONY: all help deps deps-static libs build exe race trace-pointer debug debug-ext debug-kill test test-go test-api test-api-attach linux_static deb_init deb_build deb debpub_dev debpub_prod rpm_init rpm_build rpm rpmpub_dev rpmpub_prod clean distclean docker go-vet go-test docker build_localnet_validator protofiles travis_go_checker travis_rpc_checker travis_rosetta_checker debug-start-log debug-stop-log debug-restart-log debug-delete-log all: libs bash ./scripts/go_executable_build.sh -S help: @echo "all - build the harmony binary & bootnode along with the MCL & BLS libs (if necessary)" + @echo "deps - build only the MCL & BLS libs through the shared dependency bootstrap" + @echo "deps-static - build only the static MCL & BLS libs through the shared dependency bootstrap" + @echo "build - build the harmony binary & bootnode after dependency bootstrap" @echo "libs - build only the MCL & BLS libs (if necessary)" @echo "exe - build the harmony binary & bootnode" @echo "race - build the harmony binary & bootnode with race condition checks" @@ -69,9 +72,15 @@ help: @echo "debug-multi-bls-multi-ext-node - start a localnet with multiple external nodes and multi-BLS configuration" @echo "protofiles - generate Go code from protobuf files" -libs: - make -C $(TOP)/mcl -j8 - make -C $(TOP)/bls BLS_SWAP_G=1 -j8 +deps: + bash ./scripts/build_crypto_deps.sh + +deps-static: + STATIC_BLS=true bash ./scripts/build_crypto_deps.sh + +libs: deps + +build: deps exe exe: bash ./scripts/go_executable_build.sh -S @@ -170,8 +179,7 @@ test-rosetta-attach: bash ./test/rosetta.sh attach linux_static: - make -C $(TOP)/mcl -j8 - make -C $(TOP)/bls minimised_static BLS_SWAP_G=1 -j8 + STATIC_BLS=true bash ./scripts/build_crypto_deps.sh bash ./scripts/go_executable_build.sh -s linux_static_quick: @@ -271,4 +279,4 @@ debug-delete-log: docker-go-test: - docker run --rm -it -v "$PWD":/go/src/github.com/harmony-one/harmony frozen621/harmony-test bash -c 'make go-test' \ No newline at end of file + docker run --rm -it -v "$PWD":/go/src/github.com/harmony-one/harmony frozen621/harmony-test bash -c 'make go-test' diff --git a/scripts/build_crypto_deps.sh b/scripts/build_crypto_deps.sh new file mode 100755 index 0000000000..7b9589094c --- /dev/null +++ b/scripts/build_crypto_deps.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) + +# shellcheck source=scripts/setup_bls_build_flags.sh +. "${ROOT}/scripts/setup_bls_build_flags.sh" + +jobs="${JOBS:-}" +if [[ -z "${jobs}" ]]; then + if command -v nproc >/dev/null 2>&1; then + jobs=$(nproc) + elif command -v sysctl >/dev/null 2>&1; then + jobs=$(sysctl -n hw.ncpu) + else + jobs=4 + fi +fi + +if [[ ! -d "${MCL_DIR}" ]]; then + echo "missing mcl repository: ${MCL_DIR}" >&2 + exit 1 +fi + +if [[ ! -d "${BLS_DIR}" ]]; then + echo "missing bls repository: ${BLS_DIR}" >&2 + exit 1 +fi + +echo "building mcl (${MCL_DIR}) with -j${jobs}" +make -C "${MCL_DIR}" -j"${jobs}" + +if [[ "${STATIC_BLS:-false}" == "true" ]]; then + echo "building bls minimised_static (${BLS_DIR}) with -j${jobs}" + make -C "${BLS_DIR}" minimised_static BLS_SWAP_G=1 -j"${jobs}" +else + echo "building bls (${BLS_DIR}) with -j${jobs}" + make -C "${BLS_DIR}" BLS_SWAP_G=1 -j"${jobs}" +fi From 775875c7517a76c0959993e11599779a122ede4a Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Tue, 16 Jun 2026 20:03:37 -0400 Subject: [PATCH 2/9] add action to build and cache crypto dependencies --- .github/actions/build-crypto-deps/action.yml | 44 ++++++++++++++++++++ .github/workflows/ci-pr.yaml | 22 +++------- .github/workflows/ci-tag.yaml | 14 +++++-- .github/workflows/ci.yaml | 14 +++++-- 4 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 .github/actions/build-crypto-deps/action.yml diff --git a/.github/actions/build-crypto-deps/action.yml b/.github/actions/build-crypto-deps/action.yml new file mode 100644 index 0000000000..2a8b7f3842 --- /dev/null +++ b/.github/actions/build-crypto-deps/action.yml @@ -0,0 +1,44 @@ +name: Build crypto deps +description: Cache and build Harmony mcl/bls dependencies. + +inputs: + harmony-path: + description: Path to the harmony checkout. + required: true + mcl-path: + description: Path to the mcl checkout. + required: true + bls-path: + description: Path to the bls checkout. + required: true + jobs: + description: Parallel make jobs. + required: false + default: "4" + static: + description: Build static BLS outputs. + required: false + default: "false" + +runs: + using: composite + steps: + - name: Cache crypto dependency build outputs + uses: actions/cache@v4 + with: + path: | + ${{ inputs['mcl-path'] }}/bin + ${{ inputs['mcl-path'] }}/lib + ${{ inputs['bls-path'] }}/bin + ${{ inputs['bls-path'] }}/lib + key: ${{ runner.os }}-${{ runner.arch }}-crypto-deps-static-${{ inputs.static }}-${{ hashFiles(format('{0}/**', inputs['mcl-path']), format('{0}/**', inputs['bls-path'])) }} + + - name: Build crypto deps + shell: bash + working-directory: ${{ inputs['harmony-path'] }} + run: | + if [[ "${{ inputs.static }}" == "true" ]]; then + JOBS="${{ inputs.jobs }}" make deps-static + else + JOBS="${{ inputs.jobs }}" make deps + fi diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml index 3eeb71d31e..1c00cee213 100644 --- a/.github/workflows/ci-pr.yaml +++ b/.github/workflows/ci-pr.yaml @@ -58,21 +58,14 @@ jobs: go-version: '1.24.2' cache-dependency-path: go/src/github.com/harmony-one/harmony/go.sum - - &cache-crypto-deps - name: Cache crypto dependency build outputs - uses: actions/cache@v4 - with: - path: | - go/src/github.com/harmony-one/mcl/bin - go/src/github.com/harmony-one/mcl/lib - go/src/github.com/harmony-one/bls/bin - go/src/github.com/harmony-one/bls/lib - key: ${{ runner.os }}-crypto-deps-${{ hashFiles('go/src/github.com/harmony-one/mcl/**', 'go/src/github.com/harmony-one/bls/**') }} - - &build-crypto-deps name: Build crypto deps - run: JOBS=4 make deps - working-directory: go/src/github.com/harmony-one/harmony + uses: ./go/src/github.com/harmony-one/harmony/.github/actions/build-crypto-deps + with: + harmony-path: go/src/github.com/harmony-one/harmony + mcl-path: go/src/github.com/harmony-one/mcl + bls-path: go/src/github.com/harmony-one/bls + jobs: "4" - &build-harmony name: Build harmony @@ -88,7 +81,6 @@ jobs: - *checkout-mcl - *checkout-bls - *setup-go - - *cache-crypto-deps - *build-crypto-deps - *build-harmony @@ -113,7 +105,6 @@ jobs: - *checkout-mcl - *checkout-bls - *setup-go - - *cache-crypto-deps - *build-crypto-deps - *build-harmony @@ -146,7 +137,6 @@ jobs: - *checkout-mcl - *checkout-bls - *setup-go - - *cache-crypto-deps - *build-crypto-deps - *build-harmony - *checkout-harmony-test diff --git a/.github/workflows/ci-tag.yaml b/.github/workflows/ci-tag.yaml index 0a30d6395d..a88531be0b 100644 --- a/.github/workflows/ci-tag.yaml +++ b/.github/workflows/ci-tag.yaml @@ -76,6 +76,15 @@ jobs: with: go-version-file: 'harmony/go.mod' + - name: Build crypto deps + uses: ./harmony/.github/actions/build-crypto-deps + with: + harmony-path: harmony + mcl-path: mcl + bls-path: bls + jobs: "4" + static: "true" + - name: Get latest version and release run: | VERSION=$(git tag -l --sort=-v:refname | head -n 1 | tr -d v) @@ -87,7 +96,7 @@ jobs: - name: Build harmony binary and packages for Linux if: matrix.os == 'ubuntu-22.04' run: | - make linux_static + make linux_static_quick make deb echo %_signature gpg >> $HOME/.rpmmacros && echo "%_gpg_name Harmony (harmony.one)" >> $HOME/.rpmmacros make rpm @@ -99,7 +108,7 @@ jobs: - name: Build harmony binary and packages for Linux on ARM64 if: join(matrix.os, '-') == 'self-hosted-linux-ARM64' run: | - make linux_static + make linux_static_quick mv ./bin/harmony ./bin/harmony-arm64 working-directory: harmony @@ -326,4 +335,3 @@ jobs: asset_path: ./harmony-arm64.sig asset_name: harmony-arm64.sig asset_content_type: application/octet-stream - diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6a391684f1..bddefe58cd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -74,6 +74,15 @@ jobs: with: go-version-file: 'harmony/go.mod' + - name: Build crypto deps + uses: ./harmony/.github/actions/build-crypto-deps + with: + harmony-path: harmony + mcl-path: mcl + bls-path: bls + jobs: "4" + static: "true" + - name: Get latest version and release run: | VERSION=$(git tag -l --sort=-v:refname | head -n 1 | tr -d v) @@ -85,7 +94,7 @@ jobs: - name: Build harmony binary and packages for Linux if: matrix.os == 'ubuntu-22.04' run: | - make linux_static + make linux_static_quick make deb echo %_signature gpg >> $HOME/.rpmmacros && echo "%_gpg_name Harmony (harmony.one)" >> $HOME/.rpmmacros make rpm @@ -97,7 +106,7 @@ jobs: - name: Build harmony binary and packages for Linux if: join(matrix.os, '-') == 'self-hosted-linux-ARM64' run: | - make linux_static + make linux_static_quick mv ./bin/harmony ./bin/harmony-arm64 working-directory: harmony @@ -325,4 +334,3 @@ jobs: asset_path: ./harmony-arm64.sig asset_name: harmony-arm64.sig asset_content_type: application/octet-stream - From b9e8a664627a4f5aaecce3e449ad272b59559128 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:43:39 -0400 Subject: [PATCH 3/9] fix: handle unset argument in setup_bls_build_flags.sh for version check --- scripts/setup_bls_build_flags.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_bls_build_flags.sh b/scripts/setup_bls_build_flags.sh index 92ee20579e..3ffe8355dc 100644 --- a/scripts/setup_bls_build_flags.sh +++ b/scripts/setup_bls_build_flags.sh @@ -36,7 +36,7 @@ case $OS in ;; esac -if [ "$1" = "-v" ]; then +if [ "${1:-}" = "-v" ]; then echo "{ \"CGO_CFLAGS\" : \"$CGO_CFLAGS\", \"CGO_LDFLAGS\" : \"$CGO_LDFLAGS\", \"LD_LIBRARY_PATH\" : \"$LD_LIBRARY_PATH\", From 04540bf5d23b8403f104ea76d5d357976b7978f0 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Wed, 17 Jun 2026 18:18:44 -0400 Subject: [PATCH 4/9] build: preserve BLS flags for go-get --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 99ed655a78..e2957f587d 100644 --- a/Makefile +++ b/Makefile @@ -157,8 +157,7 @@ distclean: clean make -C $(TOP)/bls clean go-get: - source ./scripts/setup_bls_build_flags.sh - go get -v ./... + source ./scripts/setup_bls_build_flags.sh && go get -v ./... test: bash ./test/all.sh From 42989bb7e574e7327b886f985714b1671d44d002 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Wed, 17 Jun 2026 18:28:54 -0400 Subject: [PATCH 5/9] ci: reuse built binaries in integration jobs --- .github/workflows/ci-pr.yaml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml index 1c00cee213..074b961913 100644 --- a/.github/workflows/ci-pr.yaml +++ b/.github/workflows/ci-pr.yaml @@ -72,6 +72,17 @@ jobs: run: make exe working-directory: go/src/github.com/harmony-one/harmony + - &upload-harmony-binaries + name: Upload harmony binaries + uses: actions/upload-artifact@v4 + with: + name: harmony-binaries + path: | + go/src/github.com/harmony-one/harmony/bin/harmony + go/src/github.com/harmony-one/harmony/bin/bootnode + retention-days: 1 + if-no-files-found: error + go-checker: name: Run unit tests runs-on: ubuntu-24.04 @@ -98,6 +109,7 @@ jobs: rpc-checker: name: Run RPC integration tests + needs: build runs-on: ubuntu-24.04 timeout-minutes: 25 steps: @@ -106,7 +118,14 @@ jobs: - *checkout-bls - *setup-go - *build-crypto-deps - - *build-harmony + - name: Download harmony binaries + uses: actions/download-artifact@v4 + with: + name: harmony-binaries + path: go/src/github.com/harmony-one/harmony/bin + - name: Make harmony binaries executable + run: chmod +x bin/harmony bin/bootnode + working-directory: go/src/github.com/harmony-one/harmony - &checkout-harmony-test name: Checkout harmony-test @@ -130,6 +149,7 @@ jobs: pyhmy-checker: name: Run pyhmy tests + needs: build runs-on: ubuntu-24.04 timeout-minutes: 25 steps: @@ -138,7 +158,14 @@ jobs: - *checkout-bls - *setup-go - *build-crypto-deps - - *build-harmony + - name: Download harmony binaries + uses: actions/download-artifact@v4 + with: + name: harmony-binaries + path: go/src/github.com/harmony-one/harmony/bin + - name: Make harmony binaries executable + run: chmod +x bin/harmony bin/bootnode + working-directory: go/src/github.com/harmony-one/harmony - *checkout-harmony-test - name: Run pyhmy checker From 565c6ce1596d1ee8cd18df57881fc24f620b47a9 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Wed, 17 Jun 2026 21:52:48 -0400 Subject: [PATCH 6/9] ci: streamline CI workflow by removing unnecessary build steps --- .github/workflows/ci-pr.yaml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml index 074b961913..b34fbfbc09 100644 --- a/.github/workflows/ci-pr.yaml +++ b/.github/workflows/ci-pr.yaml @@ -114,10 +114,6 @@ jobs: timeout-minutes: 25 steps: - *checkout-harmony - - *checkout-mcl - - *checkout-bls - - *setup-go - - *build-crypto-deps - name: Download harmony binaries uses: actions/download-artifact@v4 with: @@ -138,9 +134,7 @@ jobs: persist-credentials: false - name: Run RPC checker - run: | - make go-get - bash ./scripts/travis_rpc_checker.sh + run: bash ./scripts/travis_rpc_checker.sh working-directory: go/src/github.com/harmony-one/harmony env: &travis-pr-env TRAVIS_PULL_REQUEST_SLUG: ${{ github.event.pull_request.head.repo.full_name }} @@ -154,10 +148,6 @@ jobs: timeout-minutes: 25 steps: - *checkout-harmony - - *checkout-mcl - - *checkout-bls - - *setup-go - - *build-crypto-deps - name: Download harmony binaries uses: actions/download-artifact@v4 with: @@ -169,8 +159,6 @@ jobs: - *checkout-harmony-test - name: Run pyhmy checker - run: | - make go-get - bash ./scripts/travis_pyhmy_checker.sh + run: bash ./scripts/travis_pyhmy_checker.sh working-directory: go/src/github.com/harmony-one/harmony env: *travis-pr-env From 46332c460adf46d4944e71e8899b5133dbbc7e4c Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Wed, 17 Jun 2026 23:39:26 -0400 Subject: [PATCH 7/9] ci: add script to build Docker image for harmony tests with caching support --- .github/workflows/ci-pr.yaml | 7 +++++++ scripts/build_harmony_test_image.sh | 27 +++++++++++++++++++++++++++ scripts/travis_pyhmy_checker.sh | 3 +-- scripts/travis_rosetta_checker.sh | 3 +-- scripts/travis_rpc_checker.sh | 3 +-- 5 files changed, 37 insertions(+), 6 deletions(-) create mode 100755 scripts/build_harmony_test_image.sh diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml index b34fbfbc09..be6339c730 100644 --- a/.github/workflows/ci-pr.yaml +++ b/.github/workflows/ci-pr.yaml @@ -133,10 +133,14 @@ jobs: path: go/src/github.com/harmony-one/harmony-test persist-credentials: false + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Run RPC checker run: bash ./scripts/travis_rpc_checker.sh working-directory: go/src/github.com/harmony-one/harmony env: &travis-pr-env + HARMONY_TEST_DOCKER_CACHE: "true" TRAVIS_PULL_REQUEST_SLUG: ${{ github.event.pull_request.head.repo.full_name }} TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }} TRAVIS_BRANCH: ${{ github.ref_name }} @@ -158,6 +162,9 @@ jobs: working-directory: go/src/github.com/harmony-one/harmony - *checkout-harmony-test + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Run pyhmy checker run: bash ./scripts/travis_pyhmy_checker.sh working-directory: go/src/github.com/harmony-one/harmony diff --git a/scripts/build_harmony_test_image.sh b/scripts/build_harmony_test_image.sh new file mode 100755 index 0000000000..3ba9530337 --- /dev/null +++ b/scripts/build_harmony_test_image.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -euo pipefail + +main_repo_branch=${1:?missing main repo branch} +main_repo_org=${2:?missing main repo org} +image_tag=${3:-harmonyone/localnet-test} + +cache_scope_branch=$(printf "%s" "${main_repo_branch}" | tr -c "[:alnum:]_.-" "-") +cache_scope="harmony-test-localnet-${cache_scope_branch}" + +if [[ "${HARMONY_TEST_DOCKER_CACHE:-false}" == "true" ]]; then + docker buildx build \ + --build-arg MAIN_REPO_BRANCH="${main_repo_branch}" \ + --build-arg MAIN_REPO_ORG="${main_repo_org}" \ + --progress plain \ + --cache-from "type=gha,scope=${cache_scope}" \ + --cache-to "type=gha,mode=max,scope=${cache_scope}" \ + --load \ + -t "${image_tag}" . +else + docker build \ + --build-arg MAIN_REPO_BRANCH="${main_repo_branch}" \ + --build-arg MAIN_REPO_ORG="${main_repo_org}" \ + --progress plain \ + -t "${image_tag}" . +fi diff --git a/scripts/travis_pyhmy_checker.sh b/scripts/travis_pyhmy_checker.sh index f93b8679da..ccff825e13 100755 --- a/scripts/travis_pyhmy_checker.sh +++ b/scripts/travis_pyhmy_checker.sh @@ -45,7 +45,6 @@ git fetch origin "${TEST_REPO_BRANCH}" git checkout "${TEST_REPO_BRANCH}" git pull --rebase=true cd localnet -docker build --build-arg MAIN_REPO_BRANCH="${MAIN_REPO_BRANCH}" --progress plain \ - --build-arg MAIN_REPO_ORG="${MAIN_REPO_ORG}" -t harmonyone/localnet-test . +"${DIR}/build_harmony_test_image.sh" "${MAIN_REPO_BRANCH}" "${MAIN_REPO_ORG}" # WARN: this is the place where LOCAL repository is provided to the harmony-tests repo docker run -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test -p diff --git a/scripts/travis_rosetta_checker.sh b/scripts/travis_rosetta_checker.sh index bd96ad2fc7..e4b2ef7a88 100755 --- a/scripts/travis_rosetta_checker.sh +++ b/scripts/travis_rosetta_checker.sh @@ -45,7 +45,6 @@ git fetch origin "${TEST_REPO_BRANCH}" git checkout "${TEST_REPO_BRANCH}" git pull --rebase=true cd localnet -docker build --build-arg MAIN_REPO_BRANCH="${MAIN_REPO_BRANCH}" --progress plain \ - --build-arg MAIN_REPO_ORG="${MAIN_REPO_ORG}" -t harmonyone/localnet-test . +"${DIR}/build_harmony_test_image.sh" "${MAIN_REPO_BRANCH}" "${MAIN_REPO_ORG}" # WARN: this is the place where LOCAL repository is provided to the harmony-tests repo docker run -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test -r diff --git a/scripts/travis_rpc_checker.sh b/scripts/travis_rpc_checker.sh index 5cc4900100..8c9726f121 100755 --- a/scripts/travis_rpc_checker.sh +++ b/scripts/travis_rpc_checker.sh @@ -45,7 +45,6 @@ git fetch origin "${TEST_REPO_BRANCH}" git checkout "${TEST_REPO_BRANCH}" git pull --rebase=true cd localnet -docker build --build-arg MAIN_REPO_BRANCH="${MAIN_REPO_BRANCH}" --progress plain \ - --build-arg MAIN_REPO_ORG="${MAIN_REPO_ORG}" -t harmonyone/localnet-test . +"${DIR}/build_harmony_test_image.sh" "${MAIN_REPO_BRANCH}" "${MAIN_REPO_ORG}" # WARN: this is the place where LOCAL repository is provided to the harmony-tests repo docker run -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test -n From 1c0f6b7ec5d23d5aef7a6a3615da8c45003164b5 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Thu, 18 Jun 2026 00:45:21 -0400 Subject: [PATCH 8/9] ci: update Docker build script to use configurable cache scope --- scripts/build_harmony_test_image.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/build_harmony_test_image.sh b/scripts/build_harmony_test_image.sh index 3ba9530337..e134e3a61c 100755 --- a/scripts/build_harmony_test_image.sh +++ b/scripts/build_harmony_test_image.sh @@ -6,10 +6,10 @@ main_repo_branch=${1:?missing main repo branch} main_repo_org=${2:?missing main repo org} image_tag=${3:-harmonyone/localnet-test} -cache_scope_branch=$(printf "%s" "${main_repo_branch}" | tr -c "[:alnum:]_.-" "-") -cache_scope="harmony-test-localnet-${cache_scope_branch}" +cache_scope=${HARMONY_TEST_DOCKER_CACHE_SCOPE:-harmony-test-localnet} if [[ "${HARMONY_TEST_DOCKER_CACHE:-false}" == "true" ]]; then + echo "Building ${image_tag} with Docker Buildx cache scope: ${cache_scope}" docker buildx build \ --build-arg MAIN_REPO_BRANCH="${main_repo_branch}" \ --build-arg MAIN_REPO_ORG="${main_repo_org}" \ @@ -19,6 +19,7 @@ if [[ "${HARMONY_TEST_DOCKER_CACHE:-false}" == "true" ]]; then --load \ -t "${image_tag}" . else + echo "Building ${image_tag} without Docker Buildx cache" docker build \ --build-arg MAIN_REPO_BRANCH="${main_repo_branch}" \ --build-arg MAIN_REPO_ORG="${main_repo_org}" \ From 0d1e1ab9a16c4f5c3d197d6eb9bfd17bfd175d10 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Fri, 19 Jun 2026 15:03:03 -0400 Subject: [PATCH 9/9] ci: refactor harmony test execution and add run_harmony_test_image script --- .github/workflows/ci-pr.yaml | 27 ++------------------------- scripts/run_harmony_test_image.sh | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 25 deletions(-) create mode 100755 scripts/run_harmony_test_image.sh diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml index be6339c730..16fdd78094 100644 --- a/.github/workflows/ci-pr.yaml +++ b/.github/workflows/ci-pr.yaml @@ -123,27 +123,9 @@ jobs: run: chmod +x bin/harmony bin/bootnode working-directory: go/src/github.com/harmony-one/harmony - - &checkout-harmony-test - name: Checkout harmony-test - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 #v6.0.3 - with: - repository: harmony-one/harmony-test - ref: master - fetch-depth: 1 - path: go/src/github.com/harmony-one/harmony-test - persist-credentials: false - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Run RPC checker - run: bash ./scripts/travis_rpc_checker.sh + run: bash ./scripts/run_harmony_test_image.sh -n working-directory: go/src/github.com/harmony-one/harmony - env: &travis-pr-env - HARMONY_TEST_DOCKER_CACHE: "true" - TRAVIS_PULL_REQUEST_SLUG: ${{ github.event.pull_request.head.repo.full_name }} - TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }} - TRAVIS_BRANCH: ${{ github.ref_name }} pyhmy-checker: name: Run pyhmy tests @@ -160,12 +142,7 @@ jobs: - name: Make harmony binaries executable run: chmod +x bin/harmony bin/bootnode working-directory: go/src/github.com/harmony-one/harmony - - *checkout-harmony-test - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - name: Run pyhmy checker - run: bash ./scripts/travis_pyhmy_checker.sh + run: bash ./scripts/run_harmony_test_image.sh -p working-directory: go/src/github.com/harmony-one/harmony - env: *travis-pr-env diff --git a/scripts/run_harmony_test_image.sh b/scripts/run_harmony_test_image.sh new file mode 100755 index 0000000000..9c268dceef --- /dev/null +++ b/scripts/run_harmony_test_image.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -euo pipefail + +test_mode=${1:?missing localnet test mode, expected -n, -p, or -r} +image_tag=${HARMONY_TEST_IMAGE:-harmonyone/localnet-test} +root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) + +echo "Pulling ${image_tag}" +docker pull "${image_tag}" + +echo "Running ${image_tag} ${test_mode}" +docker run \ + -v "${root}:/go/src/github.com/harmony-one/harmony" \ + "${image_tag}" "${test_mode}"