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
96 changes: 48 additions & 48 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,44 @@ on:
types: [ created ]

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

jobs:
buildKeycloakDockerImage:
uses: ./.github/workflows/build_keycloak_docker.yml
permissions:
contents: read
packages: write

build:
needs: buildKeycloakDockerImage
name: "${{ matrix.configurations.name }} | ${{ matrix.cmake-build-type }}"
environment: configure coverage
runs-on: ${{ matrix.configurations.os }}
runs-on: "ubuntu-latest"
container: "ghcr.io/fair-acc/gr4-build-container:latest"
strategy:
fail-fast: false
matrix:
configurations:
- name: Ubuntu gcc14
os: ubuntu-24.04
- name: gcc14
compiler: gcc14
- name: Ubuntu clang18
os: ubuntu-24.04
compiler: clang18
- name: ubuntu-22.04 emscripten
os: ubuntu-24.04
cc: gcc-14
cxx: g++-14
- name: clang20
compiler: clang20
cc: clang-20
cxx: clang++-20
- name: emscripten
compiler: emscripten
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
cmake-build-type: [ Release, Debug ]
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
services:
keycloak:
image: ${{ needs.buildKeycloakDockerImage.outputs.image }}
env:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin

steps:
- uses: actions/checkout@v6
Expand All @@ -46,56 +60,26 @@ jobs:
path: ${{runner.workspace}}/build/_deps
key: ${{ runner.os }}-${{ matrix.configurations.compiler }}-${{ matrix.cmake-build-type }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Dependencies.cmake') }}

- name: Install gcovr
shell: bash
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
run: sudo apt-get install -y gcovr

- name: Install gcc-14
if: matrix.configurations.compiler == 'gcc14'
run: |
sudo apt-get install -y gcc-14 g++-14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 110 --slave /usr/bin/g++ g++ /usr/bin/g++-14 --slave /usr/bin/gcov gcov /usr/bin/gcov-14

- name: Install clang-18
if: matrix.configurations.compiler == 'clang18'
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt update
sudo apt upgrade -y
sudo apt install -y clang-18 libc++-18-dev libc++abi-18-dev
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-18 110
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-18 110

- name: Install emscripten
if: matrix.configurations.compiler == 'emscripten'
run: |
cd
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
# Download and install emscripten.
./emsdk install 3.1.59
# Make "active" for the current user. (writes .emscripten file)
./emsdk activate 3.1.59

- name: Install sonar-scanner and build-wrapper
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v7

- name: Configure CMake
if: matrix.configurations.compiler != 'emscripten'
# Use a bash shell, so we can use the same syntax for environment variable access regardless of the host operating system
shell: bash
env:
CC: "${{ matrix.configurations.cc }}"
CXX: "${{ matrix.configurations.cxx }}"
CMAKE_EXPORT_COMPILE_COMMANDS: "ON"
run: cmake -S . -B ../build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DOPENCMW_ENABLE_COVERAGE=${{ matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug' }}

- name: Configure CMake Emscripten
if: matrix.configurations.compiler == 'emscripten'
# Use a bash shell, so we can use the same syntax for environment variable access regardless of the host operating system
shell: bash
run: |
export SYSTEM_NODE=`which node` # use system node instead of old version distributed with emsdk for threading support
source ~/emsdk/emsdk_env.sh
emcmake cmake -S . -B ../build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_TESTING=ON -DCMAKE_CROSSCOMPILING_EMULATOR=${SYSTEM_NODE}
source $EMSDK_HOME/emsdk_env.sh
emcmake cmake -S . -B ../build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DCMAKE_CROSSCOMPILING_EMULATOR=${SYSTEM_NODE}

- name: Build
if: matrix.configurations.name != env.REFERENCE_CONFIG || matrix.cmake-build-type != 'Debug'
Expand All @@ -107,14 +91,27 @@ jobs:
shell: bash
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ../build --config ${{ matrix.cmake-build-type }}

- name: Run Keycloak Docker
- name: Setup Keycloak
if: matrix.configurations.compiler != 'emscripten'
shell: bash
run: docker run -p 8090:8080 -d -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.0.5 start-dev && src/client/test/setup-keycloak.sh
env:
KEYCLOAK_URL: http://keycloak:8080
KEYCLOAK_REDIRECT_URI: http://localhost:8091
KEYCLOAK_ADMIN_PASSWORD: admin
run: |
if ! command -v jq >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y --no-install-recommends jq
fi
src/client/test/setup-keycloak.sh

- name: Run tests
if: matrix.configurations.name != env.REFERENCE_CONFIG || matrix.cmake-build-type != 'Debug'
working-directory: ${{runner.workspace}}/build
shell: bash
env:
KEYCLOAK_URL: http://keycloak:8080
KEYCLOAK_REDIRECT_URI: http://localhost:8091
# Execute tests defined by the CMake configuration. The coverage target runs the autodiscovered catch2 tests using
# ctest and records the coverage using gcov
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
Expand All @@ -124,6 +121,9 @@ jobs:
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
working-directory: ${{runner.workspace}}/build
shell: bash
env:
KEYCLOAK_URL: http://keycloak:8080
KEYCLOAK_REDIRECT_URI: http://localhost:8091
# Execute tests defined by the CMake configuration. The coverage target runs the autodiscovered catch2 tests using
# ctest and records the coverage using gcov
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/build_keycloak_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This workflow builds and publishes a tiny Keycloak “wrapper” image that defaults to `kc.sh start-dev`.
# GitHub Actions service containers cannot pass command arguments (like `start-dev`) to the upstream Keycloak image.
# The image is rebuilt/pushed only when `docker/keycloak/Dockerfile` changes, otherwise CI reuses the existing tag.

name: Build Keycloak Docker Image

on:
workflow_call:
outputs:
image:
description: "Keycloak wrapper image tag"
value: ${{ jobs.build.outputs.image }}

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.docker-label.outputs.label }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if Keycloak Dockerfile was modified
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
docker:
- 'docker/keycloak/Dockerfile'

- name: Set up Docker Label
id: docker-label
shell: bash
run: |
if [ ${{ steps.changes.outputs.docker == 'true' && github.event_name != 'push' }} = "true" ]; then
echo "label=ghcr.io/fair-acc/keycloak-start-dev:${GITHUB_HEAD_REF/\//-}" >> "$GITHUB_OUTPUT"
else
echo "label=ghcr.io/fair-acc/keycloak-start-dev:latest" >> "$GITHUB_OUTPUT"
fi

- name: Set up Docker Buildx
if: steps.changes.outputs.docker == 'true'
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
if: steps.changes.outputs.docker == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & push Keycloak wrapper image
if: steps.changes.outputs.docker == 'true'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:docker/keycloak"
push: true
tags: ${{ steps.docker-label.outputs.label }}
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ elseif(EMSCRIPTEN)
OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0.0)
message(FATAL_ERROR "Clang>=14.0.0 required for emscripten, but clang ${CMAKE_CXX_COMPILER_VERSION} detected.")
endif()
message("You are building with Emscripten Clang. Be advised that support is limited to working in conjunction with"
message(STATUS "You are building with Emscripten Clang. Be advised that support is limited to working in conjunction with"
" libc++ and certain modules. libc++ has been enabled.")
set(CMAKE_EXECUTABLE_SUFFIX ".js")
add_compile_options(
Expand Down Expand Up @@ -134,7 +134,7 @@ endif()

if(OPENCMW_ENABLE_TESTING)
enable_testing()
message("Building Tests.")
message(STATUS "Building Tests.")
if(OPENCMW_ENABLE_COVERAGE)
if(UNIX
AND NOT APPLE
Expand All @@ -143,7 +143,7 @@ if(OPENCMW_ENABLE_TESTING)
MATCHES
".*Clang"
AND NOT EMSCRIPTEN) # Linux
message("Coverage reporting enabled")
message(STATUS "Coverage reporting enabled")
include(cmake/CodeCoverage.cmake) # https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake #
# (License: BSL-1.0)
target_compile_options(
Expand Down Expand Up @@ -190,6 +190,6 @@ endif()
add_subdirectory(src)

if(OPENCMW_ENABLE_CONCEPTS)
message("Building Concepts")
message(STATUS "Building Concepts")
add_subdirectory(concepts)
endif()
Loading