Upgrade fmt #1083
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
release: | |
types: [ created ] | |
env: | |
REFERENCE_CONFIG: 'Ubuntu Latest gcc14' # configuration used for coverage etc | |
jobs: | |
build: | |
name: "${{ matrix.configurations.name }} | ${{ matrix.cmake-build-type }}" | |
environment: configure coverage | |
runs-on: ${{ matrix.configurations.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
configurations: | |
- name: Ubuntu Latest gcc14 | |
os: ubuntu-24.04 | |
compiler: gcc14 | |
- name: Ubuntu Latest clang18 | |
os: ubuntu-24.04 | |
compiler: clang18 | |
- name: ubuntu-22.04 emscripten | |
os: ubuntu-24.04 | |
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 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 100 | |
- name: Cache | |
uses: actions/cache@v3 | |
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 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/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/sonarcloud-github-c-cpp@v2 | |
- 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 | |
run: cmake -S . -B ../build -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_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_TESTING=ON -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: 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 -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' | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
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 |