Skip to content

Commit

Permalink
CI: switch to using the gnuradio4 docker image
Browse files Browse the repository at this point in the history
gr-digitizers specific dependencies are still installed in the CI
workflow for now to not have to deal with keeping multiple docker image
layers up to date consistently.
  • Loading branch information
wirew0rm committed Apr 25, 2024
1 parent 417f997 commit 73487ab
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 90 deletions.
139 changes: 55 additions & 84 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,88 +8,50 @@ on:
release:
types: [ created ]

env:
REFERENCE_CONFIG: 'Ubuntu gcc13' # configuration used for coverage etc

jobs:
build:
name: "${{ matrix.configurations.name }} | ${{ matrix.cmake-build-type }}"
environment: configure coverage
runs-on: ${{ matrix.configurations.os }}
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:
configurations:
- name: Ubuntu gcc13
os: ubuntu-22.04
compiler: gcc13
- name: Ubuntu Latest clang17
os: ubuntu-22.04
compiler: clang17
- name: Ubuntu Latest emscripten
os: ubuntu-22.04
compiler: emscripten
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_PICOSCOPE=FALSE -DENABLE_TIMING=FALSE -DENABLE_COVERAGE=OFF -DCMAKE_CROSSCOMPILING_EMULATOR=${SYSTEM_NODE}"
cmake-build-type: [ Release, Debug ]
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-fetchContent-cache
with:
path: ${{runner.workspace}}/build/_deps
key: ${{ runner.os }}-${{ matrix.configurations.compiler }}-${{ matrix.cmake-build-type }}-${{ hashFiles('CMakeLists.txt') }}

- name: Install gcovr
# packaged gcovr is too old for gcc13
shell: bash
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
run: |
python3 -m pip install gcovr --user --no-warn-script-location
gcovr --version
- name: Install gcc-13
if: matrix.configurations.compiler == 'gcc13'
run: |
sudo apt-get install -y gcc-13 g++-13 # gcovr # packaged gcovr is too old for gcc13
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 110 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13
- name: Install clang-17
if: matrix.configurations.compiler == 'clang17'
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
sudo apt update
sudo apt upgrade -y # update clang14 to fix packaging conflicts
sudo apt install -y clang-17 libc++-17-dev libc++abi-17-dev
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-17 110
path: "/__w/gr-digitizers/build/_deps"
key: "${{ matrix.compiler.cc }}-${{ matrix.cmake-build-type }}-${{ hashFiles('CMakeLists.txt') }}"

