Skip to content

Commit

Permalink
Add Codspeed integration
Browse files Browse the repository at this point in the history
  • Loading branch information
seddonym committed Jun 6, 2024
1 parent 6cc330a commit 047554c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ jobs:
- name: Run tox targets for ${{ matrix.python-version }}
run: python -m tox

- name: Benchmark
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/ --codspeed
13 changes: 8 additions & 5 deletions tests/benchmarking/test_benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ def test_deep_layers_large_graph(large_graph, benchmark):
"mypackage.plugins.5634303718.1007553798.8198145119.application.3242334296.5033127033",
"mypackage.plugins.5634303718.1007553798.8198145119.application.3242334296.2454157946",
)
benchmark.pedantic(
lambda: large_graph.find_illegal_dependencies_for_layers(
layers=layers,
),
rounds=3,
fn = lambda: large_graph.find_illegal_dependencies_for_layers(
layers=layers,
)
if hasattr(benchmark, "pendantic"):
# Running with pytest-benchmark
benchmark.pedantic(fn,rounds=3)
else:
# Running with codspeed.
benchmark(fn)
16 changes: 16 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ deps =
commands =
{posargs:pytest --benchmark-only --benchmark-autosave}

[testenv:codspeed]
basepython = py312
setenv =
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
passenv =
*
usedevelop = false
deps =
pytest==7.4.4
PyYAML==6.0.1
pytest-codspeed==2.2.1
commands =
{posargs:pytest --codspeed}


[testenv:docs]
deps =
-r{toxinidir}/docs/requirements.txt
Expand Down

0 comments on commit 047554c

Please sign in to comment.