fix(ci): fix test workflow failures on all platforms

This commit is contained in:
plebeius
2025-11-25 14:54:43 +01:00
parent 9e288ac2fe
commit 26278f92c6
+96 -37
View File
@@ -11,12 +11,12 @@ jobs:
name: Test Linux (Ubuntu)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v6
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
@@ -28,38 +28,52 @@ jobs:
run: node electron/download-ipfs && chmod +x bin/linux/ipfs
- name: Build React App
run: CI='' yarn build
run: yarn build
env:
CI: ''
- name: Build Electron App (Linux)
run: yarn electron:build:linux
- name: Smoke Test
run: |
sudo apt-get install -y xvfb
echo "Testing AppImage startup..."
APPIMAGE=$(find dist -name "*.AppImage" | head -n 1)
echo "Found AppImage: $APPIMAGE"
chmod +x "$APPIMAGE"
xvfb-run --auto-servernum "$APPIMAGE" --no-sandbox --version
# Use --appimage-extract-and-run to avoid FUSE requirement in CI
# Run with timeout and expect it to start (will be killed after timeout)
timeout 10s "$APPIMAGE" --appimage-extract-and-run --no-sandbox &
APP_PID=$!
sleep 5
# Check if process is still running (means it started successfully)
if kill -0 $APP_PID 2>/dev/null; then
echo "✓ App started successfully"
kill $APP_PID 2>/dev/null || true
exit 0
else
echo "✗ App failed to start"
exit 1
fi
test-mac-intel:
name: Test Mac (Intel)
runs-on: macOS-13
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- name: Install missing dep for sqlite
- name: Install setuptools for native modules
run: |
python3 -m ensurepip
pip3 install setuptools
# Use pip with --break-system-packages for CI environment
pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines
@@ -68,17 +82,33 @@ jobs:
run: node electron/download-ipfs && chmod +x bin/mac/ipfs
- name: Build React App
run: CI='' yarn build
run: yarn build
env:
CI: ''
- name: Build Electron App
run: yarn electron:build:mac
- name: Smoke Test
run: |
# Check if .app exists (electron-builder usually creates it before packaging)
if [ -d "dist/mac/5chan.app" ]; then
echo "Testing dist/mac/5chan.app..."
./dist/mac/5chan.app/Contents/MacOS/5chan --version
# Run the app with a timeout - it will start IPFS which takes time
# We just verify it launches without crashing
timeout 15s ./dist/mac/5chan.app/Contents/MacOS/5chan &
APP_PID=$!
sleep 8
# Check if process is still running (means it started successfully)
if kill -0 $APP_PID 2>/dev/null; then
echo "✓ App started successfully"
kill $APP_PID 2>/dev/null || true
# Also kill any child processes (IPFS)
pkill -P $APP_PID 2>/dev/null || true
exit 0
else
echo "✗ App failed to start or crashed"
exit 1
fi
else
echo "Could not find dist/mac/5chan.app to test"
ls -R dist
@@ -89,20 +119,20 @@ jobs:
name: Test Mac (Apple Silicon)
runs-on: macOS-14
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- name: Install missing dep for sqlite
- name: Install setuptools for native modules
run: |
python3 -m ensurepip
pip3 install setuptools
# Use pip with --break-system-packages for CI environment
pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines
@@ -111,7 +141,9 @@ jobs:
run: node electron/download-ipfs && chmod +x bin/mac/ipfs
- name: Build React App
run: CI='' yarn build
run: yarn build
env:
CI: ''
- name: Build Electron App
# On M1 runner, this should produce arm64 build
@@ -119,25 +151,44 @@ jobs:
- name: Smoke Test
run: |
if [ -d "dist/mac/5chan.app" ]; then
echo "Testing dist/mac/5chan.app..."
./dist/mac/5chan.app/Contents/MacOS/5chan --version
if [ -d "dist/mac-arm64/5chan.app" ]; then
APP_PATH="dist/mac-arm64/5chan.app"
elif [ -d "dist/mac/5chan.app" ]; then
APP_PATH="dist/mac/5chan.app"
else
echo "Could not find dist/mac/5chan.app to test"
echo "Could not find 5chan.app to test"
ls -R dist
exit 1
fi
echo "Testing $APP_PATH..."
# Run the app with a timeout - it will start IPFS which takes time
# We just verify it launches without crashing
timeout 15s "./$APP_PATH/Contents/MacOS/5chan" &
APP_PID=$!
sleep 8
# Check if process is still running (means it started successfully)
if kill -0 $APP_PID 2>/dev/null; then
echo "✓ App started successfully"
kill $APP_PID 2>/dev/null || true
# Also kill any child processes (IPFS)
pkill -P $APP_PID 2>/dev/null || true
exit 0
else
echo "✗ App failed to start or crashed"
exit 1
fi
test-windows:
name: Test Windows
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
@@ -149,7 +200,9 @@ jobs:
run: node electron/download-ipfs
- name: Build React App
run: CI='' yarn build
run: yarn build
env:
CI: ''
- name: Build Electron App
run: yarn electron:build:windows
@@ -160,17 +213,23 @@ jobs:
# Try to find the unpacked executable first as it's easiest to run
if [ -d "dist/win-unpacked" ]; then
echo "Testing unpacked exe..."
./dist/win-unpacked/5chan.exe --version
else
# Fallback to portable exe if unpacked not found
# Exclude Setup executables
EXE=$(find dist -name "*.exe" -not -name "*Setup*" | head -n 1)
if [ -n "$EXE" ]; then
echo "Testing portable exe: $EXE"
"$EXE" --version
# Run with timeout - app starts IPFS so won't exit on its own
timeout 15s ./dist/win-unpacked/5chan.exe &
APP_PID=$!
sleep 8
# Check if process started successfully
if kill -0 $APP_PID 2>/dev/null; then
echo "✓ App started successfully"
taskkill //F //PID $APP_PID 2>/dev/null || true
# Kill any IPFS processes
taskkill //F //IM ipfs.exe 2>/dev/null || true
exit 0
else
echo "No executable found to test"
ls -R dist
exit 1
echo "✗ App failed to start"
exit 1
fi
else
echo "No unpacked directory found"
ls -R dist
exit 1
fi