11name : ci
22
3+ permissions :
4+ contents : write
5+
36on :
47 push :
58 branches :
1013 types : [published]
1114 workflow_dispatch :
1215
16+ env :
17+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
18+ VCPKG_FEATURE_FLAGS : dependencygraph
19+
1320jobs :
14- build :
15- name : ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.build_type }} ${{ matrix.config.name }}
21+ lint :
22+ runs-on : ubuntu-22.04
23+
24+ env :
25+ CLANG_FORMAT_VERSION : 17
26+
27+ steps :
28+ - name : Checkout Code
29+ uses : actions/checkout@v4
30+
31+ - name : Install Clang-Format
32+ uses : aminya/setup-cpp@v1
33+ with :
34+ clangformat : ${{ env.CLANG_FORMAT_VERSION }}
35+
36+ - name : Install Python
37+ uses : actions/setup-python@v5
38+ with :
39+ python-version : " 3.8"
40+
41+ - name : Install codespell
42+ run : pip3 install codespell
43+
44+ - name : Format Code
45+ run : cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ env.CLANG_FORMAT_VERSION }} -P cmake/Format.cmake
46+
47+ - name : Check Formatting
48+ run : git diff --color --exit-code
49+
50+ - name : Spell Check
51+ if : always()
52+ run : cmake -P cmake/CodeSpell.cmake
53+
54+ - name : Format Vcpkg.json
55+ if : always()
56+ run : vcpkg format-manifest ./vcpkg.json
57+
58+ test :
59+ needs : [lint]
60+
61+ name : ${{ matrix.platform.os }} ${{ matrix.platform.generator }} ${{ matrix.platform.compiler }} ${{ matrix.config.name }} ${{ matrix.type.name }}
1662 if : ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
17- runs-on : ${{ matrix.os }}
63+ runs-on : ${{ matrix.platform. os }}
1864 timeout-minutes : 120
1965
2066 strategy :
2167 fail-fast : false
68+
69+ # https://github.com/actions/runner-images
2270 matrix :
23- os :
24- - ubuntu-22.04
25- - macos-13
26- - windows-2022
27- compiler :
28- - llvm
29- - gcc
30- build_type :
31- - Debug
32- - Release
71+ platform :
72+ - { os: windows-2022, generator: vs2022, compiler: msvc, preset: windows-vs2022 }
73+ - { os: windows-2022, generator: vs2022, compiler: llvm, preset: windows-vs2022-clangcl }
74+ - { os: windows-2022, generator: ninja, compiler: msvc, preset: windows-ninja }
75+ - { os: windows-2022, generator: ninja, compiler: llvm, preset: windows-ninja-clangcl }
76+ - { os: ubuntu-22.04, generator: ninja, compiler: gcc, preset: linux-ninja-gcc }
77+ - { os: ubuntu-22.04, generator: ninja, compiler: llvm, preset: linux-ninja-clang }
78+ - { os: macos-13, generator: ninja, compiler: llvm, preset: mac-ninja-clang }
79+ - { os: macos-13, generator: xcode, compiler: llvm, preset: mac-xcode-clang }
3380 config :
3481 - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
3582 - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
36-
37- exclude :
38- - os : windows-2022
39- compiler : gcc
40- - os : macos-13
41- compiler : gcc
42-
43- include :
44- - os : windows-2022
45- compiler : msvc
46- build_type : Debug
47- config : { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
48- - os : windows-2022
49- compiler : msvc
50- build_type : Debug
51- config : { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
52- - os : windows-2022
53- compiler : msvc
54- build_type : Release
55- config : { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
56- - os : windows-2022
57- compiler : msvc
58- build_type : Release
59- config : { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
83+ type :
84+ - { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug }
85+ - { name: Release, flags: -DCMAKE_BUILD_TYPE=Release }
6086
6187 steps :
6288 - name : Checkout Code
@@ -65,71 +91,24 @@ jobs:
6591 - name : Install Cpp Environment
6692 uses : aminya/setup-cpp@v1
6793 with :
68- compiler : ${{ matrix.compiler }}
69- vcvarsall : ${{ contains(matrix.os, 'windows') }}
94+ compiler : ${{ matrix.platform. compiler }}
95+ vcvarsall : ${{ contains(matrix.platform. os, 'windows') }}
7096 cmake : true
7197 ninja : true
7298 vcpkg : true
99+ clangtidy : true
100+ cppcheck : true
73101
74102 - name : CMake Configure
75103 env :
76104 VCPKG_ROOT : ' ~/vcpkg'
77105 shell : bash
78- run : |
79- if [ "${{ runner.os }}" == "Windows" ]; then
80- cmake --preset=Windows-${{ matrix.compiler }}-${{ matrix.build_type }} ${{ matrix.config.flags }}
81- else
82- cmake --preset=${{ matrix.compiler }}-${{ matrix.build_type }} ${{ matrix.config.flags }}
83- fi
106+ run : cmake --preset=${{ matrix.platform.preset }} ${{ matrix.config.flags }} ${{ matrix.type.flags }} -DVCPKG_MANIFEST_FEATURES=tests -DFEATURE_TESTS=ON
84107
85108 - name : CMake Build
86109 shell : bash
87- run : |
88- if [ "${{ runner.os }}" == "Windows" ]; then
89- cmake --build --preset=Windows-${{ matrix.compiler }}-${{ matrix.build_type }}
90- else
91- cmake --build --preset=${{ matrix.compiler }}-${{ matrix.build_type }}
92- fi
93-
94- - name : Install
95- shell : bash
96- run : |
97- if [ "${{ runner.os }}" == "Windows" ]; then
98- cmake --install out/build/Windows-${{ matrix.compiler }}-${{ matrix.build_type }} --prefix prefix
99- else
100- cmake --install out/build/${{ matrix.compiler }}-${{ matrix.build_type }} --prefix prefix
101- fi
110+ run : cmake --build --preset=${{ matrix.platform.preset }} --config ${{ matrix.type.name }}
102111
103112 - name : Test
104- if : ${{ matrix.build_type == 'Debug' }}
105113 shell : bash
106- run : |
107- if [ "${{ runner.os }}" == "Windows" ]; then
108- ctest --preset=test-Windows-${{ matrix.compiler }}-${{ matrix.build_type }}
109- else
110- ctest --preset=test-${{ matrix.compiler }}-${{ matrix.build_type }}
111- fi
112-
113- format :
114- name : Formatting
115- runs-on : ubuntu-22.04
116- env :
117- CLANG_FORMAT_VERSION : 17
118-
119- strategy :
120- fail-fast : false
121-
122- steps :
123- - name : Checkout Code
124- uses : actions/checkout@v4
125-
126- - name : Install Clang-Format
127- uses : aminya/setup-cpp@v1
128- with :
129- clangformat : ${{ env.CLANG_FORMAT_VERSION }}
130-
131- - name : Format Code
132- run : cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ env.CLANG_FORMAT_VERSION }} -P cmake/Format.cmake
133-
134- - name : Check Formatting
135- run : git diff --color --exit-code
114+ run : ctest --preset=${{ matrix.platform.preset }} -C ${{ matrix.type.name }}
0 commit comments