Various improvements #48
This file contains hidden or 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
| name: Formatting via cmake- and clang-format | |
| # only trigger this action on specific events | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| format: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| # checkout repository | |
| - name: "Checkout PLSSVM" | |
| uses: actions/[email protected] | |
| with: | |
| path: PLSSVM | |
| # install dependencies | |
| - name: "Dependencies" | |
| run: | | |
| sudo apt install libomp-dev clang-format | |
| pip install "git+https://github.com/vancraar/cmake_format@master" | |
| # install new CMake version | |
| - name: "Install cmake 4.2.1" | |
| uses: lukka/[email protected] | |
| # configure project via CMake | |
| - name: "Configure" | |
| run: | | |
| cd PLSSVM | |
| cmake --preset all -DPLSSVM_TARGET_PLATFORMS="cpu" -DPLSSVM_ENABLE_FORMATTING=ON | |
| # check source file formatting | |
| - name: "Check source file formatting via clang-format" | |
| if: always() | |
| run: | | |
| set +e | |
| cd PLSSVM | |
| cmake --build --preset all --target check-clang-format | |
| status=$? | |
| if [ $status -ne 0 ]; then | |
| echo "clang-format formatting errors found!" | |
| cmake --build --preset all --target clang-format > clang-format-patch.txt 2>&1 | |
| exit $status | |
| else | |
| echo "No clang-format formatting errors found!" | |
| fi | |
| # upload the clang-format git patch, if available | |
| - name: "Upload clang-format patch" | |
| if: always() | |
| uses: actions/[email protected] | |
| with: | |
| name: clang-format-patch | |
| path: PLSSVM/clang-format-patch.txt | |
| if-no-files-found: ignore | |
| # check CMake formatting | |
| - name: "Check CMake formatting via cmake-format" | |
| if: always() | |
| run: | | |
| set +e | |
| cd PLSSVM | |
| cmake --build --preset all --target check-cmake-format | |
| status=$? | |
| if [ $status -ne 0 ]; then | |
| echo "cmake-format formatting errors found!" | |
| cmake --build --preset all --target cmake-format > cmake-format-patch.txt 2>&1 | |
| exit $status | |
| else | |
| echo "No cmake-format formatting errors found!" | |
| fi | |
| # upload the cmake-format git patch, if available | |
| - name: "Upload cmake-format patch" | |
| if: always() | |
| uses: actions/[email protected] | |
| with: | |
| name: cmake-format-patch | |
| path: PLSSVM/cmake-format-patch.txt | |
| if-no-files-found: ignore |