-
Notifications
You must be signed in to change notification settings - Fork 0
237 lines (207 loc) · 7.57 KB
/
Copy pathci.yml
File metadata and controls
237 lines (207 loc) · 7.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: CI
on:
# Run on pushes to main branches
push:
branches: [ main, develop ]
tags:
- 'v*'
# Run on pull requests (good for code review)
pull_request:
branches: [ main, develop ]
# Allow manual triggering from GitHub UI
workflow_dispatch:
# Cancel in-progress runs when a new workflow with the same ref is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Explicitly define permissions (principle of least privilege)
permissions:
contents: read
pull-requests: read
jobs:
build:
name: Build ${{ matrix.os }} - ${{ matrix.build_type }}
# C++20 support: ubuntu-latest (GCC 11+), macos-latest (Clang 14+), windows-latest (MSVC 2022)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Debug, Release]
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Cache ImGui
uses: actions/cache@v6
with:
path: external/imgui
key: ${{ runner.os }}-imgui-v1.92.4
restore-keys: |
${{ runner.os }}-imgui-v1.92
${{ runner.os }}-imgui-
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libglfw3-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libcurl4-openssl-dev \
xorg-dev \
xvfb
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: |
brew install cmake glfw llvm
LLVM_PATH=$(brew --prefix llvm)
SDK_PATH=$(xcrun --show-sdk-path)
echo "$LLVM_PATH/bin" >> $GITHUB_PATH
# Use LLVM compiler for C++20 support, but link against system C++ library
echo "CC=$LLVM_PATH/bin/clang" >> $GITHUB_ENV
echo "CXX=$LLVM_PATH/bin/clang++" >> $GITHUB_ENV
echo "SDKROOT=$SDK_PATH" >> $GITHUB_ENV
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
echo "LDFLAGS=-stdlib=libc++" >> $GITHUB_ENV
- name: Setup MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install Windows dependencies (vcpkg)
if: runner.os == 'Windows'
run: |
vcpkg install glfw3:x64-windows curl:x64-windows
shell: bash
# Third-party deps are pinned to commit SHAs rather than tags, because
# tags can be re-pointed. The release tag each SHA corresponds to is in
# the comment for human readability. Keep these in sync with
# setup_dependencies.sh.
- name: Setup ImGui
run: |
if [ ! -d "external/imgui" ]; then
mkdir -p external
git clone https://github.com/ocornut/imgui.git external/imgui
git -C external/imgui checkout --detach 9a5d5c45f54b1301ea471622eddede70384243af # v1.92.4
fi
shell: bash
- name: Setup nlohmann/json
run: |
if [ ! -d "external/json" ]; then
mkdir -p external
git clone https://github.com/nlohmann/json.git external/json
git -C external/json checkout --detach 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 # v3.11.3
fi
shell: bash
- name: Setup ImPlot
run: |
if [ ! -d "external/implot" ]; then
mkdir -p external
git clone https://github.com/epezent/implot.git external/implot
git -C external/implot checkout --detach 4707b245fbcd69075b1a8a74fa8d2435561b3134 # v0.17
fi
shell: bash
- name: Configure CMake (Linux/macOS)
if: runner.os != 'Windows'
run: |
if [ "${{ runner.os }}" == "macOS" ]; then
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.3 \
-DMETAIMGUI_WARNINGS_AS_ERRORS=ON
else
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_INSTALL_PREFIX=install \
-DMETAIMGUI_WARNINGS_AS_ERRORS=ON
fi
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: |
cmake -B build `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
-DCMAKE_INSTALL_PREFIX=install `
-DMETAIMGUI_WARNINGS_AS_ERRORS=ON
shell: pwsh
- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel
- name: Run tests (Linux, with Xvfb for display-tagged tests)
if: matrix.build_type == 'Debug' && runner.os == 'Linux'
run: xvfb-run --auto-servernum ctest --test-dir build --output-on-failure --build-config ${{ matrix.build_type }}
- name: Run tests (macOS / Windows)
if: matrix.build_type == 'Debug' && runner.os != 'Linux'
run: ctest --test-dir build --output-on-failure --build-config ${{ matrix.build_type }}
- name: Upload build artifacts
if: matrix.build_type == 'Release'
uses: actions/upload-artifact@v7
with:
name: MetaImGUI-${{ runner.os }}-${{ matrix.build_type }}
path: |
build/MetaImGUI*
build/Release/MetaImGUI*
build/imgui.ini
if-no-files-found: ignore
lint:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Cache dependencies
uses: actions/cache@v6
with:
path: |
external/imgui
external/json
external/implot
key: ${{ runner.os }}-lint-deps-imgui-1.92.4-json-3.11.3-implot-0.17
restore-keys: |
${{ runner.os }}-lint-deps-
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y clang-format clang-tidy \
libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev xorg-dev
- name: Setup dependencies
run: |
# SHAs match setup_dependencies.sh — see that file for the rotation policy.
if [ ! -d "external/imgui" ]; then
mkdir -p external
git clone https://github.com/ocornut/imgui.git external/imgui
git -C external/imgui checkout --detach 9a5d5c45f54b1301ea471622eddede70384243af # v1.92.4
fi
if [ ! -d "external/json" ]; then
mkdir -p external
git clone https://github.com/nlohmann/json.git external/json
git -C external/json checkout --detach 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 # v3.11.3
fi
if [ ! -d "external/implot" ]; then
mkdir -p external
git clone https://github.com/epezent/implot.git external/implot
git -C external/implot checkout --detach 4707b245fbcd69075b1a8a74fa8d2435561b3134 # v0.17
fi
- name: Configure CMake for clang-tidy
run: |
cmake -B build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE=Debug
- name: Check formatting
run: |
# Find all C++ source and header files
FILES=$(find src include -type f \( -name "*.cpp" -o -name "*.h" \))
if [ -n "$FILES" ]; then
echo "$FILES" | xargs clang-format --dry-run --Werror
else
echo "No C++ files found to check"
fi
- name: Run clang-tidy
run: |
# Run clang-tidy on source files
FILES=$(find src -type f -name "*.cpp")
if [ -n "$FILES" ]; then
echo "$FILES" | xargs clang-tidy -p build
else
echo "No source files found to analyze"
fi