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

feat(ci): add codespeedHQ performance analysis🐇 #81

Merged
merged 2 commits into from
Jan 14, 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
6 changes: 6 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ jobs:
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
- name: Run benchmarks
if: matrix.os == 'ubuntu-latest'
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pixi run test --codspeed
3 changes: 2 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ channels = ["conda-forge"]
platforms = ["win-64", "linux-64"]

[tasks]
postinstall = "pip install --upgrade --no-build-isolation --no-deps --disable-pip-version-check -e ."
# install packages not on conda-forge
postinstall = "pip install --upgrade --no-build-isolation --no-deps --disable-pip-version-check -e .; pip install pytest-codspeed mkdocs-bibtex"
doc = "mkdocs serve"
test = "pytest -v tests/ --cov=src --cov-report=xml"
lint = "pre-commit run --all"
Expand Down
11 changes: 11 additions & 0 deletions tests/test_classical_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def _apply_rule(
)
assert (y_pred == y_test).all()

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["all", "ex"])
def test_tick_rule(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if tick rule is correctly applied.
Expand All @@ -323,6 +324,7 @@ def test_tick_rule(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([-1, 1, 1, -1])
self._apply_rule(x_train, x_test, y_test, [("tick", subset)], 7)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["all", "ex"])
def test_rev_tick_rule(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if rev. tick rule is correctly applied.
Expand All @@ -341,6 +343,7 @@ def test_rev_tick_rule(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([-1, 1, 1, -1])
self._apply_rule(x_train, x_test, y_test, [("rev_tick", subset)], 7)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["best", "ex"])
def test_quote_rule(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if quote rule is correctly applied.
Expand All @@ -366,6 +369,7 @@ def test_quote_rule(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([-1, 1, 1, -1, -1, 1])
self._apply_rule(x_train, x_test, y_test, [("quote", subset)], 45)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["best", "ex"])
def test_lr(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if the lr algorithm is correctly applied.
Expand All @@ -389,6 +393,7 @@ def test_lr(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([-1, 1, 1, -1])
self._apply_rule(x_train, x_test, y_test, [("lr", subset)], 7)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["best", "ex"])
def test_rev_lr(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if the rev. lr algorithm is correctly applied.
Expand Down Expand Up @@ -419,6 +424,7 @@ def test_rev_lr(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([-1, 1, 1, -1, -1, 1])
self._apply_rule(x_train, x_test, y_test, [("rev_lr", subset)], 42)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["best", "ex"])
def test_emo(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if the emo algorithm is correctly applied.
Expand Down Expand Up @@ -449,6 +455,7 @@ def test_emo(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([-1, 1, 1, -1, -1, 1])
self._apply_rule(x_train, x_test, y_test, [("emo", subset)], 42)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["best", "ex"])
def test_rev_emo(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if the rev. emo algorithm is correctly applied.
Expand Down Expand Up @@ -479,6 +486,7 @@ def test_rev_emo(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([-1, 1, 1, -1, -1, 1])
self._apply_rule(x_train, x_test, y_test, [("rev_emo", subset)], 42)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["best", "ex"])
def test_clnv(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if the clnv algorithm is correctly applied.
Expand Down Expand Up @@ -509,6 +517,7 @@ def test_clnv(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([1, -1, 1, -1, 1, -1])
self._apply_rule(x_train, x_test, y_test, [("clnv", subset)], 42)

@pytest.mark.benchmark()
@pytest.mark.parametrize("subset", ["best", "ex"])
def test_rev_clnv(self, x_train: pd.DataFrame, subset: str) -> None:
"""Test, if the rev. clnv algorithm is correctly applied.
Expand Down Expand Up @@ -538,6 +547,7 @@ def test_rev_clnv(self, x_train: pd.DataFrame, subset: str) -> None:
y_test = pd.Series([1, -1, 1, -1, 1, -1])
self._apply_rule(x_train, x_test, y_test, [("rev_clnv", subset)], 5)

@pytest.mark.benchmark()
def test_trade_size(self, x_train: pd.DataFrame) -> None:
"""Test, if the trade size algorithm is correctly applied.

Expand All @@ -558,6 +568,7 @@ def test_trade_size(self, x_train: pd.DataFrame) -> None:
y_test = pd.Series([-1, 1, -1, 1, -1, 1])
self._apply_rule(x_train, x_test, y_test, [("trade_size", "ex")], 42)

@pytest.mark.benchmark()
def test_depth(self, x_train: pd.DataFrame) -> None:
"""Test, if the depth rule is correctly applied.

Expand Down
Loading