This repository has been archived by the owner on Jan 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
goto | ||
exit | ||
using namespace std; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
# This configuration requires clang-format version 7.0 | ||
BasedOnStyle: Google | ||
|
||
AccessModifierOffset: -4 | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveBitFields: true | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortLoopsOnASingleLine: false | ||
BreakConstructorInitializers: BeforeComma | ||
ColumnLimit: 120 | ||
IndentCaseLabels: false | ||
SpaceBeforeInheritanceColon: false | ||
TabWidth: 4 | ||
IndentWidth: 4 | ||
UseTab: Never | ||
... |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: CPP project with GTest CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: self-hosted | ||
|
||
env: | ||
CC: clang | ||
CXX: clang++ | ||
|
||
steps: | ||
# - name: Setup dependencies | ||
# run: | | ||
# sudo apt-get install -y clang-tidy python3 | ||
# sudo pip3 install conan==1.59 | ||
|
||
- name: Checkout submodules | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Check for bad words | ||
run: "! grep -R -n -w -f .bad_words src libraries" | ||
- name: Run clang format | ||
run: "find . -iname *.h -o -iname *.hpp -o -iname *.cpp -exec clang-format --dry-run --Werror -style=file {} +" | ||
|
||
- name: Build default | ||
run: mkdir build && cmake -S. -Bbuild -DUSE_CLANG_TIDY=TRUE -DTESTS_BUILD_TYPE=NONE -DCMAKE_BUILD_TYPE=Release && cmake --build build | ||
- name: Run default tests | ||
timeout-minutes: 10 | ||
working-directory: ./build/libraries/puzzle | ||
run: ./tests | ||
|
||
- name: Build ASAN | ||
run: mkdir build_ASAN && cmake -S. -Bbuild_ASAN -DTESTS_BUILD_TYPE=ASAN -DCMAKE_BUILD_TYPE=Debug && cmake --build build_ASAN | ||
- name: Run ASAN tests | ||
timeout-minutes: 15 | ||
working-directory: ./build_ASAN/libraries/puzzle | ||
run: ./tests | ||
|
||
- name: Build USAN | ||
run: mkdir build_USAN && cmake -S. -Bbuild_USAN -DTESTS_BUILD_TYPE=USAN -DCMAKE_BUILD_TYPE=Debug && cmake --build build_USAN | ||
- name: Run USAN tests | ||
timeout-minutes: 10 | ||
working-directory: ./build_USAN/libraries/puzzle | ||
run: ./tests | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CMakeLists.txt.user | ||
cmake-build-debug | ||
cmake-build-release | ||
.idea | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(BigTask2 LANGUAGES CXX) | ||
|
||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") | ||
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") | ||
file( | ||
DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake" | ||
"${CMAKE_BINARY_DIR}/conan.cmake" | ||
TLS_VERIFY ON | ||
) | ||
endif() | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) | ||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
message(STATUS "TESTS_BUILD_TYPE ${TESTS_BUILD_TYPE}") | ||
|
||
if (TESTS_BUILD_TYPE MATCHES ASAN) | ||
set(COMPILE_OPTS -Wall -Wextra -Werror -pedantic -pedantic-errors -O1 -fsanitize=address -fno-omit-frame-pointer | ||
-fno-inline -fno-sanitize-recover=all) | ||
set(LINK_OPTS -fsanitize=address) | ||
endif() | ||
if (TESTS_BUILD_TYPE MATCHES MSAN) | ||
set(COMPILE_OPTS -Wall -Wextra -Werror -pedantic -pedantic-errors -O1 -fsanitize=leak | ||
-fno-omit-frame-pointer | ||
-fno-sanitize-recover=all) | ||
set(LINK_OPTS -fsanitize=leak) | ||
endif() | ||
if (TESTS_BUILD_TYPE MATCHES USAN) | ||
set(COMPILE_OPTS -Wall -Wextra -Werror -pedantic -pedantic-errors -O1 | ||
-fsanitize=undefined,float-cast-overflow,float-divide-by-zero | ||
-fno-omit-frame-pointer -fno-sanitize-recover=all | ||
-fsanitize-recover=alignment) | ||
set(LINK_OPTS | ||
-fsanitize=undefined,float-cast-overflow,float-divide-by-zero) | ||
endif() | ||
|
||
# Configure clang-tidy | ||
if (${USE_CLANG_TIDY}) | ||
set(CMAKE_CXX_CLANG_TIDY clang-tidy) | ||
endif() | ||
|
||
include(${CMAKE_BINARY_DIR}/conan.cmake) | ||
|
||
conan_cmake_configure( | ||
REQUIRES gtest/1.13.0 | ||
GENERATORS cmake_find_package | ||
) | ||
|
||
conan_cmake_autodetect(settings) | ||
|
||
conan_cmake_install( | ||
PATH_OR_REFERENCE . | ||
BUILD missing | ||
REMOTE conancenter | ||
SETTINGS ${settings} | ||
) | ||
|
||
add_subdirectory(libraries) | ||
|
||
# add_executable(main src/main.cpp) | ||
# target_link_libraries(main PRIVATE int128::int128) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(int128) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
project(int128) | ||
|
||
# add_library(${PROJECT_NAME} | ||
# include/int128/Board.hpp src/Board.cpp | ||
# include/int128/Solver.hpp src/Solver.cpp | ||
# ) | ||
|
||
# target_include_directories(${PROJECT_NAME} PUBLIC include) | ||
|
||
# add_library(int128::int128 ALIAS ${PROJECT_NAME}) | ||
|
||
enable_testing() | ||
find_package(GTest REQUIRED) | ||
include(GoogleTest) | ||
|
||
# add_executable(tests tests/test_board.cpp tests/test_solver.cpp) | ||
# target_link_libraries(tests PRIVATE GTest::GTest int128::int128) | ||
# gtest_discover_tests(tests) | ||
|
||
if(COMPILE_OPTS) | ||
target_compile_options(${PROJECT_NAME} PUBLIC ${COMPILE_OPTS}) | ||
target_link_options(${PROJECT_NAME} PUBLIC ${LINK_OPTS}) | ||
|
||
target_compile_options(tests PUBLIC ${COMPILE_OPTS}) | ||
target_link_options(tests PUBLIC ${LINK_OPTS}) | ||
endif() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <iostream> | ||
|
||
int main() { | ||
|
||
} |