diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a386933..4230199 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,16 +8,14 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Checkout uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" + - name: Show Python + run: python3 --version - name: Install dependencies run: | @@ -28,7 +26,8 @@ jobs: env: PYTHONPATH: ${{ github.workspace }} run: | - python -m pytest -q --cov=prediction_pipeline_demo --cov-report=term-missing --cov-fail-under=50 + python -m pytest -q --cov=prediction_pipeline_demo --cov-report=term-missing --cov-fail-under=70 - # TODO: Add a step here to run the demo pipeline end-to-end - # The goal is to execute prediction_pipeline_demo.py so CI logs show the model’s R^2 score. \ No newline at end of file + - name: Run demo ML pipeline + run: | + python prediction_pipeline_demo.py diff --git a/tests/test_prediction_pipeline_demo.py b/tests/test_prediction_pipeline_demo.py index ada2b55..9f0757f 100644 --- a/tests/test_prediction_pipeline_demo.py +++ b/tests/test_prediction_pipeline_demo.py @@ -56,20 +56,22 @@ def feature_target_sample(housing_data_sample): def test_data_split_returns_four_parts(feature_target_sample): # TODO(1): Uncomment the line below to get the split - # parts = data_split(*feature_target_sample) + parts = data_split(*feature_target_sample) # TODO(2): Add assertions to check: # - parts is a tuple # - tuple has exactly 4 elements - pass + assert isinstance(parts, tuple) + assert len(parts) == 4 def test_end_to_end_train_and_eval(feature_target_sample): # TODO(3): Uncomment these lines to train and evaluate the model - # X_train, X_test, y_train, y_test = data_split(*feature_target_sample) - # model = train_model(X_train, y_train) - # score = eval_model(X_test, y_test, model) + X_train, X_test, y_train, y_test = data_split(*feature_target_sample) + model = train_model(X_train, y_train) + score = eval_model(X_test, y_test, model) # TODO(4): Add assertions to check: # - score is a float # - score is finite (not NaN or inf) - pass + assert isinstance(score, float) + assert np.isfinite(score)