mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
169 lines
6.8 KiB
YAML
169 lines
6.8 KiB
YAML
name: Event Log Race Repro
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main, stable]
|
|
types: [opened, reopened, synchronize, labeled]
|
|
workflow_dispatch:
|
|
inputs:
|
|
attempts:
|
|
description: 'Number of hook/sleep workflow runs to start'
|
|
required: false
|
|
default: '1500'
|
|
step_fanout_attempts:
|
|
description: 'Number of parallel-step fanout workflow runs to start'
|
|
required: false
|
|
default: '250'
|
|
step_sleep_race_attempts:
|
|
description: 'Number of step/sleep race workflow runs to start'
|
|
required: false
|
|
default: '250'
|
|
concurrency:
|
|
description: 'Number of concurrent workflow runs'
|
|
required: false
|
|
default: '50'
|
|
step_concurrency:
|
|
description: 'Number of concurrent step-heavy workflow runs'
|
|
required: false
|
|
default: '50'
|
|
iterations:
|
|
description: 'Hook/sleep race iterations per workflow run (ceiling; the run returns as soon as the wake branch wins, so this mainly widens the window for the resume to land before the sleep budget is exhausted)'
|
|
required: false
|
|
default: '8'
|
|
run_timeout_ms:
|
|
description: 'Per-run timeout before classifying as stuck'
|
|
required: false
|
|
default: '150000'
|
|
sleep_ms:
|
|
description: 'Workflow sleep duration in the hook/sleep race'
|
|
required: false
|
|
default: '5000'
|
|
resume_delay_ms:
|
|
description: 'Base delay before resuming the hook'
|
|
required: false
|
|
default: '15000'
|
|
resume_jitter_ms:
|
|
description: 'Additional random hook resume delay'
|
|
required: false
|
|
default: '10000'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/stable' }}
|
|
|
|
jobs:
|
|
event-log-race-repro:
|
|
name: Event Log Race Repro
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 120
|
|
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'event-log-race-repro') }}
|
|
permissions:
|
|
contents: read
|
|
deployments: read
|
|
statuses: read
|
|
id-token: write
|
|
issues: write
|
|
pull-requests: write
|
|
env:
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
WORKFLOW_PUBLIC_MANIFEST: '1'
|
|
WORKFLOW_NEXT_LAZY_DISCOVERY: '0'
|
|
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Setup environment
|
|
uses: ./.github/actions/setup-workflow-dev
|
|
with:
|
|
build-packages: 'false'
|
|
|
|
- name: Build CLI
|
|
run: pnpm turbo run build --filter='@workflow/cli'
|
|
|
|
- name: Wait for Vercel deployment
|
|
id: waitForDeployment
|
|
uses: vercel/wait-for-deployment-action@0e2b0c5c5cce31f1648108aeec56467187aca037
|
|
with:
|
|
project-slug: example-nextjs-workflow-turbopack
|
|
timeout: 1000
|
|
check-interval: 15
|
|
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
|
|
|
|
- name: Run event log race repro
|
|
id: repro
|
|
continue-on-error: true
|
|
run: pnpm run test:e2e:event-log-race-repro --reporter=default
|
|
env:
|
|
NODE_OPTIONS: "--enable-source-maps"
|
|
DEPLOYMENT_URL: ${{ steps.waitForDeployment.outputs.deployment-url }}
|
|
VERCEL_DEPLOYMENT_ID: ${{ steps.waitForDeployment.outputs.deployment-id }}
|
|
APP_NAME: nextjs-turbopack
|
|
WORKFLOW_VERCEL_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
|
|
WORKFLOW_VERCEL_AUTH_TOKEN: ${{ secrets.VERCEL_LABS_TOKEN }}
|
|
WORKFLOW_VERCEL_TEAM: "team_nO2mCG4W8IxPIeKoSsqwAxxB"
|
|
WORKFLOW_VERCEL_PROJECT: "prj_yjkM7UdHliv8bfxZ1sMJQf1pMpdi"
|
|
WORKFLOW_VERCEL_PROJECT_SLUG: example-nextjs-workflow-turbopack
|
|
VERCEL_WORKFLOW_SERVER_URL: ${{ github.ref != 'refs/heads/main' && secrets.VERCEL_WORKFLOW_SERVER_URL || '' }}
|
|
EVENT_LOG_RACE_REPRO_ATTEMPTS: ${{ inputs.attempts || '1500' }}
|
|
EVENT_LOG_RACE_REPRO_STEP_FANOUT_ATTEMPTS: ${{ inputs.step_fanout_attempts || '250' }}
|
|
EVENT_LOG_RACE_REPRO_STEP_SLEEP_RACE_ATTEMPTS: ${{ inputs.step_sleep_race_attempts || '250' }}
|
|
EVENT_LOG_RACE_REPRO_CONCURRENCY: ${{ inputs.concurrency || '50' }}
|
|
EVENT_LOG_RACE_REPRO_STEP_CONCURRENCY: ${{ inputs.step_concurrency || '50' }}
|
|
EVENT_LOG_RACE_REPRO_ITERATIONS: ${{ inputs.iterations || '8' }}
|
|
EVENT_LOG_RACE_REPRO_RUN_TIMEOUT_MS: ${{ inputs.run_timeout_ms || '150000' }}
|
|
EVENT_LOG_RACE_REPRO_SLEEP_MS: ${{ inputs.sleep_ms || '5000' }}
|
|
EVENT_LOG_RACE_REPRO_RESUME_DELAY_MS: ${{ inputs.resume_delay_ms || '15000' }}
|
|
EVENT_LOG_RACE_REPRO_RESUME_JITTER_MS: ${{ inputs.resume_jitter_ms || '10000' }}
|
|
|
|
- name: Fetch previous repro comment
|
|
if: always() && github.event_name == 'pull_request'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
gh api \
|
|
"repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments?per_page=100" \
|
|
--jq '[.[] | select(.body | contains("<!-- event-log-race-repro-results -->"))][-1].body // ""' \
|
|
> event-log-race-repro-previous-comment.md
|
|
|
|
- name: Render repro summary
|
|
if: always()
|
|
run: |
|
|
previous_comment_args=()
|
|
if [ -f event-log-race-repro-previous-comment.md ]; then
|
|
previous_comment_args=(--previous-comment event-log-race-repro-previous-comment.md)
|
|
fi
|
|
|
|
node .github/scripts/render-event-log-race-repro-results.js \
|
|
event-log-race-repro-results.json \
|
|
--run-url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|
|
--run-attempt "${{ github.run_attempt }}" \
|
|
--timestamp "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
|
"${previous_comment_args[@]}" \
|
|
| tee event-log-race-repro-summary.md >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Update PR comment
|
|
if: always() && github.event_name == 'pull_request'
|
|
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
|
|
with:
|
|
header: event-log-race-repro-results
|
|
path: event-log-race-repro-summary.md
|
|
|
|
- name: Upload repro results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: event-log-race-repro-results
|
|
path: |
|
|
event-log-race-repro-results.json
|
|
event-log-race-repro-summary.md
|
|
retention-days: 7
|
|
if-no-files-found: ignore
|
|
|
|
- name: Fail on corrupted, failed, or stuck runs
|
|
if: always()
|
|
run: node .github/scripts/render-event-log-race-repro-results.js event-log-race-repro-results.json --check
|