diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b75142c5..c39af553 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 }}" @@ -145,18 +177,46 @@ 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 "${{ 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' }} 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 + 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 +298,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 +361,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 }}" @@ -291,18 +383,46 @@ 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 "${{ 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' }} 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 + 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 +468,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 +531,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 }} @@ -397,18 +549,46 @@ 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 "${{ 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' }} 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 + 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 +610,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 +669,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