Skip to content

Commit 00abe5e

Browse files
committed
Add smoke test for Mac app
1 parent f1717b4 commit 00abe5e

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/build-electron.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,58 @@ jobs:
227227
else
228228
npx electron-builder --mac zip:x64 zip:arm64 --projectDir dist
229229
fi
230+
- name: Smoke test Electron app
231+
run: |
232+
echo "Extracting macOS app for testing..."
233+
cd dist/bld/Electron
234+
# Find the first zip file (prefer x64 if available)
235+
ZIP_FILE=$(ls -1 *.zip | head -1)
236+
echo "Found zip file: $ZIP_FILE"
237+
# Extract the zip file
238+
unzip -q "$ZIP_FILE"
239+
# Find the .app bundle
240+
APP_BUNDLE=$(find . -name "*.app" -type d | head -1)
241+
echo "Found app bundle: $APP_BUNDLE"
242+
if [ -z "$APP_BUNDLE" ]; then
243+
echo "Error: No .app bundle found!"
244+
exit 1
245+
fi
246+
# Remove quarantine attribute (required for CI)
247+
xattr -dr com.apple.quarantine "$APP_BUNDLE" || true
248+
# Test basic app launch (verify it can start without crashing)
249+
echo "Testing app launch..."
250+
"$APP_BUNDLE/Contents/MacOS/Kiwix JS Electron" \
251+
--disable-gpu-sandbox \
252+
--no-sandbox \
253+
--disable-web-security \
254+
--disable-dev-shm-usage \
255+
--no-first-run \
256+
--disable-default-apps &
257+
APP_PID=$!
258+
echo "Started app with PID: $APP_PID"
259+
# Wait for app to start and check if process is running
260+
sleep 8
261+
if kill -0 $APP_PID 2>/dev/null; then
262+
echo "✅ App process is running successfully"
263+
# Check if app is responsive by looking at process details
264+
echo "Process details:"
265+
ps -p $APP_PID -o pid,ppid,time,command || true
266+
echo "App is running and responsive"
267+
# Kill app gracefully
268+
kill -TERM $APP_PID 2>/dev/null || true
269+
sleep 3
270+
# Force kill if still running
271+
if kill -0 $APP_PID 2>/dev/null; then
272+
echo "Force killing app..."
273+
kill -KILL $APP_PID 2>/dev/null || true
274+
fi
275+
echo "✅ App launched and terminated successfully"
276+
else
277+
echo "❌ App process failed to start or crashed immediately"
278+
exit 1
279+
fi
280+
echo "Smoke test completed successfully"
281+
230282
- name: Upload packages to Kiwix
231283
if: github.event.inputs.target != 'artefacts'
232284
run: |

0 commit comments

Comments
 (0)