Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/actions/setup-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
install-playwright:
description: Install Playwright browser and system dependencies.
default: 'true'
playwright-ubuntu-mirror:
description: Use the Ubuntu archive for Playwright system packages.
default: 'false'

runs:
using: composite
Expand Down Expand Up @@ -51,6 +54,12 @@ runs:
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-${{ runner.arch }}-playwright-chromium-shell-${{ steps.playwright-version.outputs.version }}-v1
- name: Select Ubuntu package mirror
if: inputs.install-playwright == 'true' && inputs.playwright-ubuntu-mirror == 'true'
shell: bash
run: |
test -f /etc/apt/apt-mirrors.txt
printf '%s\n' 'http://archive.ubuntu.com/ubuntu' | sudo tee /etc/apt/apt-mirrors.txt
- name: Install Playwright system dependencies
if: inputs.install-playwright == 'true'
shell: bash
Expand Down
79 changes: 74 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ on:
- cron: '7 23 * * *' # 11:07 PM America/Chicago
timezone: America/Chicago
workflow_dispatch:
inputs:
performance-only:
description: Measure PR checks without publishing pages
type: boolean
default: false
ci-comparison-ref:
description: Optional baseline commit for paired cold CI profiles
type: string
default: ''

permissions:
contents: read
Expand Down Expand Up @@ -40,6 +49,7 @@ jobs:
- name: Upload code coverage
if: >-
github.event_name == 'push' ||
inputs.performance-only ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
uses: actions/upload-code-coverage@d8e329117199404bba6fc81efe8093dc7c015e34 # v1.4.2
with:
Expand Down Expand Up @@ -89,7 +99,7 @@ jobs:
projects/viewport/dist
projects/viewport/package.json
- name: Prepare IndexNow artifacts
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.performance-only)
env:
ELEMENTS_PAGES_BASE_URL: ${{vars.ELEMENTS_PAGES_BASE_URL}}
INDEXNOW_KEY: ${{secrets.INDEXNOW_KEY}}
Expand All @@ -98,13 +108,13 @@ jobs:
--site-dir projects/pages/dist
--site-url "$ELEMENTS_PAGES_BASE_URL"
- name: Upload pages artifact
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.performance-only)
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9
with:
path: projects/pages/dist
include-hidden-files: true
- name: Upload IndexNow state
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.performance-only)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: indexnow-state
Expand All @@ -119,12 +129,71 @@ jobs:
with:
fetch-depth: 0
lfs: true
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: ./.github/actions/setup-ci
with:
playwright-ubuntu-mirror: 'true'
- name: Run Lighthouse tests
run: WIREIT_FAILURES=kill pnpm run lighthouse && node ./projects/internals/ci/cache-validate.js lighthouse && node ./projects/internals/ci/metrics.lighthouse.js
run: >-
WIREIT_FAILURES=kill mise exec -- pnpm run ci:profile --target lighthouse --samples 1 --reset none
&& mise exec -- node ./projects/internals/ci/cache-validate.js lighthouse
&& mise exec -- node ./projects/internals/ci/metrics.lighthouse.js
- name: Write lighthouse job summary
if: always()
run: node ./projects/internals/ci/lighthouse-summary.js >> "$GITHUB_STEP_SUMMARY"
- name: Upload Lighthouse measurements
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: lighthouse-measurements
retention-days: 14
include-hidden-files: true
path: |
.metrics/ci-profile*
.metrics/metrics.lighthouse.txt
projects/*/.lighthouse/dist/report.json
projects/*/coverage/lighthouse/*
projects/site/coverage/unit/summary.json

ci-comparison:
if: github.event_name == 'workflow_dispatch' && inputs.ci-comparison-ref != ''
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- sample: 1
order: baseline-first
- sample: 2
order: candidate-first
- sample: 3
order: baseline-first
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
lfs: true
- uses: ./.github/actions/setup-ci
- name: Compare cold CI on the same runner
env:
CI_BASELINE_REF: ${{ inputs.ci-comparison-ref }}
CI_COMPARE_ORDER: ${{ matrix.order }}
ELEMENTS_PAGES_BASE_URL: ${{ vars.ELEMENTS_PAGES_BASE_URL }}
ELEMENTS_REGISTRY_URL: ${{ vars.ELEMENTS_REGISTRY_URL }}
ELEMENTS_REPO_BASE_URL: ${{ vars.ELEMENTS_REPO_BASE_URL }}
GITHUB_TOKEN: ${{ github.token }}
run: >-
mise exec -- pnpm run ci:profile --target ci --samples 1 --reset cold
--compare-ref "$CI_BASELINE_REF" --order "$CI_COMPARE_ORDER"
- name: Upload paired CI profiles
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: ci-comparison-${{ matrix.sample }}
retention-days: 14
include-hidden-files: true
path: .metrics/ci-profile-comparison/

release:
needs: ci
Expand Down Expand Up @@ -210,7 +279,7 @@ jobs:

deploy-pages:
needs: ci
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.performance-only)
runs-on: ubuntu-latest
permissions:
actions: read
Expand Down
1 change: 1 addition & 0 deletions projects/core/vitest.lighthouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default mergeConfig(libraryLighthouseTestConfig, {
alias: { '@nvidia-elements/core': resolve(import.meta.dirname, './dist') }
},
test: {
maxWorkers: 4,
include: ['src/**/*.test.lighthouse.ts'],
outputFile: {
junit: './coverage/lighthouse/junit.xml'
Expand Down
Loading
Loading