Skip to content

Final Version

Final Version #146

Workflow file for this run

name: CI-Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
paths:
# - './**'
- './terraform/**'
- './integration_tests/**'
env:
AWS_DEFAULT_REGION: 'eu-central-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ACTIONS_STEP_DEBUG: true
DATA_PATH: data/data.csv
BASE_DIR: /home/runner/work/mlops-car-prices/mlops-car-prices
TEST_DATA_PATH: data/test_sample.csv
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set BASE_DIR environment variable
run: echo "BASE_DIR=/home/runner/work/mlops-car-prices/mlops-car-prices" >> $GITHUB_ENV
- name: Debug Environment Variables
run: |
echo "BASE_DIR: $BASE_DIR"
echo "DATA_PATH: $DATA_PATH"
echo "TEST_DATA_PATH: $TEST_DATA_PATH"
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
working-directory: ./
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Unit tests
working-directory: ./
run: pytest -vv -s ./tests/
# - name: Lint
# working-directory: ./
# run: pylint --verbose --recursive=y .
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Integration Test
working-directory: 'integration_tests'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}
RUN_ID: aa806b4bc4044777a0a25d5b8a24d7d5
BUCKET_NAME: mlflow-tracking-remote
EXPERIMENT_ID: 29
TEST_DATA_PATH: data/test_sample.csv
run: |
. run.sh
tf-plan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set BASE_DIR environment variable
run: echo "BASE_DIR=${{ github.workspace }}" >> $GITHUB_ENV
- name: Debug Environment Variables
run: |
echo "BASE_DIR: $BASE_DIR"
echo "DATA_PATH: $DATA_PATH"
- name: Debug Terraform Directory
run: |
ls -l ./terraform
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
- name: TF plan
working-directory: 'terraform'
run: |
terraform init -backend-config="key=mlops-zoomcamp-prod.tfstate" --reconfigure
terraform plan -var-file=vars/prod.tfvars