chore: add isUpdating flag to prevent multiple re-renders #10484
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Performance check | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
comment-previews: | |
name: Comments preview URLs | |
# We can't currently run benchmarks on PRs from forked repos, because the | |
# tachometer action reports results by posting a comment, and we can't post | |
# comments without a github token. | |
if: github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/checkout@v4 | |
- name: Setup Node 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Post Previews | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { buildPreviewURLComment } = await import('${{ github.workspace }}/tasks/build-preview-urls-comment.js'); | |
const body = buildPreviewURLComment(process.env.GITHUB_HEAD_REF); | |
const { commentOrUpdate } = await import('${{ github.workspace }}/tasks/comment-or-update.js'); | |
commentOrUpdate(github, context, '## Branch preview', body); | |
lighthouse: | |
name: Lighthouse CI | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/checkout@v4 | |
- name: Setup Node 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=$(npx slugify-cli ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}})" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Lighthouse CI Action | |
id: lighthouse | |
uses: treosh/lighthouse-ci-action@v11 | |
with: | |
budgetPath: '.github/lighthouse/budgets.json' | |
configPath: '.github/lighthouse/lighthouserc.json' | |
runs: 3 | |
temporaryPublicStorage: true | |
uploadArtifacts: true | |
urls: | | |
https://opensource.adobe.com/spectrum-web-components/ | |
https://main--spectrum-web-components.netlify.app/ | |
https://${{ steps.extract_branch.outputs.branch }}--spectrum-web-components.netlify.app/ | |
- name: Post Results | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { buildLighthouseComment } = await import('${{ github.workspace }}/tasks/build-lighthouse-comment.js'); | |
const body = buildLighthouseComment(${{ steps.lighthouse.outputs.links }}, ${{ steps.lighthouse.outputs.manifest }}, ${{ steps.lighthouse.outputs.assertionResults }}); | |
const { commentOrUpdate } = await import('${{ github.workspace }}/tasks/comment-or-update.js'); | |
commentOrUpdate(github, context, '## Lighthouse scores', body); | |
compare-firefox: | |
name: Compare performance to latest release on Firefox | |
# We can't currently run benchmarks on PRs from forked repos, because the | |
# tachometer action reports results by posting a comment, and we can't post | |
# comments without a github token. | |
if: github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/checkout@v4 | |
- name: Setup Node 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- run: firefox --version | |
- name: Tachometer the changed packages | |
run: yarn test:changed --browser=firefox | |
- name: Make at least one results file | |
run: touch tachometer.firefox-ran.txt | |
- name: Archive Firefox tachometer results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tachometer-results-firefox | |
path: | | |
tach-results.firefox.*.json | |
tachometer.firefox-ran.txt | |
compare-chrome: | |
name: Compare performance to latest release on Chrome | |
# We can't currently run benchmarks on PRs from forked repos, because the | |
# tachometer action reports results by posting a comment, and we can't post | |
# comments without a github token. | |
if: github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/checkout@v4 | |
- name: Setup Node 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Tachometer the changed packages | |
run: yarn test:changed | |
- name: Make at least one results file | |
run: touch tachometer.chrome-ran.txt | |
- name: Archive Chrome tachometer results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tachometer-results-chrome | |
path: | | |
tach-results.*.json | |
tachometer.chrome-ran.txt | |
comment-performance: | |
name: Comment performance results | |
needs: [compare-chrome, compare-firefox] | |
# We can't currently run benchmarks on PRs from forked repos, because the | |
# tachometer action reports results by posting a comment, and we can't post | |
# comments without a github token. | |
if: github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/checkout@v4 | |
- name: Setup Node 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Retrieve tachometer results archives | |
uses: actions/download-artifact@v4 | |
with: | |
name: tachometer-results-firefox | |
- name: Retrieve tachometer results archives | |
uses: actions/download-artifact@v4 | |
with: | |
name: tachometer-results-chrome | |
- name: Post Performance | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { buildTachometerComment } = await import('${{ github.workspace }}/tasks/build-tachometer-comment.js'); | |
const body = buildTachometerComment(); | |
const { commentOrUpdate } = await import('${{ github.workspace }}/tasks/comment-or-update.js'); | |
commentOrUpdate(github, context, '## Tachometer results', body); |