1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ build :
11+ name : Build on ${{ matrix.os }}
12+ runs-on : ${{ matrix.os }}
13+ strategy :
14+ matrix :
15+ os : [ubuntu-latest, windows-latest, macOS-latest]
16+
17+ steps :
18+ - name : Checkout code
19+ uses : actions/checkout@v4
20+ with :
21+ submodules : recursive
22+
23+ - name : Install Qt
24+ uses : jurplel/install-qt-action@v3
25+ with :
26+ version : ' 5.15.2'
27+ host : ${{ matrix.os == 'windows-latest' && 'windows' || matrix.os == 'macOS-latest' && 'mac' || 'linux' }}
28+ target : ' desktop'
29+ arch : ${{ matrix.os == 'windows-latest' && 'win64_msvc2019_64' || 'gcc_64' }}
30+ modules : ' qtbase qttools qttranslations'
31+ install-deps : ' true'
32+
33+ - name : Install CMake and Ninja
34+ uses : lukka/get-cmake@v3.21.1
35+
36+ - name : Install dependencies on Ubuntu
37+ if : matrix.os == 'ubuntu-latest'
38+ run : |
39+ sudo apt update
40+ sudo apt install -y build-essential libgl1-mesa-dev libxcb1-dev libxkbcommon-x11-dev libxcb-cursor0
41+
42+ - name : Install dependencies on macOS
43+ if : matrix.os == 'macOS-latest'
44+ run : |
45+ brew install cmake
46+
47+ - name : Install dependencies on Windows
48+ if : matrix.os == 'windows-latest'
49+ run : |
50+ choco install ninja
51+
52+ - name : Configure CMake
53+ run : |
54+ cmake -B ${{github.workspace}}/build -G "Ninja" -DCMAKE_BUILD_TYPE=Release
55+
56+ - name : Build project
57+ run : |
58+ cmake --build ${{github.workspace}}/build --config Release
59+
60+ - name : Run tests
61+ run : |
62+ cd ${{github.workspace}}/build && ctest --output-on-failure -C Release
63+ env :
64+ CTEST_OUTPUT_ON_FAILURE : 1
65+
66+ - name : Upload build artifacts (Ubuntu)
67+ if : matrix.os == 'ubuntu-latest'
68+ uses : actions/upload-artifact@v3
69+ with :
70+ name : app-${{ matrix.os }}
71+ path : target/
72+
73+ clang-tidy :
74+ name : Run clang-tidy
75+ runs-on : ubuntu-latest
76+ steps :
77+ - name : Checkout code
78+ uses : actions/checkout@v4
79+
80+ - name : Install Qt
81+ uses : jurplel/install-qt-action@v3
82+ with :
83+ version : ' 5.15.2'
84+ host : ' linux'
85+ target : ' desktop'
86+ arch : ' gcc_64'
87+ modules : ' qtbase qttools qttranslations'
88+ install-deps : ' true'
89+
90+ - name : Install clang-tidy
91+ run : |
92+ sudo apt update
93+ sudo apt install -y clang-tidy
94+
95+ - name : Configure CMake with clang-tidy
96+ run : |
97+ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_CLANG_TIDY="clang-tidy"
98+
99+ - name : Build project with clang-tidy
100+ run : |
101+ cmake --build ${{github.workspace}}/build --config Release
102+ continue-on-error : true
103+
104+ - name : Run clang-tidy analysis
105+ run : |
106+ find src/ -name "*.cpp" -o -name "*.h" | xargs clang-tidy -p ${{github.workspace}}/build
107+
108+ memory-analysis :
109+ name : Memory analysis with Valgrind
110+ runs-on : ubuntu-latest
111+ steps :
112+ - name : Checkout code
113+ uses : actions/checkout@v4
114+
115+ - name : Install Qt
116+ uses : jurplel/install-qt-action@v3
117+ with :
118+ version : ' 5.15.2'
119+ host : ' linux'
120+ target : ' desktop'
121+ arch : ' gcc_64'
122+ modules : ' qtbase qttools qttranslations'
123+ install-deps : ' true'
124+
125+ - name : Install Valgrind
126+ run : |
127+ sudo apt update
128+ sudo apt install -y valgrind
129+
130+ - name : Configure CMake
131+ run : |
132+ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug
133+
134+ - name : Build project
135+ run : |
136+ cmake --build ${{github.workspace}}/build --config Debug
137+
138+ - name : Run tests with Valgrind
139+ run : |
140+ cd ${{github.workspace}}/build && find . -name "*test*" -executable -type f -exec valgrind --leak-check=full --error-exitcode=1 {} \; || true
0 commit comments