benchmarks.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. name: benchmarking
  2. on:
  3. pull_request:
  4. types:
  5. - closed
  6. paths-ignore:
  7. - "**/*.md"
  8. permissions:
  9. contents: read
  10. defaults:
  11. run:
  12. shell: bash
  13. env:
  14. PYTHONIOENCODING: "utf8"
  15. TELEMETRY_ENABLED: false
  16. NODE_OPTIONS: "--max_old_space_size=8192"
  17. PR_TITLE: ${{ github.event.pull_request.title }}
  18. jobs:
  19. reflex-web:
  20. # if: github.event.pull_request.merged == true
  21. strategy:
  22. fail-fast: false
  23. runs-on: ubuntu-latest
  24. steps:
  25. - uses: actions/checkout@v4
  26. - uses: ./.github/actions/setup_build_env
  27. with:
  28. python-version: 3.13
  29. run-uv-sync: true
  30. - name: Clone Reflex Website Repo
  31. uses: actions/checkout@v4
  32. with:
  33. repository: reflex-dev/reflex-web
  34. ref: main
  35. path: reflex-web
  36. - name: Install Requirements for reflex-web
  37. working-directory: ./reflex-web
  38. run: uv pip install -r requirements.txt
  39. - name: Init Website for reflex-web
  40. working-directory: ./reflex-web
  41. run: uv run reflex init
  42. - name: Install LightHouse Pre-reqs / Run LightHouse
  43. run: |
  44. # Check that npm is home
  45. npm -v
  46. uv run bash benchmarks/lighthouse.sh ./reflex-web prod
  47. env:
  48. LHCI_GITHUB_APP_TOKEN: $
  49. - name: Run Benchmarks
  50. # Only run if the database creds are available in this context.
  51. run: uv run python benchmarks/benchmark_lighthouse.py "$GITHUB_SHA" ./integration/benchmarks/.lighthouseci
  52. env:
  53. GITHUB_SHA: ${{ github.sha }}
  54. reflex-dist-size: # This job is used to calculate the size of the Reflex distribution (wheel file)
  55. if: github.event.pull_request.merged == true
  56. timeout-minutes: 30
  57. strategy:
  58. # Prioritize getting more information out of the workflow (even if something fails)
  59. fail-fast: false
  60. runs-on: ubuntu-latest
  61. steps:
  62. - uses: actions/checkout@v4
  63. - uses: ./.github/actions/setup_build_env
  64. with:
  65. python-version: 3.13
  66. run-uv-sync: true
  67. - name: Build reflex
  68. run: |
  69. uv build
  70. - name: Upload benchmark results
  71. # Only run if the database creds are available in this context.
  72. run:
  73. uv run python benchmarks/benchmark_package_size.py --os ubuntu-latest
  74. --python-version 3.13 --commit-sha "${{ github.sha }}" --pr-id "${{ github.event.pull_request.id }}"
  75. --branch-name "${{ github.head_ref || github.ref_name }}"
  76. --path ./dist
  77. reflex-venv-size: # This job calculates the total size of Reflex and its dependencies
  78. if: github.event.pull_request.merged == true
  79. timeout-minutes: 30
  80. strategy:
  81. # Prioritize getting more information out of the workflow (even if something fails)
  82. fail-fast: false
  83. matrix:
  84. # Show OS combos first in GUI
  85. os: [ubuntu-latest, windows-latest, macos-latest]
  86. runs-on: ${{ matrix.os }}
  87. steps:
  88. - uses: actions/checkout@v4
  89. - name: Set up python
  90. id: setup-python
  91. uses: actions/setup-python@v5
  92. with:
  93. python-version: 3.13
  94. - name: Install UV
  95. uses: astral-sh/setup-uv@v5
  96. with:
  97. version: 0.6.9
  98. - name: Run uv sync
  99. shell: bash
  100. run: |
  101. uv sync --no-install-project --no-dev
  102. - name: calculate and upload size
  103. run:
  104. uv run python benchmarks/benchmark_package_size.py --os "${{ matrix.os }}"
  105. --python-version "3.13" --commit-sha "${{ github.sha }}"
  106. --pr-id "${{ github.event.pull_request.id }}"
  107. --branch-name "${{ github.head_ref || github.ref_name }}"
  108. --path ./.venv