mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-12 08:30:08 +00:00
## Summary Standardize the repo's Node contract on 24 while centralizing workflow resolution through `.nvmrc` so local setup, CI, and package metadata stay aligned from one version file. ## Changes - **What**: Add `package.json` `engines.node = 24.x`, switch every `actions/setup-node` workflow in the repo to `node-version-file: '.nvmrc'`, and update contributor and Playwright docs to point to `.nvmrc` as the Node source of truth. ## Review Focus The workflow behavior should be unchanged apart from sourcing the Node version from `.nvmrc` instead of repeating literals like `20`, `22`, `24.x`, or `lts/*`. GitHub's formatter also moved the new `engines` block to the package metadata section near the end of `package.json`. --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
103 lines
3.4 KiB
YAML
103 lines
3.4 KiB
YAML
name: 'PR: Performance Report'
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ['CI: Performance Report']
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
comment:
|
|
runs-on: ubuntu-latest
|
|
if: >
|
|
github.repository == 'Comfy-Org/ComfyUI_frontend' &&
|
|
github.event.workflow_run.event == 'pull_request' &&
|
|
github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Download PR metadata
|
|
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v12
|
|
with:
|
|
name: perf-meta
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
path: temp/perf-meta/
|
|
|
|
- name: Resolve and validate PR metadata
|
|
id: pr-meta
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const artifactPr = Number(fs.readFileSync('temp/perf-meta/number.txt', 'utf8').trim());
|
|
const artifactBase = fs.readFileSync('temp/perf-meta/base.txt', 'utf8').trim();
|
|
|
|
// Resolve PR from trusted workflow context
|
|
let pr = context.payload.workflow_run.pull_requests?.[0];
|
|
if (!pr) {
|
|
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
commit_sha: context.payload.workflow_run.head_sha,
|
|
});
|
|
pr = prs.find(p => p.state === 'open');
|
|
}
|
|
|
|
if (!pr) {
|
|
core.setFailed('Unable to resolve PR from workflow_run context.');
|
|
return;
|
|
}
|
|
|
|
if (Number(pr.number) !== artifactPr) {
|
|
core.setFailed(`Artifact PR number (${artifactPr}) does not match trusted context (${pr.number}).`);
|
|
return;
|
|
}
|
|
|
|
const trustedBase = pr.base?.ref;
|
|
if (!trustedBase || artifactBase !== trustedBase) {
|
|
core.setFailed(`Artifact base (${artifactBase}) does not match trusted context (${trustedBase}).`);
|
|
return;
|
|
}
|
|
|
|
core.setOutput('number', String(pr.number));
|
|
core.setOutput('base', trustedBase);
|
|
|
|
- name: Download PR perf metrics
|
|
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v12
|
|
with:
|
|
name: perf-metrics
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
path: test-results/
|
|
|
|
- name: Download baseline perf metrics
|
|
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v12
|
|
with:
|
|
branch: ${{ steps.pr-meta.outputs.base }}
|
|
workflow: ci-perf-report.yaml
|
|
event: push
|
|
name: perf-metrics
|
|
path: temp/perf-baseline/
|
|
if_no_artifact_found: warn
|
|
|
|
- name: Generate perf report
|
|
run: npx --yes tsx scripts/perf-report.ts > perf-report.md
|
|
|
|
- name: Post PR comment
|
|
uses: ./.github/actions/post-pr-report-comment
|
|
with:
|
|
pr-number: ${{ steps.pr-meta.outputs.number }}
|
|
report-file: ./perf-report.md
|
|
comment-marker: '<!-- COMFYUI_FRONTEND_PERF -->'
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|