Skip to content

Commit 10f7384

Browse files
committed
fixed #478 - fail builds in CI on compiler warnings
1 parent d0f2b99 commit 10f7384

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ jobs:
4141
python3 -m pip config set global.break-system-packages true
4242
python3 -m pip install pytest
4343
44+
# TODO: bail out on warnings
4445
- name: make simplecpp
4546
run: make -j$(nproc)
4647

48+
# TODO: bail out on warnings
4749
- name: make test
4850
run: make -j$(nproc) test
4951

@@ -57,7 +59,7 @@ jobs:
5759
5860
- name: Run CMake
5961
run: |
60-
cmake -S . -B cmake.output
62+
cmake -S . -B cmake.output -DCMAKE_COMPILE_WARNING_AS_ERROR=On
6163
6264
- name: CMake simplecpp
6365
run: |
@@ -80,27 +82,27 @@ jobs:
8082
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'g++'
8183
run: |
8284
make clean
83-
make -j$(nproc) test selfcheck CXXFLAGS="-g3 -D_GLIBCXX_DEBUG"
85+
make -j$(nproc) test selfcheck CXXFLAGS="-Werror -g3 -D_GLIBCXX_DEBUG"
8486
8587
- name: Run with libc++ hardening mode
8688
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
8789
run: |
8890
make clean
89-
make -j$(nproc) test selfcheck CXXFLAGS="-stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDFLAGS="-lc++"
91+
make -j$(nproc) test selfcheck CXXFLAGS="-Werror -stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDFLAGS="-lc++"
9092
9193
- name: Run AddressSanitizer
9294
if: matrix.os == 'ubuntu-24.04'
9395
run: |
9496
make clean
95-
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -fsanitize=address" LDFLAGS="-fsanitize=address"
97+
make -j$(nproc) test selfcheck CXXFLAGS="-Werror -O2 -g3 -fsanitize=address" LDFLAGS="-fsanitize=address"
9698
env:
9799
ASAN_OPTIONS: detect_stack_use_after_return=1
98100

99101
- name: Run UndefinedBehaviorSanitizer
100102
if: matrix.os == 'ubuntu-24.04'
101103
run: |
102104
make clean
103-
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDFLAGS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
105+
make -j$(nproc) test selfcheck CXXFLAGS="-Werror -O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDFLAGS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
104106
env:
105107
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1
106108

@@ -109,4 +111,4 @@ jobs:
109111
if: false && matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
110112
run: |
111113
make clean
112-
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -stdlib=libc++ -fsanitize=memory" LDFLAGS="-lc++ -fsanitize=memory"
114+
make -j$(nproc) test selfcheck CXXFLAGS="-Werror -O2 -g3 -stdlib=libc++ -fsanitize=memory" LDFLAGS="-lc++ -fsanitize=memory"

.github/workflows/CI-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
4141
- name: Run CMake
4242
run: |
43-
cmake -G "Visual Studio 17 2022" -A x64 . || exit /b !errorlevel!
43+
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_COMPILE_WARNING_AS_ERROR=On . || exit /b !errorlevel!
4444
4545
- name: Build
4646
run: |

.github/workflows/clang-tidy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
3131
- name: Prepare CMake
3232
run: |
33-
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
33+
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
3434
env:
3535
CXX: clang-20
3636

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ environment:
1010

1111
build_script:
1212
- ECHO Building %configuration% %platform% with MSVC %VisualStudioVersion% using %PlatformToolset% PlatformToolset
13-
- cmake -G "Visual Studio 14" .
13+
- cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=On -G "Visual Studio 14" .
1414
- dir
1515
- 'CALL "C:\Program Files (x86)\Microsoft Visual Studio %VisualStudioVersion%\VC\vcvarsall.bat" %vcvarsall_platform%'
1616
- msbuild "simplecpp.sln" /consoleloggerparameters:Verbosity=minimal /target:Build /property:Configuration="%configuration%";Platform=%platform% /p:PlatformToolset=%PlatformToolset% /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

0 commit comments

Comments
 (0)