Skip to content

[RPD-277] [BUG] Fix setup.sh for the recommendation example #74

[RPD-277] [BUG] Fix setup.sh for the recommendation example

[RPD-277] [BUG] Fix setup.sh for the recommendation example #74

name: Recommendation Example CI
on:
workflow_call:
pull_request:
paths:
- recommendation/**
branches:
- main
push:
paths:
- recommendation/**
branches:
- main
jobs:
ci-tests:
name: Pytest CI
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.10"]
timeout-minutes: 15
# disable zenml analytics logging for ci
env:
ZENML_ANALYTICS_OPT_IN: false
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Load cached venv
id: python_cache
uses: actions/cache@v3
with:
path: venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('recommendation/requirements.txt') }}
# Install dependencies if cache does not exist
- name: Install dependencies
if: steps.python_cache.outputs.cache-hit != 'true'
run: |
sed '/zenml/d' recommendation/requirements.txt > recommendation/requirements2.txt
mv recommendation/requirements2.txt recommendation/requirements.txt
if [ -d "venv" ]; then rm -rf venv; fi
python3 -m venv venv
venv/bin/python3 -m pip install -r recommendation/requirements.txt
# Install zenml separately due to pyyaml bug : https://github.com/yaml/pyyaml/issues/724
- name: Install additional dependencies
run: |
venv/bin/python3 -m pip install "cython<3" wheel setuptools && venv/bin/python3 -m pip install --no-build-isolation "pyyaml==5.4.1"
venv/bin/python3 -m pip install "zenml==0.36.1"
- name: Setup ZenML
run: |
source venv/bin/activate
zenml integration install mlflow -y
zenml experiment-tracker register mlflow_experiment_tracker --flavor=mlflow
zenml stack register custom_stack -e mlflow_experiment_tracker -a default -o default --set
- name: Run tests with pytest
run: |
source venv/bin/activate
cd recommendation
python -m pytest tests/