Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Krsto Proroković committed Feb 29, 2024
1 parent b295916 commit 50cb2da
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 32 deletions.
57 changes: 37 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
name: Continuous Integration Workflow

on:
pull_request:
branches:
- master
- dev
push:
branches:
- master
- dev
workflow_dispatch:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install
run: make install
- name: test
run: make test
- name: format
run: make format
- name: lint
run: make lint
main:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
poetry config virtualenvs.in-project true
- name: Set Up Python
uses: actions/setup-python@v5
with:
cache: poetry
cache-dependency-path: poetry.lock

- name: Install Dependencies
run: poetry install --no-root --no-interaction

- name: Lint
run: poetry run ruff check bias_scan

- name: Test
run: poetry run pytest
--color=yes
--full-trace
--showlocals
--verbose
12 changes: 0 additions & 12 deletions Makefile

This file was deleted.

22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool.poetry]
name = "bias-scan"
version = "0.1.0"
description = ""
authors = []
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
numpy = "^1.26.4"
scikit-learn = "^1.4.1.post1"
kmodes = "^0.12.2"

[tool.poetry.dev-dependencies]
ruff = "^0.2.2"
pytest = "^8.0.2"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Empty file added tests/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions tests/test_bahc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import numpy as np

from bias_scan.clustering import BiasAwareHierarchicalKMeans


def test_clusters():
# Checks that label values are between 0 and n_clusters
rng = np.random.RandomState(12)
X = rng.rand(10, 5)
y = rng.rand(10)
algo = BiasAwareHierarchicalKMeans(max_iter=3, min_cluster_size=2)
algo.fit(X, y)
assert np.array_equal(np.unique(algo.labels_), np.arange(algo.n_clusters_))

0 comments on commit 50cb2da

Please sign in to comment.