Skip to content

Fix cmake build scripts (#22) #124

Fix cmake build scripts (#22)

Fix cmake build scripts (#22) #124

Workflow file for this run

name: coverage
on: [push, pull_request]
env:
BUILD_TYPE: Debug
jobs:
codecov:
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
compiler:
- { pkg: clang, exe: 'clang++', version: 18 }
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: pip install -U Jinja2
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.26.1
ninjaVersion: 1.11.1
- name: Install Clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{matrix.compiler.version}} main"
sudo apt update
sudo apt install -y llvm-${{matrix.compiler.version}} ${{matrix.compiler.pkg}}-${{matrix.compiler.version}} libc++-dev libc++abi-dev
- name: Install dependencies
run: |
sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev wayland-protocols libwayland-dev libxkbcommon-dev
sudo apt install libgl-dev
- name: Configure
env:
CC: ${{matrix.compiler.pkg}}-${{matrix.compiler.version}}
CXX: ${{matrix.compiler.exe}}-${{matrix.compiler.version}}
run: cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DFLUX_GRAPHICS_API=OpenGL -DFLUX_ENABLE_COVERAGE=ON -B ${{github.workspace}}/build/${{matrix.os}}-${{env.BUILD_TYPE}} -G Ninja
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build/${{matrix.os}}-${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}}
- name: Run tests
working-directory: ${{github.workspace}}/build/${{matrix.os}}-${{env.BUILD_TYPE}}
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --timeout 30 -C Debug -j4
- name: Index the raw profile
working-directory: ${{github.workspace}}/build/${{matrix.os}}-${{env.BUILD_TYPE}}
run: |
llvm-profdata-${{matrix.compiler.version}} merge --output=coverage.profdata */default.profraw
- name: Create a line-oriented coverage report
working-directory: ${{github.workspace}}/build/${{matrix.os}}-${{env.BUILD_TYPE}}
run: |
object_files=$(find ./flux-*/ -type f -executable -not -path "./flux-playground/*")
object_list=("$object_files")
objects=$(for object in ${object_list}; do echo "-object=${object} "; done)
echo "$objects"
llvm-cov-${{matrix.compiler.version}} export -format=lcov -instr-profile=coverage.profdata ${objects} > coverage.lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
directory: ${{github.workspace}}/build/${{matrix.os}}-${{env.BUILD_TYPE}}
token: ${{secrets.CODECOV_TOKEN}}
files: ./coverage.lcov
flags: codecov
name: flux
fail_ci_if_error: true
verbose: true