benchmarks.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. matrix:
  24. # Show OS combos first in GUI
  25. os: [ubuntu-latest]
  26. python-version: ["3.12.8"]
  27. node-version: ["18.x"]
  28. runs-on: ${{ matrix.os }}
  29. steps:
  30. - uses: actions/checkout@v4
  31. - name: Use Node.js ${{ matrix.node-version }}
  32. uses: actions/setup-node@v4
  33. with:
  34. node-version: ${{ matrix.node-version }}
  35. - uses: ./.github/actions/setup_build_env
  36. with:
  37. python-version: ${{ matrix.python-version }}
  38. run-uv-sync: true
  39. - name: Clone Reflex Website Repo
  40. uses: actions/checkout@v4
  41. with:
  42. repository: reflex-dev/reflex-web
  43. ref: main
  44. path: reflex-web
  45. - name: Install Requirements for reflex-web
  46. working-directory: ./reflex-web
  47. run: uv pip install -r requirements.txt
  48. - name: Init Website for reflex-web
  49. working-directory: ./reflex-web
  50. run: uv run reflex init
  51. - name: Install LightHouse Pre-reqs / Run LightHouse
  52. run: |
  53. # Check that npm is home
  54. npm -v
  55. uv run bash benchmarks/lighthouse.sh ./reflex-web prod
  56. env:
  57. LHCI_GITHUB_APP_TOKEN: $
  58. - name: Run Benchmarks
  59. # Only run if the database creds are available in this context.
  60. run: uv run python benchmarks/benchmark_lighthouse.py "$GITHUB_SHA" ./integration/benchmarks/.lighthouseci
  61. env:
  62. GITHUB_SHA: ${{ github.sha }}
  63. reflex-dist-size: # This job is used to calculate the size of the Reflex distribution (wheel file)
  64. if: github.event.pull_request.merged == true
  65. timeout-minutes: 30
  66. strategy:
  67. # Prioritize getting more information out of the workflow (even if something fails)
  68. fail-fast: false
  69. runs-on: ubuntu-latest
  70. steps:
  71. - uses: actions/checkout@v4
  72. - uses: ./.github/actions/setup_build_env
  73. with:
  74. python-version: 3.12.8
  75. run-uv-sync: true
  76. - name: Build reflex
  77. run: |
  78. uv build
  79. - name: Upload benchmark results
  80. # Only run if the database creds are available in this context.
  81. run:
  82. uv run python benchmarks/benchmark_package_size.py --os ubuntu-latest
  83. --python-version 3.12.8 --commit-sha "${{ github.sha }}" --pr-id "${{ github.event.pull_request.id }}"
  84. --branch-name "${{ github.head_ref || github.ref_name }}"
  85. --path ./dist
  86. reflex-venv-size: # This job calculates the total size of Reflex and its dependencies
  87. if: github.event.pull_request.merged == true
  88. timeout-minutes: 30
  89. strategy:
  90. # Prioritize getting more information out of the workflow (even if something fails)
  91. fail-fast: false
  92. matrix:
  93. # Show OS combos first in GUI
  94. os: [ubuntu-latest, windows-latest, macos-latest]
  95. python-version: ["3.12.8"]
  96. runs-on: ${{ matrix.os }}
  97. steps:
  98. - uses: actions/checkout@v4
  99. - name: Set up python
  100. id: setup-python
  101. uses: actions/setup-python@v5
  102. with:
  103. python-version: ${{ matrix.python-version }}
  104. - name: Install UV
  105. uses: astral-sh/setup-uv@v5
  106. with:
  107. version: 0.6.5
  108. - name: Run uv sync
  109. shell: bash
  110. run: |
  111. uv install --no-install-project --no-dev
  112. - name: calculate and upload size
  113. run:
  114. uv run python benchmarks/benchmark_package_size.py --os "${{ matrix.os }}"
  115. --python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
  116. --pr-id "${{ github.event.pull_request.id }}"
  117. --branch-name "${{ github.head_ref || github.ref_name }}"
  118. --path ./.venv