@@ -15,35 +15,29 @@ jobs:
1515 run : |
1616 choco install mingw --yes --no-progress
1717 echo "C:\tools\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
18-
1918 - name : Create CMake cache
2019 run : |
2120 cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles"
2221 cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles"
23-
2422 - name : Build main target
2523 shell : bash
2624 run : |
2725 cmake --build cmake-build-release || echo Built with errors
28-
2926 - name : Build tests target
3027 shell : bash
3128 run : |
3229 cmake --build cmake-build-debug --target cpp_tests_tests || echo Built with errors
33-
3430 - name : Run program
3531 working-directory : .\cmake-build-release
3632 shell : bash
3733 run : |
38- ./bin/cpp_tests.exe --help
39-
34+ ./cpp_tests.exe --help
4035 - name : Run tests
4136 working-directory : .\cmake-build-debug
4237 shell : bash
4338 run : |
44- # ./tests/cpp_tests_tests.exe
45- echo "Tests are not run on Windows MinGW due to issues with the test runner"
46-
39+ ./cpp_tests_tests.exe
40+ # echo "Tests are not run on Windows MinGW due to issues with the test runner"
4741 build-matrix :
4842 name : Tests and application run on ${{ matrix.config.name }}
4943 runs-on : ${{ matrix.config.os }}
@@ -85,39 +79,34 @@ jobs:
8579 run : |
8680 cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
8781 cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
88-
8982 - name : Build main target
9083 shell : bash
9184 run : |
9285 cmake --build cmake-build-release --target cpp_tests || echo "Built with errors"
93-
9486 - name : Build tests target
9587 shell : bash
9688 run : |
9789 cmake --build cmake-build-debug --target cpp_tests_tests || echo "Built with errors"
98-
9990 - name : Run program
10091 shell : bash
10192 working-directory : ./cmake-build-release
10293 run : |
10394 if [ "$RUNNER_OS" == "Windows" ]; then
104- ./bin/ cpp_tests.exe --help
95+ ./cpp_tests.exe --help
10596 else
10697 cd bin
10798 ./cpp_tests --help
10899 fi
109-
110100 - name : Run tests
111101 shell : bash
112102 working-directory : ./cmake-build-debug
113103 run : |
114104 if [ "$RUNNER_OS" == "Windows" ]; then
115- ./tests/ cpp_tests_tests.exe
105+ ./cpp_tests_tests.exe
116106 else
117107 cd tests
118108 ./cpp_tests_tests
119109 fi
120-
121110 style-check :
122111 name : Code style check with clang-format
123112 runs-on : ubuntu-latest
@@ -127,45 +116,36 @@ jobs:
127116 - name : Install clang-format
128117 run : |
129118 sudo apt-get update && sudo apt-get -y install clang-format
130-
131119 - name : Check code style
132120 shell : bash
133121 run : |
134122 mapfile -t files < <(git ls-files '*.c' '*.cpp' '*.h' '*.hpp')
135-
136123 if [ "${#files[@]}" -eq 0 ]; then
137124 echo "No C/C++ files to check."
138125 exit 0
139126 fi
140-
141127 clang-format --dry-run --Werror "${files[@]}" 2>format_output.txt || {
142128 cat format_output.txt
143129 exit 1
144130 }
145-
146131 - name : Comment on style issues
147132 if : failure() && github.event_name == 'pull_request'
148133 uses : actions/github-script@v7
149134 with :
150135 script : |
151136 const fs = require('fs');
152137 const { execSync } = require('child_process');
153-
154138 try {
155139 // Get list of files that need formatting
156140 const rawFiles = execSync('git ls-files "*.c" "*.cpp" "*.h" "*.hpp"', { encoding: 'utf8' }).trim();
157-
158141 if (!rawFiles) {
159142 console.log('No files require formatting checks.');
160143 return;
161144 }
162-
163145 const files = rawFiles.split('\n');
164-
165146 let comment = '## 🎨 Code Style Issues Found\n\n';
166147 comment += 'The following files have formatting issues:\n\n';
167148 let hasIssues = false;
168-
169149 for (const file of files) {
170150 try {
171151 const result = execSync(`clang-format --dry-run --Werror "${file}" 2>&1`, { encoding: 'utf8' });
@@ -174,13 +154,11 @@ jobs:
174154 hasIssues = true;
175155 }
176156 }
177-
178157 if (!hasIssues) {
179158 comment += 'No files with formatting issues were detected.';
180159 } else {
181160 comment += '\nPlease run `clang-format -i <file>` to fix formatting issues.';
182161 }
183-
184162 github.rest.issues.createComment({
185163 issue_number: context.issue.number,
186164 owner: context.repo.owner,
@@ -190,7 +168,6 @@ jobs:
190168 } catch (error) {
191169 console.log('Could not create comment:', error.message);
192170 }
193-
194171 code-quality-check :
195172 name : Code quality check with clang-tidy
196173 runs-on : ubuntu-latest
@@ -200,30 +177,24 @@ jobs:
200177 - name : Install clang-tidy
201178 run : |
202179 sudo apt-get update && sudo apt-get -y install clang-tidy
203-
204180 - name : Create CMake cache
205181 run : |
206182 cmake -S . -B cmake-build-tidy -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
207-
208183 - name : Run clang-tidy
209184 shell : bash
210185 run : |
211186 mapfile -t files < <(git ls-files '*.c' '*.cpp')
212-
213187 if [ "${#files[@]}" -eq 0 ]; then
214188 echo "No C/C++ files to analyze."
215189 echo "" > tidy_output.txt
216190 exit 0
217191 fi
218-
219192 echo "Running clang-tidy on ${#files[@]} files..."
220193 clang-tidy "${files[@]}" -p cmake-build-tidy --format-style=file > tidy_output.txt 2>&1 || true
221-
222194 # Ensure file exists and is readable
223195 if [ ! -f tidy_output.txt ]; then
224196 echo "" > tidy_output.txt
225197 fi
226-
227198 - name : Count warnings and errors
228199 id : count_issues
229200 run : |
@@ -235,34 +206,27 @@ jobs:
235206 errors=$(grep -c "error:" tidy_output.txt 2>/dev/null || echo "0")
236207 warnings=$(grep -c "warning:" tidy_output.txt 2>/dev/null || echo "0")
237208 fi
238-
239209 # Ensure we have clean integer values
240210 errors=$(echo "$errors" | tr -d '\n' | head -c 10)
241211 warnings=$(echo "$warnings" | tr -d '\n' | head -c 10)
242-
243212 # Default to 0 if empty or non-numeric
244213 errors=${errors:-0}
245214 warnings=${warnings:-0}
246-
247215 echo "errors=$errors" >> $GITHUB_OUTPUT
248216 echo "warnings=$warnings" >> $GITHUB_OUTPUT
249-
250217 echo "Found $errors errors and $warnings warnings"
251-
252218 # Fail if more than 3 warnings or any errors
253219 if [ "$errors" -gt 0 ] || [ "$warnings" -gt 100 ]; then
254220 echo "clang-tidy found $errors errors and $warnings warnings"
255221 cat tidy_output.txt
256222 exit 1
257223 fi
258-
259224 - name : Comment on quality issues
260225 if : failure() && github.event_name == 'pull_request'
261226 uses : actions/github-script@v7
262227 with :
263228 script : |
264229 const fs = require('fs');
265-
266230 try {
267231 let comment = '## 🔍 Code Quality Issues Found\n\n';
268232
0 commit comments