Skip to content

Commit

Permalink
feat: Implement performance benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Mar 10, 2023
1 parent b753500 commit 81e92ae
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: codspeed-benchmarks

on:
push:
branches:
- "main" # or "master"
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "3.7"

- name: Install dependencies
run: pip install -r robyn/test-requirements.txt

- name: Run benchmarks
uses: CodSpeedHQ/action@v1
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest integration_tests/test_benchmarks.py --codspeed
15 changes: 15 additions & 0 deletions integration_tests/test_benchmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest

from helpers.http_methods_helpers import get


@pytest.mark.benchmark
def test_get_sync_benchmark(session):
r = get("/sync/param/1")
assert r.text == "1"


@pytest.mark.benchmark
def test_get_async_benchmark(session):
r = get("/async/param/1")
assert r.text == "1"
1 change: 1 addition & 0 deletions robyn/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
requests==2.28.2
pytest==7.2.1
websocket-client==1.5.0
pytest-codspeed

0 comments on commit 81e92ae

Please sign in to comment.