-
Notifications
You must be signed in to change notification settings - Fork 12
77 lines (75 loc) · 2.45 KB
/
format.yml
File metadata and controls
77 lines (75 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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 3.31.0"
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/upload-artifact@v4
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/upload-artifact@v4
with:
name: cmake-format-patch
path: PLSSVM/cmake-format-patch.txt
if-no-files-found: ignore