diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 83444a4..a5b0ffc 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -8,16 +8,13 @@ on: jobs: lint-and-test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + container: + image: python:3.10-slim steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Install dependencies run: | pip install -r requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4deb012 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pandas>=2.0.0 +scikit-learn>=1.3.0 diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/train.py b/src/train.py new file mode 100644 index 0000000..52e2228 --- /dev/null +++ b/src/train.py @@ -0,0 +1,23 @@ +"""Example training script for MLOps pipeline test.""" +import json +import os + + +def train(): + """Simple training function for pipeline testing.""" + model_info = { + "model": "test-model", + "version": "0.1.0", + "accuracy": 0.95, + } + + os.makedirs("models", exist_ok=True) + with open("models/model_info.json", "w") as f: + json.dump(model_info, f, indent=2) + + print(f"Training complete: {model_info}") + return model_info + + +if __name__ == "__main__": + train() diff --git a/tests/test_train.py b/tests/test_train.py new file mode 100644 index 0000000..9626fbd --- /dev/null +++ b/tests/test_train.py @@ -0,0 +1,9 @@ +"""Tests for training script.""" +from src.train import train + + +def test_train_returns_model_info(): + result = train() + assert result["model"] == "test-model" + assert "accuracy" in result + assert result["accuracy"] > 0