Skip to content

Commit 463cef2

Browse files
committed
chore: Update build workflow
1 parent be14561 commit 463cef2

1 file changed

Lines changed: 55 additions & 18 deletions

File tree

.github/workflows/build.yml

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,58 @@ jobs:
2424
- name: Set up build environment
2525
run: |
2626
if [ "$RUNNER_OS" == "Windows" ]; then
27-
choco install mingw -y
27+
choco install mingw-w64 make -y
2828
elif [ "$RUNNER_OS" == "Linux" ]; then
2929
sudo apt-get update
3030
sudo apt-get install -y build-essential --no-install-recommends
3131
elif [ "$RUNNER_OS" == "macOS" ]; then
32-
brew install gcc
32+
brew update
3333
fi
3434
shell: bash
3535

36+
- name: Cache build artifacts
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
examples/ImGui/build/
41+
key: ${{ runner.os }}-build-${{ matrix.build-type }}-${{ hashFiles('examples/ImGui/Makefile', 'examples/ImGui/**/*.cpp', 'examples/ImGui/**/*.h', 'examples/ImGui/**/*.hpp') }}
42+
restore-keys: |
43+
${{ runner.os }}-build-${{ matrix.build-type }}-
44+
3645
- name: Build ImGui example (${{ matrix.build-type }})
3746
run: |
3847
cd examples/ImGui
39-
make BUILD_TYPE=${{ matrix.build-type }}
48+
if [ "$RUNNER_OS" = "macOS" ]; then
49+
make BUILD_TYPE=${{ matrix.build-type }} CXX=clang++ clean all -j$(nproc 2>/dev/null || echo 4)
50+
else
51+
make BUILD_TYPE=${{ matrix.build-type }} clean all -j$(nproc 2>/dev/null || echo 4)
52+
fi
4053
shell: bash
4154

4255
- name: Build ImGui example with analyze
4356
if: matrix.build-type == 'debug' && runner.os == 'Linux'
4457
run: |
4558
cd examples/ImGui
46-
make analyze
59+
if [ "$RUNNER_OS" = "macOS" ]; then
60+
make clean CXX=clang++ analyze
61+
else
62+
make clean analyze
63+
fi
4764
shell: bash
4865

49-
- name: Check compilation warnings
66+
- name: Check compilation
5067
if: matrix.os == 'ubuntu-latest'
5168
run: |
5269
cd examples/ImGui
53-
make BUILD_TYPE=debug 2>&1 | tee build.log
54-
if grep -i "error:" build.log; then
70+
make BUILD_TYPE=debug WARN_LEVEL=normal clean all 2>&1 | tee build.log
71+
# Count actual compilation errors (not warnings)
72+
ERROR_COUNT=$(grep -c "error:" build.log || true)
73+
if [ "$ERROR_COUNT" -gt 0 ]; then
74+
echo "❌ Compilation errors found:"
75+
grep "error:" build.log
5576
exit 1
77+
else
78+
echo "✅ Build successful (warnings are allowed in CI)"
5679
fi
5780
shell: bash
5881

@@ -69,12 +92,12 @@ jobs:
6992
7093
- name: Build all examples
7194
run: |
72-
make
95+
make BUILD_TYPE=release clean all -j$(nproc)
7396
7497
- name: Verify executable exists
7598
run: |
76-
[ -f "examples/ImGui/build/app/ImGuiExample" ] || exit 1
77-
echo "✓ ImGui executable built successfully"
99+
[ -f "examples/ImGui/build/app/ImGuiExample" ] || { echo "Executable not found!"; exit 1; }
100+
echo "✓ ImGuiExample executable built successfully"
78101
79102
code-quality:
80103
runs-on: ubuntu-latest
@@ -85,15 +108,29 @@ jobs:
85108
- name: Set up build environment
86109
run: |
87110
sudo apt-get update
88-
sudo apt-get install -y --no-install-recommends \
89-
build-essential cppcheck clang-tidy
111+
sudo apt-get install -y --no-install-recommends \
112+
build-essential \
113+
cppcheck \
114+
clang-tidy
90115
91116
- name: Run cppcheck
92117
run: |
93-
cppcheck --enable=all --suppress=missingIncludeSystem \
94-
examples/donut-basic/src/ \
95-
examples/*/
96-
97-
- name: Run clang-tidy
118+
cppcheck --enable=all --error-exitcode=1 --suppress=missingIncludeSystem \
119+
examples/ImGui/ \
120+
--suppress=*:*/imgui_impl_* \
121+
--suppress=*:*/imgui*.cpp \
122+
--inline-suppr \
123+
--quiet
124+
continue-on-error: false
125+
126+
- name: Run clang-tidy (basic mode)
98127
run: |
99-
clang-tidy examples/*/src/*.cpp -- -Iexamples/*/include
128+
cd examples/ImGui
129+
clang-tidy \
130+
src/*.cpp \
131+
-- \
132+
-Iinclude \
133+
-Iinclude/imgui \
134+
-Iinclude/imgui/backends \
135+
-std=c++23
136+
continue-on-error: true

0 commit comments

Comments
 (0)