Skip to content

Commit

Permalink
test: use nox
Browse files Browse the repository at this point in the history
Signed-off-by: nstarman <[email protected]>
  • Loading branch information
nstarman committed Sep 20, 2024
1 parent 60803b1 commit 8896608
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,29 @@ jobs:
needs: [smoke]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
allow-prereleases: true
# - name: Install dependencies
# run: python -m pip install '.[test]'
# - name: Run benchmarks
# uses: CodSpeedHQ/action@v3
# with:
# token: ${{ secrets.CODSPEED_TOKEN }}
# run: python -m pytest tests/benchmark --codspeed

- name: Install Nox
run: pip install nox

- name: Install dependencies
run: python -m pip install '.[test]'
- name: Run benchmarks
run: nox --sessions benchmark --install-only

- name: Run the action
uses: CodSpeedHQ/action@v3
with:
run:
nox --sessions benchmark --reuse-existing-virtualenvs --no-install
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/benchmark --codspeed
9 changes: 8 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def pylint(session: nox.Session) -> None:
@nox.session
def tests(session: nox.Session) -> None:
"""Run the unit and regular tests."""
session.install("-e", ".[test]")
session.install(".[test]")
os.environ["GALAX_ENABLE_RUNTIME_TYPECHECKS"] = "1" # TODO: set in a better way
session.run("pytest", *session.posargs)

Expand Down Expand Up @@ -124,3 +124,10 @@ def build(session: nox.Session) -> None:

session.install("build")
session.run("python", "-m", "build")


@nox.session
def benchmark(session: nox.Session) -> None:
"""Run the benchmark tests."""
session.install(".[test]")
session.run("python", "-m", "pytest", "tests/benchmark", "--codspeed")
5 changes: 5 additions & 0 deletions tests/benchmark/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Benchmark tests."""

import jax

jax.config.update("jax_enable_x64", True) # noqa: FBT003

0 comments on commit 8896608

Please sign in to comment.