Skip to content

Commit 4ac83bf

Browse files
committed
Add smoke test for mac app
1 parent f1717b4 commit 4ac83bf

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/build-electron.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,49 @@ jobs:
227227
else
228228
npx electron-builder --mac zip:x64 zip:arm64 --projectDir dist
229229
fi
230+
- name: Test Electron app
231+
run: |
232+
echo "Extracting macOS app for testing..."
233+
cd dist/bld/Electron
234+
235+
# Find the first zip file (prefer x64 if available)
236+
ZIP_FILE=$(ls -1 *.zip | head -1)
237+
echo "Found zip file: $ZIP_FILE"
238+
239+
# Extract the zip file
240+
unzip -q "$ZIP_FILE"
241+
242+
# Find the .app bundle
243+
APP_BUNDLE=$(find . -name "*.app" -type d | head -1)
244+
echo "Found app bundle: $APP_BUNDLE"
245+
246+
if [ -z "$APP_BUNDLE" ]; then
247+
echo "Error: No .app bundle found!"
248+
exit 1
249+
fi
250+
251+
# Remove quarantine attribute (required for CI)
252+
xattr -dr com.apple.quarantine "$APP_BUNDLE" || true
253+
254+
# Start Electron app with CI-friendly flags
255+
"$APP_BUNDLE/Contents/MacOS/Kiwix JS Electron" \
256+
--headless \
257+
--disable-gpu-sandbox \
258+
--no-sandbox &
259+
260+
APP_PID=$!
261+
echo "Started app with PID: $APP_PID"
262+
263+
# Wait for app to start
264+
sleep 10
265+
266+
# Take screenshot to verify app started
267+
screencapture -x test-screenshot.png || echo "Screenshot failed (expected in CI)"
268+
269+
# Kill app
270+
kill $APP_PID || true
271+
272+
echo "Smoke test completed successfully"
230273
- name: Upload packages to Kiwix
231274
if: github.event.inputs.target != 'artefacts'
232275
run: |
@@ -241,6 +284,7 @@ jobs:
241284
name: kiwix-js-electron_macos
242285
path: |
243286
dist/bld/Electron/*.zip
287+
dist/bld/Electron/test-screenshot.png
244288
245289
Release_Windows:
246290
if: github.event.inputs.macosonly != 'true'

0 commit comments

Comments
 (0)