Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 173 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand All @@ -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 }}"
Expand All @@ -145,18 +161,40 @@ 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 "${{ 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' }}
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
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
Expand Down Expand Up @@ -238,14 +276,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') }}
Expand All @@ -270,16 +323,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 }}"
Expand All @@ -291,18 +345,40 @@ 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 "${{ 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' }}
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
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
Expand Down Expand Up @@ -348,14 +424,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') }}
Expand All @@ -380,15 +471,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 }}
Expand All @@ -397,18 +489,40 @@ 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 "${{ 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' }}
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
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
Expand All @@ -430,29 +544,53 @@ 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 }}
--build-use-local-src

- 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;
Expand Down
7 changes: 5 additions & 2 deletions builds/cmake/install-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions builds/cmake/install-presets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading