|
| 1 | +name: Test Builds |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ development, master ] |
| 6 | + pull_request: |
| 7 | + branches: [ development, master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-linux: |
| 11 | + name: Test Linux (Ubuntu) |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + fetch-depth: 0 |
| 17 | + |
| 18 | + - name: Setup Node.js v22 |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: 22 |
| 22 | + cache: 'yarn' |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: yarn install --frozen-lockfile --ignore-engines |
| 26 | + |
| 27 | + - name: Download IPFS |
| 28 | + run: node electron/download-ipfs && chmod +x bin/linux/ipfs |
| 29 | + |
| 30 | + - name: Build React App |
| 31 | + run: yarn build |
| 32 | + env: |
| 33 | + CI: '' |
| 34 | + |
| 35 | + - name: Build Electron App (Linux) |
| 36 | + run: yarn electron:build:linux |
| 37 | + |
| 38 | + - name: Smoke Test |
| 39 | + run: | |
| 40 | + echo "Testing AppImage startup..." |
| 41 | + APPIMAGE=$(find dist -name "*.AppImage" | head -n 1) |
| 42 | + echo "Found AppImage: $APPIMAGE" |
| 43 | + chmod +x "$APPIMAGE" |
| 44 | + # Use --appimage-extract-and-run to avoid FUSE requirement in CI |
| 45 | + # Run with timeout and expect it to start (will be killed after timeout) |
| 46 | + timeout 10s "$APPIMAGE" --appimage-extract-and-run --no-sandbox & |
| 47 | + APP_PID=$! |
| 48 | + sleep 5 |
| 49 | + # Check if process is still running (means it started successfully) |
| 50 | + if kill -0 $APP_PID 2>/dev/null; then |
| 51 | + echo "✓ App started successfully" |
| 52 | + kill $APP_PID 2>/dev/null || true |
| 53 | + exit 0 |
| 54 | + else |
| 55 | + echo "✗ App failed to start" |
| 56 | + exit 1 |
| 57 | + fi |
| 58 | +
|
| 59 | + test-mac-intel: |
| 60 | + name: Test Mac (Intel) |
| 61 | + runs-on: macos-15-intel |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + with: |
| 65 | + fetch-depth: 0 |
| 66 | + |
| 67 | + - name: Setup Node.js v22 |
| 68 | + uses: actions/setup-node@v4 |
| 69 | + with: |
| 70 | + node-version: 22 |
| 71 | + cache: 'yarn' |
| 72 | + |
| 73 | + - name: Install setuptools for native modules |
| 74 | + run: | |
| 75 | + # Use pip with --break-system-packages for CI environment |
| 76 | + pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true |
| 77 | +
|
| 78 | + - name: Install dependencies |
| 79 | + run: yarn install --frozen-lockfile --ignore-engines |
| 80 | + |
| 81 | + - name: Download IPFS |
| 82 | + run: node electron/download-ipfs && chmod +x bin/mac/ipfs |
| 83 | + |
| 84 | + - name: Build React App |
| 85 | + run: yarn build |
| 86 | + env: |
| 87 | + CI: '' |
| 88 | + |
| 89 | + - name: Build Electron App |
| 90 | + run: yarn electron:build:mac |
| 91 | + |
| 92 | + - name: Smoke Test |
| 93 | + run: | |
| 94 | + if [ -d "dist/mac/5chan.app" ]; then |
| 95 | + echo "Testing dist/mac/5chan.app..." |
| 96 | + # Run the app in background - it will start IPFS which takes time |
| 97 | + # We just verify it launches without crashing |
| 98 | + ./dist/mac/5chan.app/Contents/MacOS/5chan & |
| 99 | + APP_PID=$! |
| 100 | + sleep 10 |
| 101 | + # Check if process is still running (means it started successfully) |
| 102 | + if kill -0 $APP_PID 2>/dev/null; then |
| 103 | + echo "✓ App started successfully" |
| 104 | + kill $APP_PID 2>/dev/null || true |
| 105 | + # Also kill any child processes (IPFS) |
| 106 | + pkill -P $APP_PID 2>/dev/null || true |
| 107 | + pkill -f ipfs 2>/dev/null || true |
| 108 | + exit 0 |
| 109 | + else |
| 110 | + echo "✗ App failed to start or crashed" |
| 111 | + exit 1 |
| 112 | + fi |
| 113 | + else |
| 114 | + echo "Could not find dist/mac/5chan.app to test" |
| 115 | + ls -R dist |
| 116 | + exit 1 |
| 117 | + fi |
| 118 | +
|
| 119 | + test-mac-arm: |
| 120 | + name: Test Mac (Apple Silicon) |
| 121 | + runs-on: macOS-14 |
| 122 | + steps: |
| 123 | + - uses: actions/checkout@v4 |
| 124 | + with: |
| 125 | + fetch-depth: 0 |
| 126 | + |
| 127 | + - name: Setup Node.js v22 |
| 128 | + uses: actions/setup-node@v4 |
| 129 | + with: |
| 130 | + node-version: 22 |
| 131 | + cache: 'yarn' |
| 132 | + |
| 133 | + - name: Install setuptools for native modules |
| 134 | + run: | |
| 135 | + # Use pip with --break-system-packages for CI environment |
| 136 | + pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true |
| 137 | +
|
| 138 | + - name: Install dependencies |
| 139 | + run: yarn install --frozen-lockfile --ignore-engines |
| 140 | + |
| 141 | + - name: Download IPFS |
| 142 | + run: node electron/download-ipfs && chmod +x bin/mac/ipfs |
| 143 | + |
| 144 | + - name: Build React App |
| 145 | + run: yarn build |
| 146 | + env: |
| 147 | + CI: '' |
| 148 | + |
| 149 | + - name: Build Electron App |
| 150 | + # On M1 runner, this should produce arm64 build |
| 151 | + run: yarn electron:build:mac |
| 152 | + |
| 153 | + - name: Smoke Test |
| 154 | + run: | |
| 155 | + if [ -d "dist/mac-arm64/5chan.app" ]; then |
| 156 | + APP_PATH="dist/mac-arm64/5chan.app" |
| 157 | + elif [ -d "dist/mac/5chan.app" ]; then |
| 158 | + APP_PATH="dist/mac/5chan.app" |
| 159 | + else |
| 160 | + echo "Could not find 5chan.app to test" |
| 161 | + ls -R dist |
| 162 | + exit 1 |
| 163 | + fi |
| 164 | + |
| 165 | + echo "Testing $APP_PATH..." |
| 166 | + # Run the app in background - it will start IPFS which takes time |
| 167 | + # We just verify it launches without crashing |
| 168 | + "./$APP_PATH/Contents/MacOS/5chan" & |
| 169 | + APP_PID=$! |
| 170 | + sleep 10 |
| 171 | + # Check if process is still running (means it started successfully) |
| 172 | + if kill -0 $APP_PID 2>/dev/null; then |
| 173 | + echo "✓ App started successfully" |
| 174 | + kill $APP_PID 2>/dev/null || true |
| 175 | + # Also kill any child processes (IPFS) |
| 176 | + pkill -P $APP_PID 2>/dev/null || true |
| 177 | + pkill -f ipfs 2>/dev/null || true |
| 178 | + exit 0 |
| 179 | + else |
| 180 | + echo "✗ App failed to start or crashed" |
| 181 | + exit 1 |
| 182 | + fi |
| 183 | +
|
| 184 | + test-windows: |
| 185 | + name: Test Windows |
| 186 | + runs-on: windows-2022 |
| 187 | + steps: |
| 188 | + - uses: actions/checkout@v4 |
| 189 | + with: |
| 190 | + fetch-depth: 0 |
| 191 | + |
| 192 | + - name: Setup Node.js v22 |
| 193 | + uses: actions/setup-node@v4 |
| 194 | + with: |
| 195 | + node-version: 22 |
| 196 | + cache: 'yarn' |
| 197 | + |
| 198 | + - name: Install dependencies |
| 199 | + run: yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 |
| 200 | + |
| 201 | + - name: Download IPFS |
| 202 | + run: node electron/download-ipfs |
| 203 | + |
| 204 | + - name: Build React App |
| 205 | + run: yarn build |
| 206 | + env: |
| 207 | + CI: '' |
| 208 | + |
| 209 | + - name: Build Electron App |
| 210 | + run: yarn electron:build:windows |
| 211 | + |
| 212 | + - name: Smoke Test |
| 213 | + shell: bash |
| 214 | + run: | |
| 215 | + # Try to find the unpacked executable first as it's easiest to run |
| 216 | + if [ -d "dist/win-unpacked" ]; then |
| 217 | + echo "Testing unpacked exe..." |
| 218 | + # Run with timeout - app starts IPFS so won't exit on its own |
| 219 | + timeout 15s ./dist/win-unpacked/5chan.exe & |
| 220 | + APP_PID=$! |
| 221 | + sleep 8 |
| 222 | + # Check if process started successfully |
| 223 | + if kill -0 $APP_PID 2>/dev/null; then |
| 224 | + echo "✓ App started successfully" |
| 225 | + taskkill //F //PID $APP_PID 2>/dev/null || true |
| 226 | + # Kill any IPFS processes |
| 227 | + taskkill //F //IM ipfs.exe 2>/dev/null || true |
| 228 | + exit 0 |
| 229 | + else |
| 230 | + echo "✗ App failed to start" |
| 231 | + exit 1 |
| 232 | + fi |
| 233 | + else |
| 234 | + echo "No unpacked directory found" |
| 235 | + ls -R dist |
| 236 | + exit 1 |
| 237 | + fi |
| 238 | +
|
| 239 | + test-android: |
| 240 | + name: Test Android |
| 241 | + runs-on: ubuntu-22.04 |
| 242 | + steps: |
| 243 | + - uses: actions/checkout@v4 |
| 244 | + with: |
| 245 | + fetch-depth: 0 |
| 246 | + |
| 247 | + - name: Setup Node.js v22 |
| 248 | + uses: actions/setup-node@v4 |
| 249 | + with: |
| 250 | + node-version: 22 |
| 251 | + cache: 'yarn' |
| 252 | + |
| 253 | + - name: Setup Java 17 |
| 254 | + uses: actions/setup-java@v4 |
| 255 | + with: |
| 256 | + distribution: 'temurin' |
| 257 | + java-version: '17' |
| 258 | + |
| 259 | + - name: Install dependencies |
| 260 | + run: yarn install --frozen-lockfile --ignore-engines |
| 261 | + |
| 262 | + - name: Build React App |
| 263 | + run: yarn build |
| 264 | + env: |
| 265 | + CI: '' |
| 266 | + |
| 267 | + - name: Sync Capacitor |
| 268 | + run: npx cap sync android |
| 269 | + |
| 270 | + - name: Build Android APK |
| 271 | + run: | |
| 272 | + cd android |
| 273 | + chmod +x gradlew |
| 274 | + ./gradlew assembleDebug |
| 275 | +
|
| 276 | + - name: Verify APK exists |
| 277 | + run: | |
| 278 | + APK=$(find android/app/build/outputs/apk -name "*.apk" | head -n 1) |
| 279 | + if [ -n "$APK" ]; then |
| 280 | + echo "✓ APK built successfully: $APK" |
| 281 | + ls -lh "$APK" |
| 282 | + else |
| 283 | + echo "✗ No APK found" |
| 284 | + exit 1 |
| 285 | + fi |
0 commit comments