Skip to content

Commit

Permalink
Add support for CMake presets (#603)
Browse files Browse the repository at this point in the history
* Use CMake presets

Signed-off-by: Uilian Ries <[email protected]>

* Build debug

Signed-off-by: Uilian Ries <[email protected]>

* Add msvc toolset

Signed-off-by: Uilian Ries <[email protected]>

* remove explicit cl.exe

Signed-off-by: Uilian Ries <[email protected]>

* Use msvc generator

Signed-off-by: Uilian Ries <[email protected]>

* configure cl in path

Signed-off-by: Uilian Ries <[email protected]>

* fix preset name

Signed-off-by: Uilian Ries <[email protected]>

* fix preset name

Signed-off-by: Uilian Ries <[email protected]>

---------

Signed-off-by: Uilian Ries <[email protected]>
  • Loading branch information
uilianries authored May 28, 2024
1 parent f4394ed commit 3aa05ba
Show file tree
Hide file tree
Showing 6 changed files with 261 additions and 90 deletions.
25 changes: 7 additions & 18 deletions .github/workflows/linux-clang-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
workflow_dispatch:
pull_request:

env:
BUILD_TYPE: Debug

jobs:
build:
runs-on: ubuntu-24.04
Expand All @@ -20,33 +17,25 @@ jobs:
with:
submodules: recursive

- name: Install apt-get dependencies
run: |
sudo apt -qq update \
&& sudo apt install -y --no-install-recommends --no-install-suggests ninja-build
- name: Initialize submodules
run: git submodule update --init --recursive
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Configure CMake
run: |
cmake -S ${{github.workspace}} -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
cmake -S ${{github.workspace}} --preset=unixlike-clang-debug \
-DCMAKE_C_COMPILER=/usr/bin/clang-18 \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++-18 \
-DCODE_COVERAGE:BOOL=ON \
-DBUILD_TESTING:BOOL=ON \
-GNinja
-DBUILD_TESTING:BOOL=ON
- name: Build
run: cmake --build ${{github.workspace}}/build
run: cmake --build --preset=unixlike-clang-debug

- name: Test
working-directory: ${{github.workspace}}/build/tests
run: ctest --output-on-failure
run: ctest --preset=unixlike-clang-debug

- name: Generate code coverage
working-directory: ${{github.workspace}}/build
working-directory: ${{github.workspace}}/build/unixlike-clang-debug
run: |
ninja faker-ccov-all \
&& llvm-cov-18 show `cat ccov/binaries.list` -instr-profile=ccov/all-merged.profdata > coverage.txt
Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/linux-gcc-12.yml

This file was deleted.

30 changes: 21 additions & 9 deletions .github/workflows/linux-gxx-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,33 @@ on:
workflow_dispatch:
pull_request:

env:
BUILD_TYPE: Debug

jobs:
build:
runs-on: ubuntu-latest

name: ci-ubuntu-24.04-gcc-${{ matrix.gcc_version }}
runs-on: ubuntu-24.04
strategy:
matrix:
gcc_version:
- 12
- 13
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Build docker image
run: docker build -t test .
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Configure CMake
run: |
cmake -S . --preset=unixlike-gcc-debug \
-DCMAKE_C_COMPILER=gcc-${{ matrix.gcc_version }} \
-DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc_version }} \
-DBUILD_TESTING:BOOL=ON
- name: Build
run: cmake --build --preset=unixlike-gcc-debug

- name: Run docker container
run: docker run test
- name: Test
run: ctest --preset=unixlike-gcc-debug
14 changes: 7 additions & 7 deletions .github/workflows/macos-clang-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
workflow_dispatch:
pull_request:

env:
BUILD_TYPE: Debug

jobs:
build:
Expand All @@ -23,15 +21,17 @@ jobs:
with:
submodules: recursive

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
cmake -S . --preset=unixlike-clang-debug \
-DBUILD_TESTING:BOOL=ON \
-DCMAKE_CXX_COMPILER=clang++
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build --preset=unixlike-clang-debug

- working-directory: build/tests
run: ./faker-cxx-UT
- name: Test
run: ctest --preset=unixlike-clang-debug
22 changes: 12 additions & 10 deletions .github/workflows/windows-msvc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
workflow_dispatch:
pull_request:

env:
BUILD_TYPE: Debug

jobs:
build:
runs-on: windows-latest
Expand All @@ -20,13 +17,18 @@ jobs:
with:
submodules: recursive

- run: cmake -E make_directory build
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Configure cl.exe in PATH
uses: ilammy/msvc-dev-cmd@v1

- working-directory: build/
run: cmake .. -G "Visual Studio 17 2022" -DBUILD_TESTING:BOOL=ON
- name: Configure CMake
run: |
cmake -S . --preset=windows-msvc-debug -DBUILD_TESTING:BOOL=ON
- working-directory: build/
run: cmake --build . --config ${{env.BUILD_TYPE}}
- name: Build
run: cmake --build --preset=windows-msvc-debug

- working-directory: build/tests
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Test
run: ctest --preset=windows-msvc-debug
Loading

0 comments on commit 3aa05ba

Please sign in to comment.