mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-04-09 15:22:26 -07:00
- Merge 3 defaultWiki scenarios into 1 (save 2 app launches) - Merge 2 scheduledTask scenarios into 1 (save 1 app launch) - Split CI test step into unit/prepare/e2e for visibility - Add pnpm store cache to CI - Fix viteEntry.ts: remove UTF-8 BOM, update stale JSDoc comment - Set E2E timeout to 22min (was 25min in single step)
87 lines
3.1 KiB
YAML
87 lines
3.1 KiB
YAML
name: Test
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: lts/*
|
|
cache: 'pnpm'
|
|
|
|
# Install C++ build tools for native modules (nsfw, better-sqlite3)
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Rebuild native modules for Electron
|
|
run: pnpm exec electron-rebuild -f -w better-sqlite3,nsfw
|
|
|
|
- name: Run linting
|
|
run: pnpm run lint --max-warnings 0
|
|
|
|
# Install minimal Linux dependencies for Electron GUI testing https://www.electronjs.org/docs/latest/tutorial/testing-on-headless-ci
|
|
- name: Install Linux GUI dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y xvfb
|
|
# Install Chinese fonts and locale support for i18n testing
|
|
sudo apt-get install -y fonts-noto-cjk fonts-wqy-zenhei language-pack-zh-hans
|
|
sudo locale-gen zh_CN.UTF-8
|
|
- name: Run unit tests
|
|
run: pnpm run test:unit
|
|
env:
|
|
CI: true
|
|
timeout-minutes: 5
|
|
- name: Prepare E2E
|
|
run: pnpm run test:prepare-e2e
|
|
env:
|
|
CI: true
|
|
timeout-minutes: 5
|
|
- name: Run E2E tests
|
|
# E2E GUI tests with Electron on Linux require a virtual framebuffer, upgrade screen size from time to time.
|
|
run: xvfb-run --auto-servernum --server-args="-screen 0 2560x1440x24" pnpm run test:e2e
|
|
env:
|
|
CI: true
|
|
DISPLAY: :99
|
|
# Set Chinese locale for i18n testing
|
|
LANG: zh_CN.UTF-8
|
|
LC_ALL: zh_CN.UTF-8
|
|
timeout-minutes: 22
|
|
|
|
# Upload test artifacts (screenshots, logs)
|
|
- name: Upload test artifacts
|
|
if: always()
|
|
run: |
|
|
mv test-artifacts test-artifacts-ci || true
|
|
# Remove large cache folders to save space, keep only logs and settings
|
|
find test-artifacts-ci -type d \( -name "Cache" -o -name "Code Cache" -o -name "GPUCache" -o -name "DawnGraphiteCache" -o -name "DawnWebGPUCache" -o -name "Crashpad" -o -name "cache-database" -o -name "DevToolsActivePort" -o -name "Dictionaries" -o -name "Local Storage" -o -name "Network Persistent State" -o -name "Partitions" -o -name "Session Storage" -o -name "Shared Dictionary" \) -exec rm -rf {} + || true
|
|
echo "Cleaned up test-artifacts-ci cache folders"
|
|
continue-on-error: true
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: test-artifacts-ci
|
|
path: |
|
|
test-artifacts-ci/**/logs/
|
|
test-artifacts-ci/**/settings/
|
|
test-artifacts-ci/**/screenshots/
|
|
retention-days: 7
|
|
continue-on-error: true
|