Skip to content

1132 improve api benchmarks #378

1132 improve api benchmarks

1132 improve api benchmarks #378

Workflow file for this run

name: Benchmark
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
benchmark_api:
name: Benchmark
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install poetry
run: pipx install poetry==1.7.1
- name: Install dependencies
run: poetry install --with dev --without docs --no-interaction -E gunicorn
- name: Run Fractal with Gunicorn
run: |
export DB_ENGINE=sqlite
export SQLITE_PATH=./simplest_fractal_db.db
export FRACTAL_TASKS_DIR=/tmp/FRACTAL_TASKS_DIR
export FRACTAL_RUNNER_WORKING_BASE_DIR=/tmp/artifacts
export JWT_SECRET_KEY=secret
export FRACTAL_LOGGING_LEVEL=10
cd benchmarks/
poetry run sh serve.sh
- name: Benchmark
run: |
cd benchmarks/
poetry run python api_bench.py
- name: HTML Preview
id: html_preview
uses: pavi2410/html-preview-action@v2
with:
html_file: 'benchmarks/bench.html'
- name: Add comment with preview
uses: github-actions-up-and-running/pr-comment@v1.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message: ${{ format('[Click here to preview Benchmark page in browser]({0})', steps.html_preview.outputs.url) }}
- uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
commit_message: Update bench.html
branch: benchmark-api
push_options: '--force'
skip_checkout: true
file_pattern: benchmarks/bench.html