From ae544cd679000ac98ff9494e1ddd47c23909b4b6 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 | 199 +++++++++++++++++++++++++++----- builds/cmake/install-cmake.sh | 7 +- builds/cmake/install-presets.sh | 7 +- builds/gnu/install-gnu.sh | 7 +- 4 files changed, 182 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 426f4724..ddf516fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,14 +92,29 @@ 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' + repository: ${{ github.repository }} - name: Prepare toolchain [linux] if: ${{ startsWith(matrix.image, 'ubuntu') }} @@ -124,16 +139,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-database' 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 +163,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-database/examples/*" "${{ github.workspace }}/libbitcoin-database/test/*" --output-file coverage.info - name: Coveralls.io upload if: ${{ matrix.coverage == 'lcov' }} @@ -157,6 +173,27 @@ 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 + + - 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 +275,29 @@ 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' + repository: ${{ github.repository }} - name: Prepare toolchain [linux] if: ${{ startsWith(matrix.image, 'ubuntu') }} @@ -270,16 +322,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-database' 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 +346,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-database/examples/*" "${{ github.workspace }}/libbitcoin-database/test/*" --output-file coverage.info - name: Coveralls.io upload if: ${{ matrix.coverage == 'lcov' }} @@ -303,6 +356,27 @@ 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 + + - 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 +422,29 @@ 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' + repository: ${{ github.repository }} - name: Prepare toolchain [linux] if: ${{ startsWith(matrix.image, 'ubuntu') }} @@ -380,15 +469,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-database' 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 +489,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-database/examples/*" "${{ github.workspace }}/libbitcoin-database/test/*" --output-file coverage.info - name: Coveralls.io upload if: ${{ matrix.coverage == 'lcov' }} @@ -409,6 +499,27 @@ 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 + + - 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 +541,42 @@ 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' + repository: ${{ github.repository }} - name: Execute build shell: cmd + working-directory: 'libbitcoin-database' 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 +584,10 @@ jobs: - name: Execute tests shell: powershell + working-directory: 'libbitcoin-database' run: | Write-Host "Locating test executables..." -ForegroundColor Yellow; - $BC_TEST_EXES = @(Get-ChildItem -Path "$env:${{ github.workspace }}\bin" -recurse | Where-Object { $_.Name -eq "libbitcoin-database-test.exe" }); + $BC_TEST_EXES = @(Get-ChildItem -Path "bin" -recurse | Where-Object { $_.Name -eq "libbitcoin-database-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 f25c03cf..3946d9bf 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -585,15 +585,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 60dc3f9b..86e93f46 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -606,15 +606,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 ad49cdbf..4fd3ae0a 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -571,15 +571,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 c9b1ec960a708e5c4aa5b2959e6b8e75c5507910 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 ddf516fa..23311233 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,6 +161,7 @@ jobs: - name: Coverage calculation if: ${{ matrix.coverage == 'lcov' }} shell: bash + working-directory: 'libbitcoin-database' 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-database/examples/*" "${{ github.workspace }}/libbitcoin-database/test/*" --output-file coverage.info @@ -170,7 +171,7 @@ jobs: uses: coverallsapp/github-action@v2.3.6 with: format: lcov - files: "./coverage.info" + files: "libbitcoin-database/coverage.info" github-token: ${{ secrets.github_token }} - name: Test artifact collection @@ -344,6 +345,7 @@ jobs: - name: Coverage calculation if: ${{ matrix.coverage == 'lcov' }} shell: bash + working-directory: 'libbitcoin-database' 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-database/examples/*" "${{ github.workspace }}/libbitcoin-database/test/*" --output-file coverage.info @@ -353,7 +355,7 @@ jobs: uses: coverallsapp/github-action@v2.3.6 with: format: lcov - files: "./coverage.info" + files: "libbitcoin-database/coverage.info" github-token: ${{ secrets.github_token }} - name: Test artifact collection @@ -487,6 +489,7 @@ jobs: - name: Coverage calculation if: ${{ matrix.coverage == 'lcov' }} shell: bash + working-directory: 'libbitcoin-database' 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-database/examples/*" "${{ github.workspace }}/libbitcoin-database/test/*" --output-file coverage.info @@ -496,7 +499,7 @@ jobs: uses: coverallsapp/github-action@v2.3.6 with: format: lcov - files: "./coverage.info" + files: "libbitcoin-database/coverage.info" github-token: ${{ secrets.github_token }} - name: Test artifact collection