chore(ci): removed macos-latest from ci
[KDIS.git] / .github / workflows / check.yaml
blob6d717b1d95c3f2102d70e96320cc02f6aa328d80
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     check:
37         name: Build & Test & Lint
38         strategy:
39             fail-fast: true
40             matrix:
41                 # TODO(carlocorradini) Add macos-latest
42                 os: [ubuntu-latest, windows-latest]
43                 build: [Debug, Release]
44                 dis: [5, 6, 7]
45         runs-on: ${{ matrix.os }}
46         steps:
47             - name: Checkout
48               uses: actions/checkout@v4
49               with:
50                   fetch-depth: 0
52             - name: Setup Python
53               uses: actions/setup-python@v4
55             - name: Install Doxygen
56               uses: ssciwr/doxygen-install@v1
58             - name: Install cmakelang
59               run: pip install cmakelang[YAML]
61             - name: Configure CMake
62               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
64             - name: Build
65               run: cmake --build ./build --config ${{ matrix.build }}
67             - name: Test
68               run: ctest --verbose --test-dir ./build/tests --build-config ${{ matrix.build }}
70             - name: Clang Format
71               uses: DoozyX/clang-format-lint-action@v0.16.2
73             # TODO(carlocorradini) Clang Tidy
75             - name: CMake Format
76               if: matrix.os != 'windows-latest'
77               run: find . -not -path './build/*' -not -path './cmake/CPM.cmake' -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) -print0 | xargs -0 -n1 cmake-format --check
79             - name: CMake Format
80               if: matrix.os == 'windows-latest'
81               run: Get-ChildItem -Exclude 'build' | Get-ChildItem -Recurse -File -Include 'CMakeLists.txt', '*.cmake' -Exclude 'CPM.cmake' | Foreach { cmake-format --check $_.fullname; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } }
83             - name: CMake Lint
84               if: matrix.os != 'windows-latest'
85               run: find . -not -path './build/*' -not -path './cmake/CPM.cmake' -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) -print0 | xargs -0 -n1 cmake-lint
87             - name: CMake Lint
88               if: matrix.os == 'windows-latest'
89               run: Get-ChildItem -Exclude 'build' | Get-ChildItem -Recurse -File -Include 'CMakeLists.txt', '*.cmake' -Exclude 'CPM.cmake' | Foreach { cmake-lint $_.fullname; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } }
91             # TODO(carlocorradini) Cppcheck
92             # TODO(carlocorradini) Cpplint
93             # TODO(carlocorradini) Code coverage