Skip to content
Merged
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
37 changes: 37 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,40 @@ jobs:
with:
mode: instrumentation
run: uv run pytest -v tests/benchmarks --codspeed

lighthouse:
name: Run Lighthouse benchmark
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0

- uses: ./.github/actions/setup_build_env
with:
python-version: "3.14"
node-version: "22"
run-uv-sync: true

- name: Install playwright
run: uv run playwright install chromium --only-shell

- name: Run Lighthouse benchmark
env:
REFLEX_RUN_LIGHTHOUSE: "1"
run: |
mkdir -p .pytest-tmp/lighthouse
uv run pytest tests/integration/test_lighthouse.py -q -s --tb=no --basetemp=.pytest-tmp/lighthouse

- name: Upload Lighthouse artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: lighthouse-report
path: |
.pytest-tmp/lighthouse/**
!.pytest-tmp/lighthouse/*current
!.pytest-tmp/lighthouse/*current/**
if-no-files-found: ignore
36 changes: 36 additions & 0 deletions scripts/run_lighthouse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Run the local Lighthouse benchmark with a fresh app build."""

from __future__ import annotations

import shutil
from pathlib import Path

from reflex_base import constants

from tests.integration.lighthouse_utils import (
LIGHTHOUSE_LANDING_APP_NAME,
run_landing_prod_lighthouse_benchmark,
)


def main() -> int:
"""Run the Lighthouse benchmark and print a compact summary.

Returns:
The process exit code.
"""
scratch_root = Path(constants.Dirs.STATES)
report_dir = scratch_root / "lighthouse"
app_root = scratch_root / LIGHTHOUSE_LANDING_APP_NAME
shutil.rmtree(app_root, ignore_errors=True)

result = run_landing_prod_lighthouse_benchmark(
app_root=app_root,
report_path=report_dir / "landing-prod-lighthouse.json",
)
print(result.summary) # noqa: T201
return 1 if result.failures else 0


if __name__ == "__main__":
raise SystemExit(main())
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading