Skip to content

Commit

Permalink
Attempt to fix CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
hameerabbasi committed Dec 16, 2024
1 parent 8158401 commit 932b79c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 60 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,15 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v2
- uses: prefix-dev/setup-[email protected]
with:
environment-file: ci/environment.yml
init-shell: >-
bash
cache-environment: true
cache-downloads: true
post-cleanup: 'all'
create-args: >-
python=${{ matrix.python }}
${{ matrix.pip_opts }}
- name: Install package
run: |
pip install -e '.[tests]'
# micromamba remove numba
# micromamba install -c numba numba
pixi-version: v0.39.2
cache: true
- name: Run tests
run: |
SPARSE_BACKEND=Numba pytest --pyargs sparse --doctest-modules --cov-report=xml:coverage_Numba.xml -n0 -vvv
SPARSE_BACKEND=Finch pytest --pyargs sparse/tests --cov-report=xml:coverage_Finch.xml -n0 -vvv
SPARSE_BACKEND=MLIR pytest --pyargs sparse/mlir_backend --cov-report=xml:coverage_MLIR.xml -n0 -vvv
pixi run -e test test -- --cov-report=xml:coverage_Numba.xml -vvv
pixi run -e finch-dev test-finch -- --cov-report=xml:coverage_Finch.xml
pixi run -e mlir-dev test-mlir -- --cov-report=xml:coverage_MLIR.xml
- uses: codecov/codecov-action@v5
if: always()
with:
Expand Down
19 changes: 0 additions & 19 deletions ci/environment.yml

This file was deleted.

20 changes: 17 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import pathlib

import sparse

import pytest


Expand All @@ -7,8 +11,18 @@ def add_doctest_modules(doctest_namespace):

import numpy as np

if sparse._BackendType.Numba != sparse._BACKEND:
pass # TODO: pytest.skip() skips Finch and MLIR tests

doctest_namespace["np"] = np
doctest_namespace["sparse"] = sparse


def pytest_ignore_collect(collection_path: pathlib.Path, path: str, config: pytest.Config) -> bool | None:
if "numba_backend" in collection_path.parts and sparse._BackendType.Numba != sparse._BACKEND:
return True

if "mlir_backend" in collection_path.parts and sparse._BackendType.MLIR != sparse._BACKEND:
return True

if "finch_backend" in collection_path.parts and sparse._BackendType.Finch != sparse._BACKEND:
return True

return None
27 changes: 15 additions & 12 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,28 @@ numpy = ">=1.17"
[dependencies]
python = ">=3.10,<3.13"

[feature.extras.pypi-dependencies]
[feature.extra.pypi-dependencies]
dask = { version = ">=2024", extras = ["array"] }
scipy = ">=0.19"
scikit-learn = "*"

[feature.docs.pypi-dependencies]
[feature.doc.pypi-dependencies]
mkdocs-material = "*"
mkdocstrings = { version = "*", extras = ["python"] }
mkdocs-gen-files = "*"
mkdocs-literate-nav = "*"
mkdocs-section-index = "*"
mkdocs-jupyter = "*"

[feature.tests.tasks]
test = "pytest --pyargs sparse -n auto"
test-mlir = { cmd = "pytest --pyargs sparse.mlir_backend -v" }
[feature.test.tasks]
test = "pytest -n auto --doctest-modules"
test-mlir = "pytest --pyargs sparse.mlir_backend -v"
test-finch = { cmd = "pytest --pyargs sparse/tests -n auto -v", depends-on = ["precompile"] }

[feature.tests.dependencies]
[feature.test.pypi-dependencies]
pytest = ">=3.5"
pytest-cov = "*"
pytest-xdist = "*"
pre-commit = "*"
pytest-codspeed = "*"

[feature.notebooks.pypi-dependencies]
Expand All @@ -51,6 +50,7 @@ matrepr = "*"
precompile = "python -c 'import finch'"

[feature.finch.dependencies]
python = ">=3.10"
juliaup = ">=1.17.10"

[feature.finch.pypi-dependencies]
Expand All @@ -63,6 +63,9 @@ SPARSE_BACKEND = "Finch"
[feature.finch.target.osx-arm64.activation.env]
PYTHONFAULTHANDLER = "${HOME}/faulthandler.log"

[feature.mlir.dependencies]
python = ">=3.10"

[feature.mlir.pypi-dependencies]
scipy = ">=0.19"
finch-mlir = ">=0.0.2"
Expand All @@ -71,8 +74,8 @@ finch-mlir = ">=0.0.2"
SPARSE_BACKEND = "MLIR"

[environments]
tests = ["tests", "extras"]
docs = ["docs", "extras"]
mlir-dev = {features = ["tests", "mlir"], no-default-feature = true}
finch-dev = {features = ["tests", "finch"], no-default-feature = true}
notebooks = ["extras", "mlir", "finch", "notebooks"]
test = ["test", "extra"]
doc = ["doc", "extra"]
mlir-dev = {features = ["test", "mlir"], no-default-feature = true}
finch-dev = {features = ["test", "finch"], no-default-feature = true}
notebooks = ["extra", "mlir", "finch", "notebooks"]
6 changes: 0 additions & 6 deletions sparse/mlir_backend/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
import sparse

import pytest

if sparse._BACKEND != sparse._BackendType.MLIR:
pytest.skip("skipping MLIR tests", allow_module_level=True)
4 changes: 2 additions & 2 deletions sparse/mlir_backend/tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import typing
from collections.abc import Iterable

import sparse

import pytest

import numpy as np
import scipy.sparse as sps

sparse = pytest.importorskip("sparse.mlir_backend")

parametrize_dtypes = pytest.mark.parametrize(
"dtype",
[
Expand Down

0 comments on commit 932b79c

Please sign in to comment.