Skip to content

use system OpenSSL and Docker #1268

use system OpenSSL and Docker

use system OpenSSL and Docker #1268

Workflow file for this run

name: CMake
on:
push:
branches: [ main ]
pull_request:
release:
types: [ created ]
env:
REFERENCE_CONFIG: 'gcc14' # configuration used for coverage etc
jobs:
buildKeycloakDockerImage:
uses: ./.github/workflows/build_keycloak_wrapper.yml
permissions:
contents: read
packages: write
build:
needs: buildKeycloakDockerImage
name: "${{ matrix.configurations.name }} | ${{ matrix.cmake-build-type }}"
environment: configure coverage
runs-on: "ubuntu-latest"
container: "ghcr.io/fair-acc/gr4-build-container:latest"
strategy:
fail-fast: false
matrix:
configurations:
- name: gcc14
compiler: gcc14
cc: gcc-14
cxx: g++-14
- name: clang20
compiler: clang20
cc: clang-20
cxx: clang++-20
- name: emscripten
compiler: emscripten
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
with:
fetch-depth: 100
- name: Cache
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') }}-${{ hashFiles('cmake/Dependencies.cmake') }}
- 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'
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'
shell: bash
run: |
export SYSTEM_NODE=`which node` # use system node instead of old version distributed with emsdk for threading support
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'
shell: bash
run: cmake --build ../build --config ${{ matrix.cmake-build-type }}
- name: Build with Coverage and SonarCube
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
shell: bash
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ../build --config ${{ matrix.cmake-build-type }}
- name: Setup Keycloak
if: matrix.configurations.compiler != 'emscripten'
shell: bash
env:
KEYCLOAK_URL: http://keycloak:8080
KEYCLOAK_REDIRECT_URI: http://localhost:8091
KEYCLOAK_ADMIN_PASSWORD: admin
run: |
set -euo pipefail
if ! command -v jq >/dev/null 2>&1; then
apt-get update
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
# 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
run: ctest --output-on-failure -C ${{ matrix.cmake-build-type }}
- name: Run tests with coverage
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
working-directory: ${{runner.workspace}}/build
shell: bash
# 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
run: cmake --build . --config ${{ matrix.cmake-build-type }} --target coverage
- uses: codecov/codecov-action@v3
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
with:
files: ${{runner.workspace}}/build/coverage.xml
- name: coverage report - send to Codacy
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
working-directory: ${{ runner.workspace }}/build
shell: bash
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml --skip --project-token ${{ secrets.CODACY_PROJECT_TOKEN }}
- name: Run sonar-scanner
if: matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Debug'
uses: SonarSource/sonarqube-scan-action@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
--define "sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
- name: Upload test utility for opencmw-java CI
if: ((github.ref_name == 'main' && github.event_name == 'push') || (github.head_ref == 'testCI' && github.event_name == 'pull_request')) && matrix.configurations.name == env.REFERENCE_CONFIG && matrix.cmake-build-type == 'Release'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete compatiblity-test-util --repo ${{ github.repository }} -y || true
gh release create compatiblity-test-util --notes "A small test binary that can be used in the java implementation's unit tests to test against" --repo ${{ github.repository }}
gh release upload compatiblity-test-util ../build/concepts/majordomo/CompatibilityTest --repo ${{ github.repository }}