Skip to content

Adding updated test.yml for CI/CD workflow #1

Adding updated test.yml for CI/CD workflow

Adding updated test.yml for CI/CD workflow #1

Workflow file for this run

name: CI Pipeline
# Trigger on push or pull request to the main branch or your feature branch
on:
push:
branches: [ "main", "feat/mlops-pipeline-addition" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
# 1. Check out the repository code
- name: Checkout Code
uses: actions/checkout@v3
# 2. Set up Python environment
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
# 3. Install dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest flake8
# 4. Lint with Flake8
- name: Lint with Flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# 5. Test Application Startup (Syntax Check)
- name: Check FastAPI Syntax
run: |
# This compiles the python file to check for syntax errors without running the server
python -m compileall fastapi_app.py