-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement performance benchmarking
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
requests==2.28.2 | ||
pytest==7.2.1 | ||
websocket-client==1.5.0 | ||
pytest-codspeed |