sqlite-web 0.7.2
gitea.db
action_run_job
Create
Query
access
access_token
action
action_artifact
action_run
action_run_index
action_run_job
action_runner
action_runner_token
action_schedule
action_schedule_spec
action_task
action_task_output
action_task_step
action_tasks_version
action_variable
app_state
attachment
auth_token
badge
branch
collaboration
comment
commit_status
commit_status_index
commit_status_summary
commit_sync_log
commit_sync_status
dbfs_data
dbfs_meta
deploy_key
email_address
email_hash
external_login_user
follow
gpg_key
gpg_key_import
hook_task
issue
issue_assignees
issue_content_history
issue_dependency
issue_index
issue_label
issue_pin
issue_user
issue_watch
label
language_stat
lfs_lock
lfs_meta_object
login_source
milestone
mirror
notice
notification
oauth2_application
oauth2_authorization_code
oauth2_grant
org_user
package
package_blob
package_blob_upload
package_cleanup_rule
package_file
package_property
package_version
project
project_board
project_issue
protected_branch
protected_tag
public_key
pull_auto_merge
pull_request
push_mirror
reaction
release
renamed_branch
repo_archiver
repo_hidden_file
repo_indexer_status
repo_license
repo_redirect
repo_topic
repo_transfer
repo_unit
repository
review
review_state
secret
session
sqlite_sequence
star
stopwatch
system_setting
task
team
team_invite
team_repo
team_unit
team_user
topic
tracked_time
two_factor
upload
user
user_badge
user_blocking
user_open_id
user_redirect
user_setting
version
watch
webauthn_credential
webhook
Toggle helper tables
Structure
Content
Query
Insert
Drop
Import
Export
Delete row 16459 from action_run_job
id
16459
run_id
11697
repo_id
6
owner_id
5
commit_sha
9d69e1960ec649a49c0c6f307c0fc197f47ee4c4
is_fork_pull_request
0
name
💥 压力测试
attempt
1
workflow_payload
name: Performance Tests "on": # 每周一凌晨
name: Performance Tests "on": # 每周一凌晨 2 点运行 schedule: - cron: '0 2 * * 1' # 允许手动触发 workflow_dispatch: inputs: test_type: description: '测试类型' required: true default: 'benchmark' type: choice options: - benchmark - load - stress - all duration: description: '测试持续时间(秒)' required: false default: '60' type: string concurrency: description: '并发数' required: false default: '10' type: string # PR 触发时只运行基准测试 pull_request: branches: [main] paths: - 'backend/src/**' - 'backend/prisma/**' env: NODE_VERSION: "18" PNPM_VERSION: "8" jobs: stress-test: name: "\U0001F4A5 压力测试" runs-on: ubuntu-latest if: needs.setup.outputs.test_type == 'stress' || needs.setup.outputs.test_type == 'all' steps: - name: "\U0001F4E5 检出代码" uses: actions/checkout@v4 - name: "\U0001F4E6 安装 pnpm" uses: pnpm/action-setup@v2 with: version: ${{ env.PNPM_VERSION }} - name: "\U0001F7E2 设置 Node.js" uses: actions/setup-node@v4 with: cache: pnpm node-version: ${{ env.NODE_VERSION }} - name: "\U0001F4E6 安装依赖" run: pnpm install --frozen-lockfile - name: "\U0001F527 安装 k6" run: | sudo gpg -k sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69 echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list sudo apt-get update sudo apt-get install k6 - name: "\U0001F5C4️ 初始化数据库" run: | cd backend npx prisma migrate deploy npx prisma db seed env: DATABASE_URL: postgresql://test:test@localhost:5432/juhi_stress - name: "\U0001F528 构建后端" run: | pnpm --filter shared build pnpm --filter backend build - name: "\U0001F680 启动后端服务" run: | cd backend npm run start & sleep 10 env: NODE_ENV: production PORT: 3000 DATABASE_URL: postgresql://test:test@localhost:5432/juhi_stress REDIS_URL: redis://localhost:6379 JWT_SECRET: stress-test-jwt-secret REFRESH_TOKEN_SECRET: stress-test-refresh-token - name: ⏳ 等待服务就绪 run: | timeout 60 bash -c 'until curl -s http://localhost:3000/health > /dev/null; do sleep 2; done' - name: "\U0001F4A5 运行压力测试" run: | mkdir -p stress-test-results # 创建 k6 压力测试脚本 cat > stress-test.js << 'EOF' import http from 'k6/http'; import { check, sleep } from 'k6'; import { Rate, Trend, Counter } from 'k6/metrics'; const errorRate = new Rate('errors'); const responseTime = new Trend('response_time'); const requestCount = new Counter('requests'); export const options = { stages: [ { duration: '1m', target: 20 }, // 预热 { duration: '2m', target: 100 }, // 逐步增加到 100 并发 { duration: '2m', target: 200 }, // 增加到 200 并发 { duration: '2m', target: 300 }, // 增加到 300 并发 { duration: '1m', target: 0 }, // 降低 ], thresholds: { http_req_duration: ['p(99)<2000'], // 99% 请求小于 2s errors: ['rate<0.3'], // 错误率小于 30% }, }; const BASE_URL = 'http://localhost:3000'; export default function () { requestCount.add(1); let res = http.get(`${BASE_URL}/health`); check(res, { 'status is 200': (r) => r.status === 200, 'response time < 1000ms': (r) => r.timings.duration < 1000, }); errorRate.add(res.status !== 200); responseTime.add(res.timings.duration); sleep(0.05); } EOF k6 run --out json=stress-test-results/results.json stress-test.js || true - name: "\U0001F4CA 分析压力测试结果" run: "echo \"## \U0001F4A5 压力测试报告\" >> $GITHUB_STEP_SUMMARY\necho \"\" >> $GITHUB_STEP_SUMMARY\necho \"### 测试目标\" >> $GITHUB_STEP_SUMMARY\necho \"- 最大并发: 300\" >> $GITHUB_STEP_SUMMARY\necho \"- 持续时间: 8 分钟\" >> $GITHUB_STEP_SUMMARY\necho \"\" >> $GITHUB_STEP_SUMMARY\n\nif [ -f \"stress-test-results/results.json\" ]; then\n echo \"### 结果分析\" >> $GITHUB_STEP_SUMMARY\n\n max_vus=$(cat stress-test-results/results.json | jq -s 'max_by(.data.value | numbers) | .data.value // 0' 2>/dev/null || echo \"N/A\")\n echo \"- 最大达到 VUs: $max_vus\" >> $GITHUB_STEP_SUMMARY\nfi\n" - name: "\U0001F4E4 上传压力测试结果" uses: actions/upload-artifact@v4 with: name: stress-test-results path: stress-test-results/ retention-days: "30" timeout-minutes: "60" services: postgres: image: postgres:15 env: POSTGRES_DB: juhi_stress POSTGRES_PASSWORD: test POSTGRES_USER: test ports: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 redis: image: redis:7 ports: - 6379:6379
...
job_id
stress-test
needs
["setup"]
runs_on
["ubuntu-latest"]
task_id
13753
status
2
started
1775441168
stopped
1775441259
created
1775440818
updated
1775441259
raw_concurrency
is_concurrency_evaluated
1
concurrency_group
concurrency_cancel
0
Delete
Cancel