From 6b9447f6b45f0f62f1bf129a371569588f42496a Mon Sep 17 00:00:00 2001 From: Pablo Date: Tue, 18 Feb 2025 01:07:33 -0600 Subject: [PATCH 1/6] add timeout to jobs --- .github/workflows/python-app.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 2b0012d20..658baafff 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -16,6 +16,7 @@ permissions: jobs: lint: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 - name: Set up Python @@ -33,6 +34,7 @@ jobs: build: needs: lint runs-on: ubuntu-22.04 + timeout-minutes: 20 env: PROXY: "http://51.83.140.52:16301" TEST_TESTNET: "true" @@ -74,6 +76,7 @@ jobs: needs: build if: ${{ always() }} runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Coveralls Finished uses: coverallsapp/github-action@v2 From a0ffc0a4d7ebc52550a5a4b9d7d37b9796fc4657 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 22 Feb 2025 01:46:28 -0600 Subject: [PATCH 2/6] add pytest-benchmark --- .github/workflows/python-app.yml | 14 ++++++++++++++ tests/test_ws_api.py | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 658baafff..3e717c53f 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -67,6 +67,20 @@ jobs: run: pyright - name: Test with tox run: tox -e py + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Python Benchmark with pytest-benchmark + tool: 'pytest' + output-file-path: tests/benchamark-${{ matrix.python }}.json + # Use personal access token instead of GITHUB_TOKEN due to https://github.community/t/github-action-not-triggering-gh-pages-upon-push/16096 + github-token: ${{ secrets.GITHUB_TOKEN }} + auto-push: true + # Show alert with commit comment on detecting possible performance regression + alert-threshold: '150%' + comment-on-alert: true + fail-on-alert: true + alert-comment-cc-users: '@pcriadoperez' - name: Coveralls Parallel uses: coverallsapp/github-action@v2 with: diff --git a/tests/test_ws_api.py b/tests/test_ws_api.py index 20a098875..107fd32e3 100644 --- a/tests/test_ws_api.py +++ b/tests/test_ws_api.py @@ -15,6 +15,12 @@ async def test_ws_api_public_endpoint(clientAsync): order_book = await clientAsync.ws_get_order_book(symbol="BTCUSDT") assert_ob(order_book) +@pytest.mark.asyncio +@pytest.mark.benchmark(group="ws_api") +async def test_benchmark_ws_api_get_order_book(clientAsync, benchmark): + """Test normal order book request""" + order_book = await benchmark(clientAsync.ws_get_order_book, symbol="BTCUSDT") + assert_ob(order_book) @pytest.mark.asyncio async def test_ws_api_private_endpoint(clientAsync): From 06d96a73115cc068c69668e49d2f36100a2bb9ea Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 22 Feb 2025 01:46:47 -0600 Subject: [PATCH 3/6] add requirement --- test-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test-requirements.txt b/test-requirements.txt index ec3e381ae..8687b7b55 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,6 +4,7 @@ pytest-asyncio pytest-cov pytest-xdist pytest-rerunfailures +pytest-benchmark requests-mock tox setuptools From f8b0914753b12092291d0125ee4612af1dce7f03 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 22 Feb 2025 02:03:43 -0600 Subject: [PATCH 4/6] benchmark files --- tests/benchmark-3.10.json | 1 + tests/benchmark-3.11.json | 1 + tests/benchmark-3.12.json | 1 + tests/benchmark-3.7.json | 1 + tests/benchmark-3.8.json | 1 + tests/benchmark-3.9.json | 1 + 6 files changed, 6 insertions(+) create mode 100644 tests/benchmark-3.10.json create mode 100644 tests/benchmark-3.11.json create mode 100644 tests/benchmark-3.12.json create mode 100644 tests/benchmark-3.7.json create mode 100644 tests/benchmark-3.8.json create mode 100644 tests/benchmark-3.9.json diff --git a/tests/benchmark-3.10.json b/tests/benchmark-3.10.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/benchmark-3.10.json @@ -0,0 +1 @@ +{} diff --git a/tests/benchmark-3.11.json b/tests/benchmark-3.11.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/benchmark-3.11.json @@ -0,0 +1 @@ +{} diff --git a/tests/benchmark-3.12.json b/tests/benchmark-3.12.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/benchmark-3.12.json @@ -0,0 +1 @@ +{} diff --git a/tests/benchmark-3.7.json b/tests/benchmark-3.7.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/benchmark-3.7.json @@ -0,0 +1 @@ +{} diff --git a/tests/benchmark-3.8.json b/tests/benchmark-3.8.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/benchmark-3.8.json @@ -0,0 +1 @@ +{} diff --git a/tests/benchmark-3.9.json b/tests/benchmark-3.9.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/benchmark-3.9.json @@ -0,0 +1 @@ +{} From 4dacd0a5deac478b7016dc8130ad857238d1e2bb Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 22 Feb 2025 02:20:59 -0600 Subject: [PATCH 5/6] fix action path --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 3e717c53f..29e747e34 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -72,7 +72,7 @@ jobs: with: name: Python Benchmark with pytest-benchmark tool: 'pytest' - output-file-path: tests/benchamark-${{ matrix.python }}.json + output-file-path: ./tests/benchamark-${{ matrix.python }}.json # Use personal access token instead of GITHUB_TOKEN due to https://github.community/t/github-action-not-triggering-gh-pages-upon-push/16096 github-token: ${{ secrets.GITHUB_TOKEN }} auto-push: true From b7ce737cd0c5671240a4c4fd5e109a1701b9f11c Mon Sep 17 00:00:00 2001 From: Pablo Date: Sun, 23 Feb 2025 21:59:29 -0600 Subject: [PATCH 6/6] fix gh action --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 29e747e34..fd7a3911c 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -72,7 +72,7 @@ jobs: with: name: Python Benchmark with pytest-benchmark tool: 'pytest' - output-file-path: ./tests/benchamark-${{ matrix.python }}.json + output-file-path: ./tests/benchmark-${{ matrix.python }}.json # Use personal access token instead of GITHUB_TOKEN due to https://github.community/t/github-action-not-triggering-gh-pages-upon-push/16096 github-token: ${{ secrets.GITHUB_TOKEN }} auto-push: true