Skip to content

Commit f9397cb

Browse files
committed
add ghactions test for cmake
1 parent 44d2c74 commit f9397cb

File tree

1 file changed

+322
-0
lines changed

1 file changed

+322
-0
lines changed

.github/workflows/test-cmake.yml

Lines changed: 322 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,322 @@
1+
name: Test CMake
2+
3+
on:
4+
push:
5+
paths:
6+
- 'iPlug2/Scripts/cmake/**'
7+
- 'iPlug2/iPlug2.cmake'
8+
- '**/CMakeLists.txt'
9+
- '.github/workflows/test-cmake.yml'
10+
pull_request:
11+
paths:
12+
- 'iPlug2/Scripts/cmake/**'
13+
- 'iPlug2/iPlug2.cmake'
14+
- '**/CMakeLists.txt'
15+
workflow_dispatch:
16+
17+
env:
18+
PROJECT_NAME: TemplateProject
19+
20+
jobs:
21+
# ==========================================================================
22+
# macOS - Xcode Generator
23+
# ==========================================================================
24+
macos-xcode:
25+
name: macOS Xcode
26+
runs-on: macos-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
submodules: recursive
32+
33+
- name: Get SDKs
34+
run: |
35+
cd iPlug2/Dependencies/IPlug
36+
./download-iplug-sdks.sh
37+
38+
- name: CMake Generate (Xcode)
39+
run: |
40+
cmake -G Xcode -B build-xcode -S .
41+
test -d build-xcode/iPlug2OOS.xcodeproj
42+
43+
- name: Build (Xcode)
44+
run: |
45+
xcodebuild -project build-xcode/iPlug2OOS.xcodeproj \
46+
-scheme ALL_BUILD \
47+
-configuration Release \
48+
-quiet
49+
50+
- name: Verify Bundles
51+
run: |
52+
test -d build-xcode/out/Release/${{env.PROJECT_NAME}}.app
53+
test -d build-xcode/out/Release/${{env.PROJECT_NAME}}.vst3
54+
test -d build-xcode/out/Release/${{env.PROJECT_NAME}}.clap
55+
test -d build-xcode/out/Release/${{env.PROJECT_NAME}}.component
56+
echo "All bundles exist"
57+
58+
# ==========================================================================
59+
# macOS - Xcode Generator (Universal)
60+
# ==========================================================================
61+
macos-xcode-universal:
62+
name: macOS Xcode Universal
63+
runs-on: macos-latest
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
with:
68+
submodules: recursive
69+
70+
- name: Get SDKs
71+
run: |
72+
cd iPlug2/Dependencies/IPlug
73+
./download-iplug-sdks.sh
74+
75+
- name: CMake Generate (Xcode Universal)
76+
run: |
77+
cmake -G Xcode -B build-xcode-universal -S . -DIPLUG2_UNIVERSAL=ON
78+
test -d build-xcode-universal/iPlug2OOS.xcodeproj
79+
80+
- name: Build (Xcode Universal)
81+
run: |
82+
xcodebuild -project build-xcode-universal/iPlug2OOS.xcodeproj \
83+
-scheme ALL_BUILD \
84+
-configuration Release \
85+
-destination "generic/platform=macOS" \
86+
-quiet
87+
88+
- name: Verify Universal Binaries
89+
run: |
90+
APP_EXEC="build-xcode-universal/out/Release/${{env.PROJECT_NAME}}.app/Contents/MacOS/${{env.PROJECT_NAME}}"
91+
ARCHS=$(lipo -archs "$APP_EXEC")
92+
echo "APP architectures: $ARCHS"
93+
[[ "$ARCHS" == *"arm64"* ]] && [[ "$ARCHS" == *"x86_64"* ]] || exit 1
94+
echo "Universal binary verified"
95+
96+
# ==========================================================================
97+
# macOS - Ninja Generator
98+
# ==========================================================================
99+
macos-ninja:
100+
name: macOS Ninja
101+
runs-on: macos-latest
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v4
105+
with:
106+
submodules: recursive
107+
108+
- name: Install Ninja
109+
run: brew install ninja
110+
111+
- name: Get SDKs
112+
run: |
113+
cd iPlug2/Dependencies/IPlug
114+
./download-iplug-sdks.sh
115+
116+
- name: CMake Generate (Ninja)
117+
run: |
118+
cmake -G Ninja -B build-ninja -S . -DCMAKE_BUILD_TYPE=Release
119+
test -f build-ninja/build.ninja
120+
121+
- name: Build (Ninja)
122+
run: ninja -C build-ninja
123+
124+
- name: Verify Bundles
125+
run: |
126+
test -d build-ninja/out/${{env.PROJECT_NAME}}.app
127+
test -d build-ninja/out/${{env.PROJECT_NAME}}.vst3
128+
test -d build-ninja/out/${{env.PROJECT_NAME}}.clap
129+
test -d build-ninja/out/${{env.PROJECT_NAME}}.component
130+
echo "All bundles exist"
131+
132+
# ==========================================================================
133+
# macOS - Unix Makefiles Generator
134+
# ==========================================================================
135+
macos-make:
136+
name: macOS Make
137+
runs-on: macos-latest
138+
steps:
139+
- name: Checkout
140+
uses: actions/checkout@v4
141+
with:
142+
submodules: recursive
143+
144+
- name: Get SDKs
145+
run: |
146+
cd iPlug2/Dependencies/IPlug
147+
./download-iplug-sdks.sh
148+
149+
- name: CMake Generate (Make)
150+
run: |
151+
cmake -G "Unix Makefiles" -B build-make -S . -DCMAKE_BUILD_TYPE=Release
152+
test -f build-make/Makefile
153+
154+
- name: Build (Make)
155+
run: make -C build-make -j$(sysctl -n hw.ncpu)
156+
157+
- name: Verify Bundles
158+
run: |
159+
test -d build-make/out/${{env.PROJECT_NAME}}.app
160+
test -d build-make/out/${{env.PROJECT_NAME}}.vst3
161+
test -d build-make/out/${{env.PROJECT_NAME}}.clap
162+
test -d build-make/out/${{env.PROJECT_NAME}}.component
163+
echo "All bundles exist"
164+
165+
# ==========================================================================
166+
# macOS - iOS (Xcode)
167+
# ==========================================================================
168+
macos-ios:
169+
name: macOS iOS
170+
runs-on: macos-latest
171+
steps:
172+
- name: Checkout
173+
uses: actions/checkout@v4
174+
with:
175+
submodules: recursive
176+
177+
- name: Get SDKs
178+
run: |
179+
cd iPlug2/Dependencies/IPlug
180+
./download-iplug-sdks.sh
181+
182+
- name: CMake Generate (iOS)
183+
run: |
184+
cmake -G Xcode -B build-ios -S . \
185+
-DCMAKE_SYSTEM_NAME=iOS \
186+
-DCMAKE_OSX_DEPLOYMENT_TARGET=15.0
187+
test -d build-ios/iPlug2OOS.xcodeproj
188+
189+
- name: Build (iOS Simulator)
190+
run: |
191+
xcodebuild -project build-ios/iPlug2OOS.xcodeproj \
192+
-scheme ALL_BUILD \
193+
-configuration Release \
194+
-destination "generic/platform=iOS Simulator" \
195+
-quiet
196+
197+
- name: Verify iOS App
198+
run: |
199+
test -d "build-ios/out/Release-iphonesimulator/${{env.PROJECT_NAME}}.app"
200+
echo "iOS app bundle exists"
201+
202+
# ==========================================================================
203+
# Windows - Visual Studio Generator (disabled for now)
204+
# ==========================================================================
205+
# windows-vs:
206+
# name: Windows VS2022
207+
# runs-on: windows-latest
208+
# steps:
209+
# - name: Checkout
210+
# uses: actions/checkout@v4
211+
# with:
212+
# submodules: recursive
213+
214+
# - name: Get SDKs
215+
# shell: bash
216+
# run: |
217+
# cd iPlug2/Dependencies/IPlug
218+
# ./download-iplug-sdks.sh
219+
220+
# - name: CMake Generate (VS2022)
221+
# run: |
222+
# cmake -G "Visual Studio 17 2022" -A x64 -B build-vs -S .
223+
# if (!(Test-Path "build-vs\iPlug2OOS.sln")) { exit 1 }
224+
# shell: pwsh
225+
226+
# - name: Build (VS2022)
227+
# run: cmake --build build-vs --config Release
228+
229+
# - name: Verify Bundles
230+
# run: |
231+
# if (!(Test-Path "build-vs\out\Release\${{env.PROJECT_NAME}}.vst3")) { exit 1 }
232+
# if (!(Test-Path "build-vs\out\Release\${{env.PROJECT_NAME}}.clap")) { exit 1 }
233+
# echo "All bundles exist"
234+
# shell: pwsh
235+
236+
# ==========================================================================
237+
# Windows - Ninja Generator (disabled for now)
238+
# ==========================================================================
239+
# windows-ninja:
240+
# name: Windows Ninja
241+
# runs-on: windows-latest
242+
# steps:
243+
# - name: Checkout
244+
# uses: actions/checkout@v4
245+
# with:
246+
# submodules: recursive
247+
248+
# - name: Get SDKs
249+
# shell: bash
250+
# run: |
251+
# cd iPlug2/Dependencies/IPlug
252+
# ./download-iplug-sdks.sh
253+
254+
# - name: Setup MSVC
255+
# uses: ilammy/msvc-dev-cmd@v1
256+
257+
# - name: CMake Generate (Ninja)
258+
# run: |
259+
# cmake -G Ninja -B build-ninja -S . -DCMAKE_BUILD_TYPE=Release
260+
# if (!(Test-Path "build-ninja\build.ninja")) { exit 1 }
261+
# shell: pwsh
262+
263+
# - name: Build (Ninja)
264+
# run: ninja -C build-ninja
265+
266+
# - name: Verify Bundles
267+
# run: |
268+
# if (!(Test-Path "build-ninja\out\${{env.PROJECT_NAME}}.vst3")) { exit 1 }
269+
# if (!(Test-Path "build-ninja\out\${{env.PROJECT_NAME}}.clap")) { exit 1 }
270+
# echo "All bundles exist"
271+
# shell: pwsh
272+
273+
# ==========================================================================
274+
# Emscripten - WAM Build
275+
# ==========================================================================
276+
emscripten-wam:
277+
name: Emscripten WAM
278+
runs-on: ubuntu-latest
279+
steps:
280+
- name: Checkout
281+
uses: actions/checkout@v4
282+
with:
283+
submodules: recursive
284+
285+
- name: Setup Python
286+
uses: actions/setup-python@v5
287+
with:
288+
python-version: '3.x'
289+
290+
- name: Setup Emscripten
291+
uses: mymindstorm/setup-emsdk@v14
292+
293+
- name: Patch emcc.py
294+
run: |
295+
sed -i.bak s,"if not js_manipulation.isidentifier(settings.EXPORT_NAME):","if False:",g $EMSDK/upstream/emscripten/emcc.py
296+
297+
- name: Get WAM SDK
298+
run: |
299+
cd iPlug2/Dependencies/IPlug
300+
./download-iplug-sdks.sh
301+
302+
- name: CMake Generate (Emscripten)
303+
run: |
304+
emcmake cmake -B build-web -S ${{env.PROJECT_NAME}}
305+
test -f build-web/build.ninja
306+
307+
- name: Build WAM
308+
run: cmake --build build-web
309+
310+
- name: Verify WAM Output
311+
run: |
312+
test -f build-web/out/${{env.PROJECT_NAME}}/index.html
313+
test -f build-web/out/${{env.PROJECT_NAME}}/scripts/${{env.PROJECT_NAME}}-wam.js
314+
test -f build-web/out/${{env.PROJECT_NAME}}/scripts/${{env.PROJECT_NAME}}-web.js
315+
test -f build-web/out/${{env.PROJECT_NAME}}/scripts/${{env.PROJECT_NAME}}-web.wasm
316+
echo "WAM distribution verified"
317+
318+
- name: Upload WAM Artifact
319+
uses: actions/upload-artifact@v4
320+
with:
321+
name: ${{env.PROJECT_NAME}}-wam
322+
path: build-web/out/${{env.PROJECT_NAME}}

0 commit comments

Comments
 (0)