[ENG-3749] type safe vars #2479
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: benchmarking | |
on: | |
pull_request: | |
types: | |
- closed | |
paths-ignore: | |
- '**/*.md' | |
permissions: | |
contents: read | |
defaults: | |
run: | |
shell: bash | |
env: | |
PYTHONIOENCODING: 'utf8' | |
TELEMETRY_ENABLED: false | |
NODE_OPTIONS: '--max_old_space_size=8192' | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
jobs: | |
reflex-web: | |
# if: github.event.pull_request.merged == true | |
strategy: | |
fail-fast: false | |
matrix: | |
# Show OS combos first in GUI | |
os: [ubuntu-latest] | |
python-version: ['3.11.4'] | |
node-version: ['18.x'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: ./.github/actions/setup_build_env | |
with: | |
python-version: ${{ matrix.python-version }} | |
run-poetry-install: true | |
create-venv-at-path: .venv | |
- name: Clone Reflex Website Repo | |
uses: actions/checkout@v4 | |
with: | |
repository: reflex-dev/reflex-web | |
ref: main | |
path: reflex-web | |
- name: Install Requirements for reflex-web | |
working-directory: ./reflex-web | |
run: poetry run uv pip install -r requirements.txt | |
- name: Init Website for reflex-web | |
working-directory: ./reflex-web | |
run: poetry run reflex init | |
- name: Install LightHouse Pre-reqs / Run LightHouse | |
run: | | |
# Check that npm is home | |
npm -v | |
poetry run bash benchmarks/lighthouse.sh ./reflex-web prod | |
env: | |
LHCI_GITHUB_APP_TOKEN: $ | |
- name: Run Benchmarks | |
# Only run if the database creds are available in this context. | |
run: poetry run python benchmarks/benchmark_lighthouse.py "$GITHUB_SHA" ./integration/benchmarks/.lighthouseci | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
simple-apps-benchmarks: # This app tests the compile times of various compoonents and pages | |
if: github.event.pull_request.merged == true | |
env: | |
OUTPUT_FILE: benchmarks.json | |
timeout-minutes: 50 | |
strategy: | |
# Prioritize getting more information out of the workflow (even if something fails) | |
fail-fast: false | |
matrix: | |
# Show OS combos first in GUI | |
os: [ubuntu-latest, windows-latest, macos-12] | |
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0'] | |
exclude: | |
- os: windows-latest | |
python-version: '3.10.13' | |
- os: windows-latest | |
python-version: '3.9.18' | |
# keep only one python version for MacOS | |
- os: macos-latest | |
python-version: '3.9.18' | |
- os: macos-latest | |
python-version: '3.10.13' | |
- os: macos-12 | |
python-version: '3.12.0' | |
include: | |
- os: windows-latest | |
python-version: '3.10.11' | |
- os: windows-latest | |
python-version: '3.9.13' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup_build_env | |
with: | |
python-version: ${{ matrix.python-version }} | |
run-poetry-install: true | |
create-venv-at-path: .venv | |
- name: Run benchmark tests | |
env: | |
APP_HARNESS_HEADLESS: 1 | |
PYTHONUNBUFFERED: 1 | |
run: | | |
poetry run pytest -v benchmarks/ --benchmark-json=${{ env.OUTPUT_FILE }} -s | |
- name: Upload benchmark results | |
# Only run if the database creds are available in this context. | |
run: | |
poetry run python benchmarks/benchmark_compile_times.py --os "${{ matrix.os }}" | |
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}" | |
--benchmark-json "${{ env.OUTPUT_FILE }}" --branch-name "${{ github.head_ref || github.ref_name }}" | |
--event-type "${{ github.event_name }}" --pr-id "${{ github.event.pull_request.id }}" | |
reflex-dist-size: # This job is used to calculate the size of the Reflex distribution (wheel file) | |
if: github.event.pull_request.merged == true | |
timeout-minutes: 30 | |
strategy: | |
# Prioritize getting more information out of the workflow (even if something fails) | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup_build_env | |
with: | |
python-version: 3.11.5 | |
run-poetry-install: true | |
create-venv-at-path: .venv | |
- name: Build reflex | |
run: | | |
poetry build | |
- name: Upload benchmark results | |
# Only run if the database creds are available in this context. | |
run: | |
poetry run python benchmarks/benchmark_package_size.py --os ubuntu-latest | |
--python-version 3.11.5 --commit-sha "${{ github.sha }}" --pr-id "${{ github.event.pull_request.id }}" | |
--branch-name "${{ github.head_ref || github.ref_name }}" | |
--path ./dist | |
reflex-venv-size: # This job calculates the total size of Reflex and its dependencies | |
if: github.event.pull_request.merged == true | |
timeout-minutes: 30 | |
strategy: | |
# Prioritize getting more information out of the workflow (even if something fails) | |
fail-fast: false | |
matrix: | |
# Show OS combos first in GUI | |
os: [ubuntu-latest, windows-latest, macos-12] | |
python-version: ['3.11.5'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.3.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: .venv | |
- name: Run poetry install | |
shell: bash | |
run: | | |
python -m venv .venv | |
source .venv/*/activate | |
poetry install --without dev --no-interaction --no-root | |
- name: Install uv | |
shell: bash | |
run: | | |
poetry run pip install uv | |
- name: calculate and upload size | |
run: | |
poetry run python benchmarks/benchmark_package_size.py --os "${{ matrix.os }}" | |
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}" | |
--pr-id "${{ github.event.pull_request.id }}" | |
--branch-name "${{ github.head_ref || github.ref_name }}" | |
--path ./.venv |