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

ci: benchmark using codspeed #2218

Merged
merged 6 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
30 changes: 30 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
branches:
- master
tags:
- v*
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

name: Benchmark
jobs:
test:
name: Test with tox
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: 'x64'
- run: pip install uv
- run: uv pip install --system -e .[test]
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/ --codspeed
2 changes: 0 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
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: 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
10 changes: 8 additions & 2 deletions tests/test_reacnetgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ 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 +143,10 @@ 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
Loading