Skip to content

CI: switch to using the gnuradio4 docker image #251

CI: switch to using the gnuradio4 docker image

CI: switch to using the gnuradio4 docker image #251

Workflow file for this run

name: CMake
on:
push:
branches: [ dev-prototype ]
pull_request:
branches: [ dev-prototype ]
release:
types: [ created ]
jobs:
build:
name: "${{ matrix.compiler.cc }} | ${{ matrix.cmake-build-type }}"
runs-on: "ubuntu-latest"
container:
image: "ghcr.io/fair-acc/gr4-build-container:latest"
strategy:
fail-fast: false
matrix:
compiler:
- cc: gcc-14
cxx: g++-14
- cc: clang-18
cxx: clang++-18
cmake_flags: "-DCMAKE_LINKER=/usr/bin/clang-18"
- cmake_wrapper: emcmake
cc: emcc
cmake_flags: "-DENABLE_COVERAGE=OFF -DCMAKE_CROSSCOMPILING_EMULATOR=${SYSTEM_NODE}"
cmake-build-type: [ Release, Debug ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v4
env:
cache-name: cache-fetchContent-cache
with:
path: "/__w/gr-digitizers/build/_deps"
key: "${{ matrix.compiler.cc }}-${{ matrix.cmake-build-type }}-${{ hashFiles('CMakeLists.txt') }}"
- name: "Install pkg-config"
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install build-essential
- name: "Install timing system dependencies: etherbone"
if: matrix.compiler.cmake_wrapper == null
shell: bash
run: |
sudo apt-get -y install build-essential autoconf automake libtool
git clone --branch v2.1.3 --depth=1 https://ohwr.org/project/etherbone-core.git
cd etherbone-core/api
touch ChangeLog # add an empty changelog file which is required by autotools
sed -e "s%AC_MSG_ERROR%AC_MSG_NOTICE%g" -i configure.ac
autoreconf -i
./configure
make -j
sudo make install
- name: "Install timing system dependencies: saftlib"
if: matrix.compiler.cmake_wrapper == null
shell: bash
run: |
sudo apt-get -y install libsigc++-2.0-dev libxslt1-dev libboost-all-dev
git clone --branch v3.0.3 --depth=1 https://github.com/GSI-CS-CO/saftlib.git
cd saftlib
./autogen.sh
./configure
make
sudo make install
- name: Install picoscope libraries
if: matrix.compiler.cmake_wrapper == null
run: |
# https://www.picotech.com/downloads/linux
wget -O - https://labs.picotech.com/Release.gpg.key|sudo apt-key add -
sudo add-apt-repository 'deb https://labs.picotech.com/rc/picoscope7/debian/ picoscope main'
sudo apt update
sudo apt install -y udev libusb-1.0-0-dev libps3000a libps4000a libps5000a libps6000 libps6000a libx11-dev libgl1-mesa-dev libsdl2-dev || true # ignore udev errors in post install because of udev in container
- name: Configure
if: matrix.compiler.cmake_wrapper == null
shell: bash
env:
CC: "${{ matrix.compiler.cc }}"
CXX: "${{ matrix.compiler.cxx }}"
CMAKE_EXPORT_COMPILE_COMMANDS: "ON"
run: |
cmake -S . -B ../build -DDISABLE_EXTERNAL_DEPS_WARNINGS=ON -DENABLE_PICOSCOPE=TRUE -DENABLE_TIMING=TRUE -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_COVERAGE=${{ matrix.configurations.compiler == 'gcc-14' && matrix.cmake-build-type == 'Debug'}} ${{ matrix.compiler.cmake_flags }}
- name: Configure CMake Emscripten
if: matrix.compiler.cmake_wrapper == 'emcmake'
shell: bash
run: |
export SYSTEM_NODE=`which node` # use system node instead of old version distributed with emsdk for threading support
$EMSDK_HOME/emsdk activate $EMSDK_VERSION
source $EMSDK_HOME/emsdk_env.sh
${{ matrix.compiler.cmake_wrapper }} cmake -S . -B ../build -DDISABLE_EXTERNAL_DEPS_WARNINGS=ON -DENABLE_PICOSCOPE=FALSE -DENABLE_TIMING=FALSE -DENABLE_COVERAGE=OFF -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} ${{ matrix.compiler.cmake_flags }}
- name: Build
if: matrix.compiler.cmake_wrapper == null
shell: bash
run: |
cmake --build ../build
- name: Build
if: matrix.compiler.cmake_wrapper == 'emcmake'
shell: bash
run: |
source $EMSDK_HOME/emsdk_env.sh
cmake --build ../build
- name: execute tests
if: matrix.compiler.cc != 'gcc-14' || matrix.cmake-build-type != 'Debug'
shell: bash
run: |
cd ../build
ctest --output-on-failure
- name: execute tests with coverage
if: matrix.compiler.cc == 'gcc-14' && matrix.cmake-build-type == 'Debug'
env:
DISABLE_SENSITIVE_TESTS: 1 # disables tests which are sensitive to execution speed and will not run with instrumented code
shell: bash
run: |
cd ../build
cmake --build . --target coverage
- name: Run sonar-scanner
if: matrix.compiler.cc == 'gcc-14' && matrix.cmake-build-type == 'Debug'
shell: bash
env:
SONAR_HOST_URL: https://sonarcloud.io
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner