Skip to content

Commit a8de5dd

Browse files
committed
make CI more useful
fix? maybe fix make a test "experimental" make CI use either gcc or clang
1 parent 0d1ad4c commit a8de5dd

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

Diff for: .github/workflows/c-cpp.yml

+23-20
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,45 @@ on:
77
branches: ["master", "next"]
88

99
jobs:
10-
ubuntu:
11-
runs-on: ubuntu-latest
10+
linux_matrix:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
cxxcompiler: [g++,clang++]
15+
with_experimental: [0,1]
16+
include:
17+
- ccompiler: gcc
18+
cxxcompiler: g++
19+
- ccompiler: clang
20+
cxxcompiler: clang++
1221

22+
runs-on: ubuntu-latest
1323
steps:
1424
- uses: actions/checkout@v4
1525
- name: Install ninja-build tool
1626
uses: seanmiddleditch/gha-setup-ninja@v5
17-
- name: Generate tests
18-
run: |
19-
cmake -B fast_io_prebuild -S . -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=On -DTESTS_PREBUILD=On
20-
cmake --build fast_io_prebuild
21-
./fast_io_prebuild/tests_prebuild linux
22-
- name: CMake configure
23-
run: cmake -B fast_io_build -S . -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Werror" -DENABLE_TESTS=On
27+
- name: Configuring
28+
run: cmake -S . -B ./build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Wshadow -Wconversion' -Dfast_io_ENABLE_TESTS=1 -Dfast_io_ENABLE_BENCHMARKS=1 -Dfast_io_ENABLE_EXAMPLES=1 -Dfast_io_ENABLE_FUZZING=1 -DCMAKE_CXX_COMPILER='${{ matrix.cxxcompiler }}' -DCMAKE_C_COMPILER='${{ matrix.ccompiler }}' -Dfast_io_ENABLE_TESTS_EXPERIMENTAL=${{ matrix.with_experimental }} -Dfast_io_ENABLE_BENCHMARKS_EXPERIMENTAL=${{ matrix.with_experimental }} -Dfast_io_ENABLE_EXAMPLES_EXPERIMENTAL=${{ matrix.with_experimental }} -Dfast_io_ENABLE_FUZZING_EXPERIMENTAL=${{ matrix.with_experimental }}
2429
- name: CMake build
25-
run: cmake --build fast_io_build
30+
run: |
31+
if [[ "${{ matrix.with_experimental }}" == "1" ]]; then NOT_CONTINUE_AFTER_FAIL='0'; else NOT_CONTINUE_AFTER_FAIL='1'; fi ;
32+
cmake --build ./build --verbose -j $(nproc) -- -k ${NOT_CONTINUE_AFTER_FAIL}
2633
- name: CMake test
27-
run: cmake --build fast_io_build --target test
34+
run: ctest --test-dir ./build --verbose -j $(nproc)
2835

2936
windows:
3037
runs-on: windows-latest
3138

3239
steps:
3340
- uses: actions/checkout@v4
3441
- uses: ilammy/[email protected]
35-
- name: Generate tests
36-
run: |
37-
cmake -B fast_io_prebuild -S . -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=On -DTESTS_PREBUILD=On
38-
cmake --build fast_io_prebuild
39-
./fast_io_prebuild/tests_prebuild windows msvc
40-
- name: CMake configure
41-
run: cmake -B fast_io_build -S . -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_CXX_FLAGS="/EHsc /W3 /WX /sdl" -DENABLE_TESTS=On
42+
- name: Configuring
43+
run: cmake -S . -B ./build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='/EHsc /W3 /WX /sdl' -Dfast_io_ENABLE_TESTS=1 -Dfast_io_ENABLE_BENCHMARKS=1 -Dfast_io_ENABLE_EXAMPLES=1 -Dfast_io_ENABLE_FUZZING=1 -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
4244
- name: CMake build
43-
run: cmake --build fast_io_build
45+
run: |
46+
cmake --build ./build --verbose -j $(nproc) -- -k 0
4447
- name: CMake test
45-
run: cmake --build fast_io_build --target test
48+
run: ctest --test-dir ./build --verbose -j $(nproc)
4649

4750
# macos:
4851

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ foreach(PART ${additional_parts})
5151
OFF
5252
)
5353
option(${PROJECT_NAME}_ENABLE_${PART}_ADD_UBSAN
54-
"Build ${part_lowercase} with undefined behaviour sanitizer" OFF
54+
"Build ${part_lowercase} with undefined behaviour sanitizer" ON
5555
)
5656
option(${PROJECT_NAME}_ENABLE_${PART}_EXPERIMENTAL "IF
5757
${PROJECT_NAME}_ENABLE_${PART} is enabled, build something, that maybe cannot be compiled." NO

Diff for: tests/CMakeLists.txt

+10-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ endfunction()
3838
# endforeach()
3939

4040
set(tests_simple
41-
0000.tests_prebuild/gentests.cc
41+
# 0000.tests_prebuild/gentests.cc # wtf why this exists?
4242
0001.input/invalid_number.cc
4343
0002.printscan/print.cc
4444
0002.printscan/scan.cc
@@ -68,8 +68,8 @@ set(tests_simple
6868
0012.umul/umul.cc
6969
# 0013.pr_rsv/bounds_checking_array.cc # error: static assertion failed: array size is not enough
7070
# 0013.pr_rsv/bounds_checking_c_array.cc # error: static assertion failed: C array size is not enough
71-
0013.pr_rsv/pr_rsv.cc
72-
0013.pr_rsv/pr_rsv_scientific.cc
71+
# 0013.pr_rsv/pr_rsv.cc # error: no matching function for call to ‘os_c_str(char [24], char*&)’
72+
# 0013.pr_rsv/pr_rsv_scientific.cc # error: no matching function for call to ‘os_c_str(char [24], char*&)’
7373
# 0014.integer/block_function_pointer.cc # In instantiation of ‘constexpr void fast_io::io::println(T&&, Args&& ...) [with T = int (&)(); Args = {}]’ error: static assertion failed: some types are not printable for print on default C's stdout
7474
0014.integer/percentage_conventional.cc
7575
0014.integer/percentage_sex_ratio.cc
@@ -220,6 +220,8 @@ set(tests_experimental
220220
0009.http_header/head.cc # error: call of overloaded ‘find_not(const char*&, const char*&, const char&)’ is ambiguous
221221
0013.pr_rsv/bounds_checking_array.cc # error: static assertion failed: array size is not enough
222222
0013.pr_rsv/bounds_checking_c_array.cc # error: static assertion failed: C array size is not enough
223+
0013.pr_rsv/pr_rsv.cc # error: no matching function for call to ‘os_c_str(char [24], char*&)’
224+
0013.pr_rsv/pr_rsv_scientific.cc # error: no matching function for call to ‘os_c_str(char [24], char*&)’
223225
0014.integer/block_function_pointer.cc # In instantiation of ‘constexpr void fast_io::io::println(T&&, Args&& ...) [with T = int (&)(); Args = {}]’ error: static assertion failed: some types are not printable for print on default C's stdout
224226
0015.temp_file/tmp.cc # error: cannot convert ‘fast_io::native_file to 'FILE*'
225227
0024.timestamp/basic_timestamp.cc # error: call of overloaded ‘find_not(const char*&, const char*&, const char&)’ is ambiguous
@@ -254,6 +256,10 @@ set(tests_experimental_boost_uuid
254256
0019.boost/uuid.cc # error: ‘Iter’ has not been declared inline constexpr char_type *print_reserve_define(io_reserve_type_t<char_type, boost::uuids::uuid>, Iter iter,
255257
)
256258

259+
set(tests_this_shouldnt_exist
260+
0000.tests_prebuild/gentests.cc # wtf why this exists?
261+
)
262+
257263
# cmake-format: on
258264

259265
apply_to_sources_tests(tests_simple create_exe_default_test)
@@ -350,6 +356,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
350356
list(APPEND all_tests ${tests_doesnt_have_main})
351357
list(APPEND all_tests ${tests_experimental})
352358
list(APPEND all_tests ${tests_experimental_boost_uuid})
359+
list(APPEND all_tests ${tests_this_shouldnt_exist})
353360

354361
foreach(test ${all_tests})
355362
message(DEBUG "all_tests: ${test}")

0 commit comments

Comments
 (0)