- name: Install emscripten
if: matrix.configurations.compiler == 'emscripten'
- name: "Install pkg-config"
shell: bash
run: |
cd
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
cd emsdk
# Download and install the latest SDK tools.
./emsdk install releases-bf3c159888633d232c0507f4c76cc156a43c32dc-64bit
# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate releases-bf3c159888633d232c0507f4c76cc156a43c32dc-64bit
- name: Install sonar-scanner and build-wrapper
if: matrix.configurations.compiler == 'gcc13' && matrix.cmake-build-type == 'Debug'
uses: SonarSource/sonarcloud-github-c-cpp@v2
sudo apt-get update
sudo apt-get -y install build-essential pkg-config
- name: "Install timing system dependencies: etherbone"
if: matrix.configurations.compiler != 'emscripten'
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
Expand All @@ -100,7 +62,7 @@ jobs:
sudo make install
- name: "Install timing system dependencies: saftlib"
if: matrix.configurations.compiler != 'emscripten'
if: matrix.compiler.cmake_wrapper == null
shell: bash
run: |
sudo apt-get -y install libsigc++-2.0-dev libxslt1-dev libboost-all-dev
Expand All @@ -112,58 +74,67 @@ jobs:
sudo make install
- name: Install picoscope libraries
if: matrix.configurations.compiler != 'emscripten'
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 CMake
if: matrix.configurations.compiler != 'emscripten'
- 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 -DENABLE_PICOSCOPE=TRUE -DENABLE_TIMING=TRUE -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_COVERAGE=${{ matrix.configurations.compiler == 'gcc13' && matrix.cmake-build-type == 'Debug'}}
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.compiler.cc == 'gcc-14' && matrix.cmake-build-type == 'Debug'}} ${{ matrix.compiler.cmake_flags }}
- name: Configure CMake Emscripten
if: matrix.configurations.compiler == 'emscripten'
if: matrix.compiler.cmake_wrapper == 'emcmake'
shell: bash
run: |
source ~/emsdk/emsdk_env.sh
emcmake cmake -S . -B ../build -DENABLE_PICOSCOPE=FALSE -DENABLE_TIMING=FALSE -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_COVERAGE=OFF
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 -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} ${{ matrix.compiler.cmake_flags }}
- name: Build
if: matrix.configurations.compiler != 'gcc13' || matrix.cmake-build-type != 'Debug'
if: matrix.compiler.cmake_wrapper == null
shell: bash
run: |
test -f ~/emsdk/emsdk_env.sh && source ~/emsdk/emsdk_env.sh
cmake --build ../build
- name: Build with Coverage and SonarCube
if: matrix.configurations.compiler == 'gcc13' && matrix.cmake-build-type == 'Debug'
- name: Build
if: matrix.compiler.cmake_wrapper == 'emcmake'
shell: bash
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ../build
run: |
source $EMSDK_HOME/emsdk_env.sh
cmake --build ../build
- name: execute tests
if: matrix.configurations.compiler != 'gcc13' || matrix.cmake-build-type != 'Debug'
working-directory: ${{runner.workspace}}/build
if: matrix.compiler.cc != 'gcc-14' || matrix.cmake-build-type != 'Debug'
shell: bash
run: ctest --output-on-failure
run: |
cd ../build
ctest --output-on-failure
- name: execute tests with coverage
if: matrix.configurations.compiler == 'gcc13' && matrix.cmake-build-type == 'Debug'
working-directory: ${{runner.workspace}}/build
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: cmake --build . --target coverage
run: |
cd ../build
cmake --build . --target coverage
- name: Run sonar-scanner
if: matrix.configurations.compiler == 'gcc13' && matrix.cmake-build-type == 'Debug'
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: |
test -f ~/emsdk/emsdk_env.sh && source ~/emsdk/emsdk_env.sh
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
run: sonar-scanner
23 changes: 18 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(ENABLE_TESTING OFF)
FetchContent_Declare(
graph-prototype
GIT_REPOSITORY https://github.com/fair-acc/graph-prototype.git
GIT_TAG 3cb5c2aff7046bc3760ccd8f8b701cbde361ecfd # main as of 2024-04-05
GIT_TAG 5e15e8478d267a5e74fdd3b310a7483a690fe1b4 # main as of 2024-04-25
)

FetchContent_Declare(
Expand All @@ -38,8 +38,25 @@ FetchContent_Declare(
GIT_TAG v2.0.1 # latest tag as of 2023-12-19
)

add_library(gr-digitizers-options INTERFACE)
include(cmake/CompilerWarnings.cmake)
set_project_warnings(gr-digitizers-options)

if (EMSCRIPTEN)
FetchContent_MakeAvailable(graph-prototype ut)
set(CMAKE_EXECUTABLE_SUFFIX ".js")
target_compile_options(gr-digitizers-options INTERFACE
-fwasm-exceptions
-pthread
)
target_link_options(gr-digitizers-options INTERFACE
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
-fwasm-exceptions
-pthread
"SHELL:-s PTHREAD_POOL_SIZE=30"
"SHELL:-s FETCH=1"
"SHELL:-s ASSERTIONS=1"
)
else ()
if (GR_DIGITIZERS_TOPLEVEL_PROJECT)
FetchContent_Declare(
Expand Down Expand Up @@ -92,10 +109,6 @@ else ()
endif ()
endif ()

add_library(gr-digitizers-options INTERFACE)
include(cmake/CompilerWarnings.cmake)
set_project_warnings(gr-digitizers-options)

if(CMAKE_CXX_COMPILER MATCHES "/em\\+\\+(-[a-zA-Z0-9.])?$") # if this hasn't been set before via e.g. emcmake
message(" Transpiling to WASM: using: Emscripten (${CMAKE_CXX_COMPILER})")
set(EMSCRIPTEN true)
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ sonar.cfamily.cpp23.enabled=true

# exclude benchmark which crashes the Analysis
#sonar.exclusions=bench/bm_case1.cpp
sonar.coverageReportPaths=/home/runner/work/gr-digitizers/build/coverage.xml
sonar.coverageReportPaths=/__w/gr-digitizers/build/coverage.xml

0 comments on commit 73487ab

Please sign in to comment.