Skip to content

Commit

Permalink
build(error): add option that enable source code formatting check
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal committed Jun 28, 2023
1 parent d58962d commit b707ddf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
cmake ${{ matrix.package }} \
-B ${{ matrix.package }}/build \
-D BUILD_TESTING=ON
-D CHECK_FORMAT=ON
- name: Build project
run: cmake --build ${{ matrix.package }}/build
Expand Down Expand Up @@ -50,9 +51,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3.5.3

- name: Install cmake-format
run: pip3 install cmake-format

- name: Configure CMake
run: |
cmake ${{ matrix.package }} `
Expand All @@ -75,10 +73,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3.5.3

# TODO: remove this later
- name: Install cmake-format
run: pip3 install cmake-format

- name: Configure and build project
uses: threeal/cmake-action@v1.1.0
with:
Expand All @@ -94,10 +88,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3.5.3

# TODO: remove this later
- name: Install cmake-format
run: pip3 install cmake-format

- name: Configure and build project
uses: threeal/cmake-action@v1.1.0
with:
Expand Down
8 changes: 6 additions & 2 deletions error/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ target_link_libraries(error PUBLIC fmt)

# Check if this project is the main project
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
option(CHECK_FORMAT "Enable source code formatting check" OFF)

# Import Format.cmake to format source code
cpmaddpackage("gh:TheLartians/Format.cmake@1.7.3")
add_dependencies(error fix-format)
if(CHECK_FORMAT)
cpmaddpackage("gh:TheLartians/Format.cmake@1.7.3")
add_dependencies(error fix-format)
endif()

if(BUILD_TESTING)
enable_testing()
Expand Down

0 comments on commit b707ddf

Please # to comment.