chore(ci): removed macos
[KDIS.git] / .github / workflows / check.yaml
blob087989a3bd483d5b76de460bf88cf3c6ada64ae0
1 name: check
3 on:
4     push:
5         branches:
6             - master
7         tags:
8             - v*
9     pull_request:
10         branches:
11             - master
13 concurrency:
14     group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15     cancel-in-progress: true
17 jobs:
18     version:
19         name: Version
20         if: startsWith(github.ref_name, 'v')
21         runs-on: ubuntu-latest
22         steps:
23             - name: Checkout
24               uses: actions/checkout@v4
25               with:
26                   fetch-depth: 0
28             - name: Check Git tag format
29               run: |
30                   _tag="${{ github.ref_name }}"
31                   if ! printf "%s\n" "$_tag" | grep -q -P '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(alpha|beta|rc)\.(0|[1-9][0-9]*))?$'; then
32                     printf '[ERROR]: Git tag (%s) wrong format\n' "$_tag"
33                     exit 1
34                   fi
36     code:
37         name: Code
38         runs-on: ubuntu-latest
39         steps:
40             - name: Checkout
41               uses: actions/checkout@v4
42               with:
43                   fetch-depth: 0
45             - name: Setup Python
46               uses: actions/setup-python@v4
48             - name: Install cmakelang
49               run: pip install cmakelang[YAML]
51             - name: Clang Format
52               run: |
53                   find . \
54                       -not -path './build/*' \
55                       -type f \( \
56                       -name '*.hpp' \
57                       -o -name '*.hpp.in' \
58                       -o -name '*.cpp' \
59                       \) \
60                       -print0 |
61                       xargs -0 -n1 \
62                           clang-format \
63                           -Werror \
64                           --dry-run \
65                           --style=file
67             # TODO(carlocorradini) Clang Tidy
69             - name: CMake Format
70               run: |
71                   find . \
72                       -not -path './build/*' \
73                       -not -path './cmake/CPM.cmake' \
74                       -type f \( \
75                       -name 'CMakeLists.txt' \
76                       -o -name '*.cmake' \
77                       \) \
78                       -print0 |
79                       xargs -0 -n1 \
80                           cmake-format --check
82             - name: CMake Lint
83               run: |
84                   find . \
85                       -not -path './build/*' \
86                       -not -path './cmake/CPM.cmake' \
87                       -type f \( \
88                       -name 'CMakeLists.txt' \
89                       -o -name '*.cmake' \
90                       \) \
91                       -print0 |
92                       xargs -0 -n1 \
93                           cmake-lint
95             # TODO(carlocorradini) Cppcheck
97             # TODO(carlocorradini) Cpplint
99     build:
100         name: Build
101         strategy:
102             fail-fast: true
103             matrix:
104                 # TODO(carlocorradini) Add macos-latest
105                 os: [ubuntu-latest, windows-latest]
106                 build: [Debug, Release]
107                 dis: [5, 6, 7]
108         runs-on: ${{ matrix.os }}
109         steps:
110             - name: Checkout
111               uses: actions/checkout@v4
112               with:
113                   fetch-depth: 0
115             - name: Install Doxygen
116               uses: ssciwr/doxygen-install@v1
118             - name: Configure CMake
119               run: cmake -S . -B ./build -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DDIS_VERSION=${{ matrix.dis }} -DBUILD_SHARED_LIBS=OFF -DBUILD_DOCS=ON -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON
121             - name: Build
122               run: cmake --build ./build --config ${{ matrix.build }}
124             - name: Test
125               run: ctest --verbose --test-dir ./build/tests --build-config ${{ matrix.build }}
127             # TODO(carlocorradini) Code coverage