Skip to content

Commit 67d6019

Browse files
authored
omg cmake.yml
1 parent 8288bad commit 67d6019

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

.github/workflows/cmake.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ jobs:
2222
- name: Check formatting
2323
run: |
2424
git fetch --depth=1 origin master
25-
clang-format -style=file -output-replacements-xml $(git ls-files '*.cpp' '*.h' '*.ixx' '*.hpp') | grep "<replacement " && echo "Code is not properly formatted" && exit 1 || echo "All good"
25+
FILES=$(git ls-files '*.cpp' '*.hpp' '*.h' '*.ixx')
26+
if [ -n "$FILES" ]; then
27+
clang-format -style=file -output-replacements-xml $FILES | grep "<replacement " >/dev/null \
28+
&& { echo "Code is not properly formatted"; exit 1; } \
29+
|| echo "All good"
30+
else
31+
echo "No files to format"
32+
fi
2633
2734
build:
2835
name: Build project
@@ -52,27 +59,33 @@ jobs:
5259
sudo apt-get update
5360
if [ "${{ matrix.compiler }}" == "clang" ]; then
5461
sudo apt-get install -y clang
55-
elif [ "${{ matrix.compiler }}" == "gcc" ]; then
56-
sudo apt-get install -y g++
5762
fi
5863
shell: bash
5964

60-
- name: Configure CMake
65+
- name: Configure (Ubuntu + clang)
66+
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang'
6167
run: |
6268
mkdir build
6369
cd build
64-
GENERATOR="-G Ninja"
65-
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
66-
if [ "${{ matrix.compiler }}" == "clang" ]; then
67-
cmake $GENERATOR -DCMAKE_CXX_COMPILER=clang++ ..
68-
elif [ "${{ matrix.compiler }}" == "gcc" ]; then
69-
cmake $GENERATOR -DCMAKE_CXX_COMPILER=g++ ..
70-
fi
71-
else
72-
cmake $GENERATOR ..
73-
fi
70+
cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++ ..
7471
shell: bash
7572

73+
- name: Configure (Windows + msvc)
74+
if: matrix.os == 'windows-latest' && matrix.compiler == 'msvc'
75+
run: |
76+
mkdir build
77+
cd build
78+
cmake -G "Visual Studio 17 2022" -A x64 ..
79+
shell: pwsh
80+
81+
- name: Configure (Windows + clang)
82+
if: matrix.os == 'windows-latest' && matrix.compiler == 'clang'
83+
run: |
84+
mkdir build
85+
cd build
86+
cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++ ..
87+
shell: pwsh
88+
7689
- name: Build
7790
run: cmake --build build --config Release
7891
shell: bash

0 commit comments

Comments
 (0)