Skip to content

Commit

Permalink
ci: benchmark using codspeed
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored May 6, 2024
1 parent 101610b commit 243b6e9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ jobs:
python-version: '3.11'
architecture: 'x64'
- run: pip install tox tox-gh-actions tox-uv
- run: tox
# - run: conda build conda/recipe -c conda-forge --output-folder conda
# if: github.ref == 'refs/heads/master'
- uses: CodSpeedHQ/action
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: tox
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test = [
'pytest-xvfb',
"pytest-console-scripts",
"pytest-mock",
"pytest-benchmark",
"pytest-codspeed",
]
docs = [
'sphinx',
Expand Down
8 changes: 6 additions & 2 deletions tests/test_reacnetgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def test_benchmark_detect(self, benchmark, reacnetgen_param):
nlines = detectclass._readNfunc(f)
with fileinput.input(files=detectclass.inputfilename) as f:
lines = next(itertools.zip_longest(*[f] * nlines))
benchmark(detectclass._readstepfunc, (0, lines))
@benchmark
def bench():
detectclass._readstepfunc((0, lines))

def test_benchmark_hmm(self, benchmark, reacnetgen_param):
"""Benchmark _getoriginandhmm."""
Expand All @@ -140,7 +142,9 @@ def test_benchmark_hmm(self, benchmark, reacnetgen_param):
listtobytes(((5, 6, 1),)),
listtobytes(index),
]
benchmark(hmmclass._getoriginandhmm, compressed_bytes)
@benchmark
def bench():
hmmclass._getoriginandhmm(compressed_bytes)

def test_re(self, reacnetgen_param):
"""Test regular expression of _HTMLResult."""
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set_env =
DEBUG = 1
commands =
pytest --pyargs tests --cov --cov-report term --cov-report xml --cov-config={toxinidir}/pyproject.toml
pytest --codspeed

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
Expand Down

0 comments on commit 243b6e9

Please sign in to comment.