mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
ci: add smoke-gated quality checks to the main pipeline
Replaced test.yml with ci.yml, added a built-app smoke runner in scripts/smoke-web-app.js, and inserted a release preflight so tags run the same core checks before packaging.
This commit is contained in:
@@ -0,0 +1,378 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [development, master]
|
||||
pull_request:
|
||||
branches: [development, master]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
HUSKY: '0'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
name: Quality + Smoke
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
for i in 1 2 3; do
|
||||
echo "yarn install attempt $i"
|
||||
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
|
||||
sleep 5
|
||||
[ "$i" = "3" ] && exit 1
|
||||
done
|
||||
|
||||
- name: Run Vitest
|
||||
run: yarn test --run
|
||||
|
||||
- name: Collect coverage
|
||||
run: yarn test:coverage
|
||||
|
||||
- name: Lint
|
||||
run: yarn lint
|
||||
|
||||
- name: Type check
|
||||
run: yarn type-check
|
||||
|
||||
- name: Build React app
|
||||
run: yarn build
|
||||
env:
|
||||
CI: ''
|
||||
|
||||
- name: Build preload script
|
||||
run: yarn build:preload
|
||||
|
||||
- name: Verify build outputs
|
||||
run: |
|
||||
ls -la build/ || exit 1
|
||||
ls -la build/electron/preload.cjs || exit 1
|
||||
ls -la build/index.html || exit 1
|
||||
|
||||
- name: Verify forge config
|
||||
run: node -e "import('./forge.config.js').then(c => console.log('Config loaded, makers:', c.default.makers?.length || 0)).catch(e => { console.error(e); process.exit(1); })"
|
||||
|
||||
- name: Run React Doctor
|
||||
run: yarn doctor
|
||||
|
||||
- name: Install Chromium for smoke tests
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Smoke test built web app
|
||||
run: node scripts/smoke-web-app.js --start-preview
|
||||
|
||||
- name: Upload coverage summary
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage-summary
|
||||
path: coverage/coverage-summary.json
|
||||
if-no-files-found: warn
|
||||
|
||||
android-build:
|
||||
name: Android Build
|
||||
runs-on: ubuntu-22.04
|
||||
needs: quality
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Java 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Setup Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
for i in 1 2 3; do
|
||||
echo "yarn install attempt $i"
|
||||
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
|
||||
sleep 5
|
||||
[ "$i" = "3" ] && exit 1
|
||||
done
|
||||
|
||||
- name: Build React app
|
||||
run: yarn build
|
||||
env:
|
||||
CI: ''
|
||||
|
||||
- name: Sync Capacitor Android project
|
||||
run: npx cap sync android
|
||||
|
||||
- name: Run Android unit tests and assemble debug APK
|
||||
run: cd android && ./gradlew testDebugUnitTest assembleDebug --stacktrace
|
||||
|
||||
package-linux:
|
||||
name: Package Linux (Ubuntu)
|
||||
runs-on: ubuntu-22.04
|
||||
needs: quality
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Cache electron binaries
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/electron
|
||||
key: ${{ runner.os }}-electron-v2-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: ${{ runner.os }}-electron-v2-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
for i in 1 2 3; do
|
||||
echo "yarn install attempt $i"
|
||||
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
|
||||
sleep 5
|
||||
[ "$i" = "3" ] && exit 1
|
||||
done
|
||||
|
||||
- name: Build React app
|
||||
run: yarn build
|
||||
env:
|
||||
CI: ''
|
||||
|
||||
- name: Build preload script
|
||||
run: yarn build:preload
|
||||
|
||||
- name: Verify build outputs
|
||||
run: |
|
||||
ls -la build/ || exit 1
|
||||
ls -la build/electron/preload.cjs || exit 1
|
||||
ls -la build/index.html || exit 1
|
||||
|
||||
- name: Package Electron app
|
||||
timeout-minutes: 30
|
||||
run: |
|
||||
set -o pipefail
|
||||
yarn electron-forge package 2>&1 | tee forge-output.log
|
||||
ls -la out/
|
||||
|
||||
- name: Verify executable
|
||||
run: |
|
||||
ls -la out/
|
||||
EXE=$(node scripts/find-forge-executable.js)
|
||||
echo "Found executable: $EXE"
|
||||
test -f "$EXE" && test -x "$EXE" && echo "Executable is valid"
|
||||
|
||||
package-mac-intel:
|
||||
name: Package Mac (Intel)
|
||||
runs-on: macos-15-intel
|
||||
needs: quality
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install setuptools for native modules
|
||||
run: pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true
|
||||
|
||||
- name: Cache electron binaries
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/Library/Caches/electron
|
||||
key: ${{ runner.os }}-electron-v2-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: ${{ runner.os }}-electron-v2-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
for i in 1 2 3; do
|
||||
echo "yarn install attempt $i"
|
||||
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
|
||||
sleep 5
|
||||
[ "$i" = "3" ] && exit 1
|
||||
done
|
||||
|
||||
- name: Build React app
|
||||
run: yarn build
|
||||
env:
|
||||
CI: ''
|
||||
|
||||
- name: Build preload script
|
||||
run: yarn build:preload
|
||||
|
||||
- name: Verify build outputs
|
||||
run: |
|
||||
ls -la build/ || exit 1
|
||||
ls -la build/electron/preload.cjs || exit 1
|
||||
ls -la build/index.html || exit 1
|
||||
|
||||
- name: Package Electron app
|
||||
timeout-minutes: 30
|
||||
run: |
|
||||
set -o pipefail
|
||||
yarn electron-forge package 2>&1 | tee forge-output.log
|
||||
ls -la out/
|
||||
|
||||
- name: Verify executable
|
||||
run: |
|
||||
ls -la out/
|
||||
EXE=$(node scripts/find-forge-executable.js)
|
||||
echo "Found executable: $EXE"
|
||||
test -f "$EXE" && test -x "$EXE" && echo "Executable is valid"
|
||||
|
||||
package-mac-arm:
|
||||
name: Package Mac (Apple Silicon)
|
||||
runs-on: macos-latest
|
||||
needs: quality
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install setuptools for native modules
|
||||
run: pip3 install --break-system-packages setuptools || pip3 install --user setuptools || true
|
||||
|
||||
- name: Cache electron binaries
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/Library/Caches/electron
|
||||
key: ${{ runner.os }}-electron-v2-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: ${{ runner.os }}-electron-v2-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
for i in 1 2 3; do
|
||||
echo "yarn install attempt $i"
|
||||
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
|
||||
sleep 5
|
||||
[ "$i" = "3" ] && exit 1
|
||||
done
|
||||
|
||||
- name: Build React app
|
||||
run: yarn build
|
||||
env:
|
||||
CI: ''
|
||||
|
||||
- name: Build preload script
|
||||
run: yarn build:preload
|
||||
|
||||
- name: Verify build outputs
|
||||
run: |
|
||||
ls -la build/ || exit 1
|
||||
ls -la build/electron/preload.cjs || exit 1
|
||||
ls -la build/index.html || exit 1
|
||||
|
||||
- name: Package Electron app
|
||||
timeout-minutes: 30
|
||||
run: |
|
||||
set -o pipefail
|
||||
yarn electron-forge package 2>&1 | tee forge-output.log
|
||||
ls -la out/
|
||||
|
||||
- name: Verify executable
|
||||
run: |
|
||||
ls -la out/
|
||||
EXE=$(node scripts/find-forge-executable.js)
|
||||
echo "Found executable: $EXE"
|
||||
test -f "$EXE" && test -x "$EXE" && echo "Executable is valid"
|
||||
|
||||
package-windows:
|
||||
name: Package Windows
|
||||
runs-on: windows-2022
|
||||
needs: quality
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Cache electron binaries
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/AppData/Local/electron/Cache
|
||||
key: ${{ runner.os }}-electron-v2-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: ${{ runner.os }}-electron-v2-
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
for i in 1 2 3; do
|
||||
echo "yarn install attempt $i"
|
||||
yarn install --frozen-lockfile --ignore-engines --network-timeout 100000 --network-concurrency 1 && break
|
||||
sleep 5
|
||||
[ "$i" = "3" ] && exit 1
|
||||
done
|
||||
|
||||
- name: Build React app
|
||||
shell: bash
|
||||
run: yarn build
|
||||
env:
|
||||
CI: ''
|
||||
|
||||
- name: Build preload script
|
||||
shell: bash
|
||||
run: yarn build:preload
|
||||
|
||||
- name: Verify build outputs
|
||||
shell: bash
|
||||
run: |
|
||||
ls -la build/ || exit 1
|
||||
ls -la build/electron/preload.cjs || exit 1
|
||||
ls -la build/index.html || exit 1
|
||||
|
||||
- name: Package Electron app
|
||||
shell: bash
|
||||
timeout-minutes: 30
|
||||
run: |
|
||||
set -o pipefail
|
||||
yarn electron-forge package 2>&1 | tee forge-output.log
|
||||
ls -la out/
|
||||
|
||||
- name: Verify executable
|
||||
shell: bash
|
||||
run: |
|
||||
ls -la out/
|
||||
EXE=$(node scripts/find-forge-executable.js)
|
||||
echo "Found executable: $EXE"
|
||||
test -f "$EXE" && test -x "$EXE" && echo "Executable is valid"
|
||||
Reference in New Issue
Block a user