Skip to content

Spatial join bounding box #4902

Spatial join bounding box

Spatial join bounding box #4902

Workflow file for this run

# Measure the code coverage of QLever's unit tests using LLVMs source
# instrumentation. When this workflow runs for the master branch, the
# coverage report is directly uploaded to Codecov.io. When this workflow
# runs for a pull request, the coverage report is stored as a GitHub artifact
# and a separate workflow from `upload-coverage.yml` is triggered that uploads
# the coverage report. That way the uploader has access to the Codecov token
# in all cases and the upload should never fail.
# The following name has to be the same as in the `workflows:` key in
# `upload-coverage.yml`, otherwise the uploader won't pick up the result
# of this workflow.
name: measure-code-coverage
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
merge_group:
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
env:
compiler: clang
compiler-version: 16
build-type: Debug
warnings: "-Wall -Wextra "
# we disable the `assert()` macro as it messes with the coverage reports
asan-flags: "-DNDEBUG"
ubsan-flags: ""
coverage-flags: "-fprofile-instr-generate -fcoverage-mapping"
cmake-flags: "-DCMAKE_C_COMPILER=clang-16 -DCMAKE_CXX_COMPILER=clang++-16"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install dependencies
uses: ./.github/workflows/install-dependencies-ubuntu
- name: Install compiler
uses: ./.github/workflows/install-compiler-ubuntu
with:
compiler: "clang"
compiler-version: "16"
- name: Install coverage tools
run: |
sudo apt install -y llvm-16
- name: Show path
run: |
which llvm-profdata-16
which llvm-cov-16
- name: Create build directory
run: mkdir ${{github.workspace}}/build
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build ${{env.cmake-flags}} -DCMAKE_BUILD_TYPE=${{env.build-type}} -DLOGLEVEL=TIMING -DADDITIONAL_COMPILER_FLAGS="${{env.warnings}} ${{env.asan-flags}} ${{env.ubsan-flags}} ${{env.coverage-flags}}" -DADDITIONAL_LINKER_FLAGS="${{env.coverage-flags}}" -DUSE_PARALLEL=false -DRUN_EXPENSIVE_TESTS=false -DSINGLE_TEST_BINARY=ON -DENABLE_EXPENSIVE_CHECKS=true
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.build-type}} -- -j $(nproc)
- name: Run unit tests
working-directory: ${{github.workspace}}/build/test
env:
LLVM_PROFILE_FILE: "default%p.profraw"
# We have to manually run the test executable to only get a single `.profraw` file.
# Otherwise, the GitHub runner goes out of memory.
run: env ASAN_OPTIONS="alloc_dealloc_mismatch=0" ./QLeverAllUnitTestsMain
- name: Process coverage info
working-directory: ${{github.workspace}}/build/test
run: >
llvm-profdata-16 merge -sparse *.profraw -o default.profdata;
llvm-cov-16 export ./QLeverAllUnitTestsMain --dump --format=lcov --instr-profile ./default.profdata --ignore-filename-regex="/third_party/" --ignore-filename-regex="/generated/" --ignore-filename-regex="/nlohmann/" --ignore-filename-regex="/ctre/" --ignore-filename-regex="/test/" --ignore-filename-regex="/benchmark/" > ./coverage.lcov
# Only upload the coverage directly if this is not a pull request. In this
# case we are on the master branch and have access to the Codecov token.
- name: "Submit coverage data to codecov.io"
if: github.event_name != 'pull_request'
uses: codecov/codecov-action@v4
with:
file: ${{github.workspace}}/build/test/coverage.lcov
# Note: technically, a `token` is not required for codecov.io when
# uploading from a public repository, but specifying it avoids the
# nasty spurious failures due to GitHub's rate limit for codecov's
# public default token.
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
# For a pull request we store the coverage file as well as some information
# about this PR (number, how to check it out, etc.) and upload it as an artifact.
# This is all the data that is required for running the Codecov uploader manually
# from `upload-coverage.yml`.
- name: Save PR number and coverage file in same directory
if: github.event_name == 'pull_request'
# Note: If you change any of the filenames here, you also have to change them in `upload-coverage.yml`
run : |
mkdir -p coverage-report
echo ${{ github.event.number }} > ./coverage-report/pr
echo ${{ github.repository }} > ./coverage-report/github_repository
echo ${GITHUB_REF} > ./coverage-report/github_ref
mv ${{ github.workspace}}/build/test/coverage.lcov coverage-report
- name: Upload coverage artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-report/
# Note: for now we do not run the e2e tests for the coverage check