TidGi-Desktop/.github/workflows/test.yml
2025-06-12 22:50:45 +08:00

91 lines
2.4 KiB
YAML

name: Test
on:
workflow_call:
push:
branches:
- master
- develop
paths-ignore:
- 'README.md'
- 'docs/**'
- '.vscode'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- 'README.md'
- '.vscode'
jobs:
test:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 'latest'
run_install: false
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
%LOCALAPPDATA%/pnpm/store
~\.npm
key: test-${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
test-${{ runner.os }}-node-
- name: Install dependencies
run: pnpm install
- name: Run linting
run: pnpm run lint
continue-on-error: true
- name: Run unit tests
run: pnpm run test:unit
- name: Build plugins
run: pnpm run build:plugin
- name: Package for testing
run: pnpm run package
# Setup virtual display for Windows GUI testing
- name: Setup virtual display for Windows
run: |
# Enable desktop session for GUI applications
$ErrorActionPreference = "SilentlyContinue"
# Start necessary services
Start-Service -Name "Themes"
Start-Service -Name "AudioSrv"
# Configure registry for headless GUI
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers"
if (Test-Path $registryPath) {
Set-ItemProperty -Path $registryPath -Name "TdrLevel" -Value 0 -Type DWord -Force
}
# Enable software rendering for Electron
$env:ELECTRON_DISABLE_HARDWARE_ACCELERATION = "1"
$env:ELECTRON_ENABLE_LOGGING = "1"
Write-Output "Virtual display configured for Windows CI"
- name: Run e2e tests
run: pnpm run test:e2e
env:
CI: true
# Windows specific display settings
ELECTRON_ENABLE_LOGGING: true
ELECTRON_DISABLE_SECURITY_WARNINGS: true
ELECTRON_DISABLE_HARDWARE_ACCELERATION: true