Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codspeed #3

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,19 @@ jobs:
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Type check with pyright
run: pyright
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/ --codspeed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @pcriadoperez, I am a co-founder @CodSpeedHQ.

I took a look at your setup with CodSpeed, and saw that you are using matrices
It means that for each run of the workflow, there will be multiple uploads of the same benchmarks, which is currently not supported by CodSpeed.

I greatly recommend that you upload only once per workflow, and if possible with the latest python version (3.12), so that you can benefit from automated flamegraphs.

This should do the trick:

Suggested change
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/ --codspeed
- name: Run benchmarks
if: ${{ matrix.python == '3.12' }}
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/ --codspeed

- name: Test with tox
run: tox -e py
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ join(matrix.*, '-') }}
parallel: true
finish:
coveralls:
needs: build
if: ${{ always() }}
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pytest-asyncio
pytest-cov
pytest-xdist
pytest-rerunfailures
pytest-codspeed
requests-mock
tox
setuptools
Expand Down
6 changes: 6 additions & 0 deletions tests/test_ws_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ async def test_ws_api_public_endpoint(clientAsync):
"""Test normal order book request"""
order_book = await clientAsync.ws_get_order_book(symbol="BTCUSDT")
assert_ob(order_book)


@pytest.mark.asyncio
async def test_benchmark_ws_api_order_book(clientAsync, benchmark):
"""Test normal order book request"""
await benchmark(clientAsync.ws_get_order_book, symbol="BTCUSDT")


@pytest.mark.asyncio
Expand Down
Loading