feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
name: Performance Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
performance-test:
|
||||
runs-on: macos-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
browser: [chromium, firefox, webkit]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps ${{ matrix.browser }}
|
||||
|
||||
- name: Build H5 app
|
||||
run: pnpm run build:h5
|
||||
|
||||
- name: Start H5 dev server
|
||||
run: |
|
||||
pnpm run dev:h5 &
|
||||
sleep 30
|
||||
|
||||
- name: Run page load performance tests
|
||||
run: npx playwright test e2e/performance/page-load.spec.ts --project=${{ matrix.browser }} --reporter=json --reporter-file=test-results/performance/page-load-${{ matrix.browser }}.json
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run animation performance tests
|
||||
run: npx playwright test e2e/performance/animation.spec.ts --project=${{ matrix.browser }} --reporter=json --reporter-file=test-results/performance/animation-${{ matrix.browser }}.json
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate performance summary
|
||||
if: always()
|
||||
run: node e2e/performance/run-tests.js summary
|
||||
|
||||
- name: Upload performance test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: performance-test-results-${{ matrix.browser }}
|
||||
path: test-results/performance/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload performance summary
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: performance-summary
|
||||
path: test-results/performance/performance-summary.txt
|
||||
retention-days: 30
|
||||
|
||||
- name: Comment performance results on PR
|
||||
if: github.event_name == 'pull_request' && always()
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const summaryPath = 'test-results/performance/performance-summary.txt';
|
||||
|
||||
if (fs.existsSync(summaryPath)) {
|
||||
const summary = fs.readFileSync(summaryPath, 'utf-8');
|
||||
const output = `## 性能测试结果\n\n\`\`\`\n${summary}\n\`\`\``;
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: output
|
||||
});
|
||||
}
|
||||
|
||||
performance-compare:
|
||||
runs-on: macos-latest
|
||||
needs: performance-test
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download base performance results
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: performance-summary
|
||||
path: base-results/
|
||||
continue-on-error: true
|
||||
|
||||
- name: Download current performance results
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: performance-summary
|
||||
path: current-results/
|
||||
|
||||
- name: Compare performance results
|
||||
if: hashFiles('base-results/performance-summary.txt') != hashFiles('current-results/performance-summary.txt')
|
||||
run: |
|
||||
echo "性能对比分析"
|
||||
echo "==============="
|
||||
echo ""
|
||||
echo "基线性能:"
|
||||
cat base-results/performance-summary.txt || echo "无基线数据"
|
||||
echo ""
|
||||
echo "当前性能:"
|
||||
cat current-results/performance-summary.txt
|
||||
echo ""
|
||||
echo "性能变化:"
|
||||
echo "TODO: 实现性能对比逻辑"
|
||||
Reference in New Issue
Block a user