From e8007f57a95c9642a330f7a7a38fa039b154cae4 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Thu, 16 Apr 2026 23:40:52 -0700 Subject: [PATCH 1/2] Alter CI to utilize owner-relative libbitcoin repositories. --- .github/workflows/ci.yml | 281 ++++++++++++++++++++++++++++---- builds/cmake/install-cmake.sh | 7 +- builds/cmake/install-presets.sh | 7 +- builds/gnu/install-gnu.sh | 7 +- 4 files changed, 264 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b75142c5..09fa689c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,14 +92,45 @@ jobs: CXXFLAGS: '${{ matrix.flags }}' steps: - - name: Checkout repository + - name: Get branch name + id: get-branch + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + else + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + + - name: Checkout repository [libbitcoin-system] uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-system' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-system - - name: Sources directory path assignment - shell: bash - run: | - cd .. - echo SRC_PATH="$(pwd)" >> $GITHUB_ENV + - name: Checkout repository [libbitcoin-database] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-database' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-database + + - name: Checkout repository [libbitcoin-network] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-network' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-network + + - name: Checkout repository [libbitcoin-node] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-node' + repository: ${{ github.repository }} - name: Prepare toolchain [linux] if: ${{ startsWith(matrix.image, 'ubuntu') }} @@ -124,16 +155,17 @@ jobs: shell: bash run: | if [[ "${{ matrix.link }}" == "dynamic" ]]; then - echo "LDFLAGS=-Wl,-rpath,${{ env.SRC_PATH }}/prefix/lib" >> $GITHUB_ENV + echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi - name: Execute installation shell: bash + working-directory: 'libbitcoin-node' run: > ./builds/gnu/install-gnu.sh --build-use-local-src - --build-src-dir="${{ env.SRC_PATH }}" - --prefix="${{ env.SRC_PATH }}/prefix" + --build-src-dir="${{ github.workspace }}" + --prefix="${{ github.workspace }}/prefix" --build-obj-dir="obj" --build-obj-dir-relative --build-config="${{ matrix.config }}" @@ -147,7 +179,7 @@ jobs: shell: bash run: | lcov --ignore-errors version,gcov,mismatch,mismatch --directory . --capture --output-file coverage.info - lcov --ignore-errors unused --remove coverage.info "${{ env.SRC_PATH }}/prefix/*" "${{ github.workspace }}/examples/*" "${{ github.workspace }}/test/*" --output-file coverage.info + lcov --ignore-errors unused --remove coverage.info "${{ github.workspace }}/prefix/*" "${{ github.workspace }}/libbitcoin-node/examples/*" "${{ github.workspace }}/libbitcoin-node/test/*" --output-file coverage.info - name: Coveralls.io upload if: ${{ matrix.coverage == 'lcov' }} @@ -157,6 +189,33 @@ jobs: files: "./coverage.info" github-token: ${{ secrets.github_token }} + - name: Test artifact collection + if: failure() + shell: bash + working-directory: ${{ github.workspace }} + run: | + if [[ -e "libbitcoin-system/obj/test.log" ]]; then + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.log" + fi + if [[ -e "libbitcoin-database/obj/test.log" ]]; then + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.log" + fi + if [[ -e "libbitcoin-network/obj/test.log" ]]; then + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.log" + fi + if [[ -e "libbitcoin-node/obj/test.log" ]]; then + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.log" + fi + + - name: Test artifact upload + if: failure() + uses: actions/upload-artifact@v7.0.1 + with: + name: testlogs + path: ${{ github.workspace }}/*test.log + retention-days: 1 + if-no-files-found: warn + cmake: strategy: fail-fast: false @@ -238,14 +297,45 @@ jobs: CXXFLAGS: '${{ matrix.flags }}' steps: - - name: Checkout repository + - name: Get branch name + id: get-branch + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + else + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + + - name: Checkout repository [libbitcoin-system] uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-system' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-system - - name: Sources directory path assignment - shell: bash - run: | - cd .. - echo SRC_PATH="$(pwd)" >> $GITHUB_ENV + - name: Checkout repository [libbitcoin-database] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-database' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-database + + - name: Checkout repository [libbitcoin-network] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-network' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-network + + - name: Checkout repository [libbitcoin-node] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-node' + repository: ${{ github.repository }} - name: Prepare toolchain [linux] if: ${{ startsWith(matrix.image, 'ubuntu') }} @@ -270,16 +360,17 @@ jobs: shell: bash run: | if [[ "${{ matrix.link }}" == "dynamic" ]]; then - echo "LDFLAGS=-Wl,-rpath,${{ env.SRC_PATH }}/prefix/lib" >> $GITHUB_ENV + echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi - name: Execute installation shell: bash + working-directory: 'libbitcoin-node' run: > ./builds/cmake/install-cmake.sh --build-use-local-src - --build-src-dir="${{ env.SRC_PATH }}" - --prefix="${{ env.SRC_PATH }}/prefix" + --build-src-dir="${{ github.workspace }}" + --prefix="${{ github.workspace }}/prefix" --build-obj-dir="obj" --build-obj-dir-relative --build-config="${{ matrix.config }}" @@ -293,7 +384,7 @@ jobs: shell: bash run: | lcov --ignore-errors version,gcov,mismatch,mismatch --directory . --capture --output-file coverage.info - lcov --ignore-errors unused --remove coverage.info "${{ env.SRC_PATH }}/prefix/*" "${{ github.workspace }}/examples/*" "${{ github.workspace }}/test/*" --output-file coverage.info + lcov --ignore-errors unused --remove coverage.info "${{ github.workspace }}/prefix/*" "${{ github.workspace }}/libbitcoin-node/examples/*" "${{ github.workspace }}/libbitcoin-node/test/*" --output-file coverage.info - name: Coveralls.io upload if: ${{ matrix.coverage == 'lcov' }} @@ -303,6 +394,33 @@ jobs: files: "./coverage.info" github-token: ${{ secrets.github_token }} + - name: Test artifact collection + if: failure() + shell: bash + working-directory: ${{ github.workspace }} + run: | + if [[ -e "libbitcoin-system/obj/test.log" ]]; then + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.log" + fi + if [[ -e "libbitcoin-database/obj/test.log" ]]; then + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.log" + fi + if [[ -e "libbitcoin-network/obj/test.log" ]]; then + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.log" + fi + if [[ -e "libbitcoin-node/obj/test.log" ]]; then + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.log" + fi + + - name: Test artifact upload + if: failure() + uses: actions/upload-artifact@v7.0.1 + with: + name: testlogs + path: ${{ github.workspace }}/*test.log + retention-days: 1 + if-no-files-found: warn + presets: strategy: fail-fast: false @@ -348,14 +466,45 @@ jobs: CXXFLAGS: '${{ matrix.flags }}' steps: - - name: Checkout repository + - name: Get branch name + id: get-branch + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + else + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + + - name: Checkout repository [libbitcoin-system] uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-system' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-system - - name: Sources directory path assignment - shell: bash - run: | - cd .. - echo SRC_PATH="$(pwd)" >> $GITHUB_ENV + - name: Checkout repository [libbitcoin-database] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-database' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-database + + - name: Checkout repository [libbitcoin-network] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-network' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-network + + - name: Checkout repository [libbitcoin-node] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-node' + repository: ${{ github.repository }} - name: Prepare toolchain [linux] if: ${{ startsWith(matrix.image, 'ubuntu') }} @@ -380,15 +529,16 @@ jobs: shell: bash run: | if [[ "${{ matrix.preset }}" == *shared* ]]; then - echo "LDFLAGS=-Wl,-rpath,${{ env.SRC_PATH }}/prefix/lib" >> $GITHUB_ENV + echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi - name: Execute installation shell: bash + working-directory: 'libbitcoin-node' run: > ./builds/cmake/install-presets.sh --build-use-local-src - --build-src-dir="${{ env.SRC_PATH }}" + --build-src-dir="${{ github.workspace }}" --build-preset="${{ matrix.preset }}" ${{ matrix.boost }} ${{ matrix.secp256k1 }} @@ -399,7 +549,7 @@ jobs: shell: bash run: | lcov --ignore-errors version,gcov,mismatch,mismatch --directory . --capture --output-file coverage.info - lcov --ignore-errors unused --remove coverage.info "${{ env.SRC_PATH }}/prefix/*" "${{ github.workspace }}/examples/*" "${{ github.workspace }}/test/*" --output-file coverage.info + lcov --ignore-errors unused --remove coverage.info "${{ github.workspace }}/prefix/*" "${{ github.workspace }}/libbitcoin-node/examples/*" "${{ github.workspace }}/libbitcoin-node/test/*" --output-file coverage.info - name: Coveralls.io upload if: ${{ matrix.coverage == 'lcov' }} @@ -409,6 +559,33 @@ jobs: files: "./coverage.info" github-token: ${{ secrets.github_token }} + - name: Test artifact collection + if: failure() + shell: bash + working-directory: ${{ github.workspace }} + run: | + if [[ -e "libbitcoin-system/obj/test.log" ]]; then + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.log" + fi + if [[ -e "libbitcoin-database/obj/test.log" ]]; then + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.log" + fi + if [[ -e "libbitcoin-network/obj/test.log" ]]; then + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.log" + fi + if [[ -e "libbitcoin-node/obj/test.log" ]]; then + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.log" + fi + + - name: Test artifact upload + if: failure() + uses: actions/upload-artifact@v7.0.1 + with: + name: testlogs + path: ${{ github.workspace }}/*test.log + retention-days: 1 + if-no-files-found: warn + msvc: strategy: fail-fast: false @@ -430,19 +607,58 @@ jobs: runs-on: ${{ matrix.image }} steps: + - name: Get branch name + id: get-branch + shell: bash + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + else + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + - name: Set msbuild path uses: microsoft/setup-msbuild@v3 with: msbuild-architecture: x64 - - name: Checkout repository + - name: Checkout repository [libbitcoin-system] uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-system' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-system + + - name: Checkout repository [libbitcoin-database] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-database' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-database + + - name: Checkout repository [libbitcoin-network] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-network' + ref: ${{ steps.get-branch.outputs.branch_name }} + repository: ${{ github.repository_owner }}/libbitcoin-network + + - name: Checkout repository [libbitcoin-node] + uses: actions/checkout@v6 + with: + fetch-depth: 1 + path: 'libbitcoin-node' + repository: ${{ github.repository }} - name: Execute build shell: cmd + working-directory: 'libbitcoin-node' run: > .\builds\msvc\build-msvc.cmd - --build-src-dir "%RUNNER_WORKSPACE%" + --build-src-dir "${{ github.workspace }}" --build-config ${{ matrix.configuration }} --build-platform ${{ matrix.platform }} --build-version ${{ matrix.version }} @@ -450,9 +666,10 @@ jobs: - name: Execute tests shell: powershell + working-directory: 'libbitcoin-node' run: | Write-Host "Locating test executables..." -ForegroundColor Yellow; - $BC_TEST_EXES = @(Get-ChildItem -Path "$env:${{ github.workspace }}\bin" -recurse | Where-Object { $_.Name -eq "libbitcoin-node-test.exe" }); + $BC_TEST_EXES = @(Get-ChildItem -Path "bin" -recurse | Where-Object { $_.Name -eq "libbitcoin-node-test.exe" }); If ($BC_TEST_EXES.Count -ne 1) { Write-Host "Failure, invalid count of test executables." -ForegroundColor Red; exit 1; diff --git a/builds/cmake/install-cmake.sh b/builds/cmake/install-cmake.sh index 05ff5c33..44a3687f 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -625,15 +625,18 @@ test_make() # Test runners emit to the test.log file. if [[ -e "test.log" ]]; then + msg_warn "test.log - begin" cat "test.log" + msg_warn "test.log - end" fi - enable_exit_on_error - if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered error, please see test.log contents above." exit ${RESULT} fi + enable_exit_on_error + pop_directory # BUILD_OBJ_DIR pop_directory # BUILD_SRC_DIR/PROJECT diff --git a/builds/cmake/install-presets.sh b/builds/cmake/install-presets.sh index 8d657ca9..8d045ae0 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -646,15 +646,18 @@ test_make() # Test runners emit to the test.log file. if [[ -e "test.log" ]]; then + msg_warn "test.log - begin" cat "test.log" + msg_warn "test.log - end" fi - enable_exit_on_error - if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered error, please see test.log contents above." exit ${RESULT} fi + enable_exit_on_error + pop_directory # BUILD_OBJ_DIR pop_directory # BUILD_SRC_DIR/PROJECT diff --git a/builds/gnu/install-gnu.sh b/builds/gnu/install-gnu.sh index ff2f8d18..e5e856dc 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -614,15 +614,18 @@ test_make() # Test runners emit to the test.log file. if [[ -e "test.log" ]]; then + msg_warn "test.log - begin" cat "test.log" + msg_warn "test.log - end" fi - enable_exit_on_error - if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered error, please see test.log contents above." exit ${RESULT} fi + enable_exit_on_error + pop_directory # BUILD_OBJ_DIR pop_directory # BUILD_SRC_DIR/PROJECT From 3fb5b789b5b0f5e1187fd7afb2c7f27572cc9d36 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Fri, 17 Apr 2026 02:28:11 -0700 Subject: [PATCH 2/2] Scope coverage calculation. --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09fa689c..c39af553 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -177,6 +177,7 @@ jobs: - name: Coverage calculation if: ${{ matrix.coverage == 'lcov' }} shell: bash + working-directory: 'libbitcoin-node' run: | lcov --ignore-errors version,gcov,mismatch,mismatch --directory . --capture --output-file coverage.info lcov --ignore-errors unused --remove coverage.info "${{ github.workspace }}/prefix/*" "${{ github.workspace }}/libbitcoin-node/examples/*" "${{ github.workspace }}/libbitcoin-node/test/*" --output-file coverage.info @@ -186,7 +187,7 @@ jobs: uses: coverallsapp/github-action@v2.3.6 with: format: lcov - files: "./coverage.info" + files: "libbitcoin-node/coverage.info" github-token: ${{ secrets.github_token }} - name: Test artifact collection @@ -382,6 +383,7 @@ jobs: - name: Coverage calculation if: ${{ matrix.coverage == 'lcov' }} shell: bash + working-directory: 'libbitcoin-node' run: | lcov --ignore-errors version,gcov,mismatch,mismatch --directory . --capture --output-file coverage.info lcov --ignore-errors unused --remove coverage.info "${{ github.workspace }}/prefix/*" "${{ github.workspace }}/libbitcoin-node/examples/*" "${{ github.workspace }}/libbitcoin-node/test/*" --output-file coverage.info @@ -391,7 +393,7 @@ jobs: uses: coverallsapp/github-action@v2.3.6 with: format: lcov - files: "./coverage.info" + files: "libbitcoin-node/coverage.info" github-token: ${{ secrets.github_token }} - name: Test artifact collection @@ -547,6 +549,7 @@ jobs: - name: Coverage calculation if: ${{ matrix.coverage == 'lcov' }} shell: bash + working-directory: 'libbitcoin-node' run: | lcov --ignore-errors version,gcov,mismatch,mismatch --directory . --capture --output-file coverage.info lcov --ignore-errors unused --remove coverage.info "${{ github.workspace }}/prefix/*" "${{ github.workspace }}/libbitcoin-node/examples/*" "${{ github.workspace }}/libbitcoin-node/test/*" --output-file coverage.info @@ -556,7 +559,7 @@ jobs: uses: coverallsapp/github-action@v2.3.6 with: format: lcov - files: "./coverage.info" + files: "libbitcoin-node/coverage.info" github-token: ${{ secrets.github_token }} - name: Test artifact collection