feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
name: E2E Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
jobs:
|
||||
e2e-test:
|
||||
runs-on: ubuntu-latest
|
||||
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
|
||||
|
||||
- name: Run E2E tests
|
||||
run: pnpm run test:e2e
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: test-results/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload test screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-screenshots
|
||||
path: test-results/
|
||||
retention-days: 30
|
||||
@@ -0,0 +1,61 @@
|
||||
name: Mini Program Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
miniprogram-test:
|
||||
runs-on: ubuntu-latest
|
||||
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
|
||||
|
||||
- name: Build mini program
|
||||
run: pnpm run build:mp-weixin
|
||||
|
||||
- name: Run mini program tests
|
||||
run: pnpm run test:miniprogram
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-miniprogram-report
|
||||
path: test-results/miniprogram/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: miniprogram-screenshots
|
||||
path: test-results/miniprogram/screenshots/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload videos
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: miniprogram-videos
|
||||
path: test-results/miniprogram/videos/
|
||||
retention-days: 30
|
||||
@@ -0,0 +1,137 @@
|
||||
name: Mobile Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
mobile-test-android:
|
||||
runs-on: macos-latest
|
||||
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: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Create Android virtual device
|
||||
run: |
|
||||
echo "y" | sdkmanager "system-images;android-30;google_apis;x86_64"
|
||||
echo "no" | avdmanager create avd -n test_device -k "system-images;android-30;google_apis;x86_64" --force
|
||||
|
||||
- name: Start Android emulator
|
||||
run: |
|
||||
emulator -avd test_device -no-audio -no-window -no-snapshot -gpu swiftshader_indirect &
|
||||
adb wait-for-device
|
||||
adb shell input keyevent 82
|
||||
|
||||
- name: Build Android app
|
||||
run: pnpm run build:app
|
||||
|
||||
- name: Install Appium
|
||||
run: |
|
||||
npm install -g appium@2.11.3
|
||||
appium driver install uiautomator2
|
||||
|
||||
- name: Start Appium server
|
||||
run: |
|
||||
appium --port 4723 --relaxed-security &
|
||||
sleep 10
|
||||
|
||||
- name: Run Android tests
|
||||
run: pnpm run test:mobile:android
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: android-test-results
|
||||
path: test-results/mobile/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: android-screenshots
|
||||
path: test-results/mobile/screenshots/
|
||||
retention-days: 30
|
||||
|
||||
mobile-test-ios:
|
||||
runs-on: macos-latest
|
||||
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: Setup Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '15.0'
|
||||
|
||||
- name: Start iOS simulator
|
||||
run: |
|
||||
xcrun simctl boot "iPhone 15" || true
|
||||
xcrun simctl list devices
|
||||
|
||||
- name: Build iOS app
|
||||
run: pnpm run build:app
|
||||
|
||||
- name: Install Appium
|
||||
run: |
|
||||
npm install -g appium@2.11.3
|
||||
appium driver install xcuitest
|
||||
|
||||
- name: Start Appium server
|
||||
run: |
|
||||
appium --port 4723 --relaxed-security &
|
||||
sleep 10
|
||||
|
||||
- name: Run iOS tests
|
||||
run: pnpm run test:mobile:ios
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-test-results
|
||||
path: test-results/mobile/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-screenshots
|
||||
path: test-results/mobile/screenshots/
|
||||
retention-days: 30
|
||||
@@ -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: 实现性能对比逻辑"
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Unit Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
jobs:
|
||||
unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
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: Run unit tests
|
||||
run: pnpm run test
|
||||
|
||||
- name: Run unit tests with coverage
|
||||
run: pnpm run test:coverage
|
||||
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./coverage/coverage-final.json
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
Reference in New Issue
Block a user