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

Add benchmarking to ci #76

Merged
merged 18 commits into from
Jul 18, 2022
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ jobs:
git add code_data/_test_minimized/
git commit -m "Add failing example from testing on Python ${{ matrix.py}}"
git push
benchmark:
name: benchmark 3.10
runs-on: ubuntu-latest
steps:
- name: Setup python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: actions/checkout@v3
- run: git fetch origin $GITHUB_BASE_REF:base $GITHUB_REF:pr
- run: pip install asv virtualenv
- run: asv machine --yes
- run: asv continuous base pr --strict -e
# Run docs on here as well as RTD in case we max out the RTD builder
docs:
name: docs build
Expand Down
11 changes: 8 additions & 3 deletions benchmarks/benchmarks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import importlib.util
import pathlib

import code_data

Expand All @@ -11,8 +11,13 @@ class Suite:
min_run_count = 5

def setup(self, module_name):
spec = importlib.util.find_spec(module_name)
self.code = spec.loader.get_code(module_name) # type: ignore
path = (
pathlib.Path(__file__).parent.parent
/ "code_data"
/ "_test_minimized"
/ f"{module_name}.py"
)
self.code = compile(path.read_text(), str(path), "exec")
self.code_data = code_data.CodeData.from_code(self.code)

def teardown(self, module_name):
Expand Down
Loading