Merge pull request #42 from OliverHennhoefer/dependabot/uv/torch-2.12.0 #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| minimal-install-smoke: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install Python | |
| run: uv python install 3.11 | |
| - name: Install base dependencies only | |
| run: uv sync | |
| - name: Base install smoke | |
| run: | | |
| uv run python - <<'PY' | |
| import aberrant | |
| from aberrant.base import Pipeline | |
| from aberrant.model import NullModel, QuantileThreshold, RandomModel, ThresholdModel | |
| from aberrant.model.iforest import OnlineIsolationForest | |
| from aberrant.transform.preprocessing import StandardScaler | |
| assert isinstance(aberrant.__version__, str) | |
| assert NullModel().score_one({"x": 1.0}) == 0.0 | |
| assert 0.0 <= RandomModel().score_one({"x": 1.0}) <= 1.0 | |
| assert ThresholdModel(ceiling=1.0).score_one({"x": 2.0}) == 1.0 | |
| q = QuantileThreshold() | |
| q.learn_one({"score": 0.1}) | |
| _ = q.score_one({"score": 0.1}) | |
| p = StandardScaler() | OnlineIsolationForest() | |
| assert isinstance(p, Pipeline) | |
| PY | |
| lint-type-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ["3.10", "3.11", "3.12"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Ruff | |
| run: uv run python -m ruff check . | |
| - name: Mypy | |
| run: uv run python -m mypy aberrant | |
| - name: Unit tests | |
| run: uv run python -m pytest tests/models tests/drift tests/transformers -q | |
| extras-smoke: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install Python | |
| run: uv python install 3.11 | |
| - name: Install extras | |
| run: uv sync --extra dev --extra faiss | |
| - name: Extras import smoke | |
| run: | | |
| uv run python - <<'PY' | |
| from aberrant.model.deep import Autoencoder, KitNET | |
| from aberrant.utils.similar.faiss_engine import FaissSimilaritySearchEngine | |
| assert Autoencoder is not None | |
| assert KitNET is not None | |
| engine = FaissSimilaritySearchEngine(window_size=8, warm_up=2) | |
| engine.append({"x": 0.0, "y": 0.0}) | |
| engine.append({"x": 1.0, "y": 1.0}) | |
| assert isinstance(engine.search({"x": 0.5, "y": 0.5}, n_neighbors=1), float) | |
| PY | |
| - name: FAISS model smoke tests | |
| run: uv run python -m pytest tests/models/test_distance_knn.py -q | |
| integration-smoke: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Integration smoke | |
| run: uv run python -m pytest tests/test_public_imports_base.py tests/test_public_imports_extras.py tests/integration -q | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Coverage | |
| run: uv run python -m pytest tests/models tests/drift tests/transformers --cov=aberrant --cov-report=xml --cov-report=term-missing -q | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-xml | |
| path: coverage.xml | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install Python | |
| run: uv python install 3.11 | |
| - name: Build sdist and wheel | |
| run: uv build |