Skip to content

Commit

Permalink
CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonymakarewicz committed Jul 15, 2024
1 parent 1e0b56d commit 6810279
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,24 @@ jobs:
cd build
make
- name: Run Tests
run: |
cd build
ctest --output-on-failure
- name: Analyze code with clang-tidy
run: |
cd build
make clang-tidy
make clean # Ensure a clean build to run clang-tidy on all files
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
clang-tidy -p .
#- name: Check code formatting with clang-format
# run: |
#find . -name '*.cpp' -o -name '*.h' | xargs clang-format -i
# cd build
# make clang-format-check

- name: Run Tests
run: |
cd build
ctest --output-on-failure
- name: Generate code coverage
run: |
cd build
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.26.3)
project(Option_pricer)

# Set the version of C++ to 23
# Set the version of C++ to 23 (using the alias c++2b for compatibility with clang-tidy)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Set the Vcpkg toolchain file
set(CMAKE_TOOLCHAIN_FILE "/Users/anthony/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")
Expand Down
6 changes: 3 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ add_test(NAME OptionTester COMMAND Option_tester)
set_target_properties(Option_tester PROPERTIES CXX_CLANG_TIDY "clang-tidy;-checks=*,-clang-analyzer-alpha.*")

# clang-format integration (target to check formatting)
add_custom_target(clang-format-check
COMMAND find ${CMAKE_SOURCE_DIR} -name '*.cpp' -o -name '*.h' | xargs clang-format -i
)
#add_custom_target(clang-format-check
# COMMAND find ${CMAKE_SOURCE_DIR} -name '*.cpp' -o -name '*.h' | xargs clang-format -i
#)

# Code coverage integration (optional)
if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
Expand Down
6 changes: 0 additions & 6 deletions tests/test_option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,4 @@ TEST_F(OptionTest, AssignmentOperatorTest) {
EXPECT_EQ(option2->calc_price(), 0.0); // Assuming the initial calc_price is 0.0
}

int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}


#endif //TEST_OPTION_CPP

0 comments on commit 6810279

Please sign in to comment.