Skip to content

simple CI/CD

simple CI/CD #1

Workflow file for this run

name: CI on Merge to Main
on:
push:
branches:
- main # Triggers when code is pushed to the main branch
- ms4
jobs:
test:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Python environment (specifically Python 3.12)
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
# Step 2.1: Set PYTHONPATH to include the root directory (or src if relevant)
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV # Adds current directory to PYTHONPATH
# Step 3: Install pytest and pytest-cov for coverage
- name: Install pytest and pytest-cov
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
# Step 4: Run pytest with coverage and generate HTML report
- name: Run tests with coverage
run: |
pytest --cov=. --cov-report=html
# Step 5: Upload coverage report as an artifact
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: htmlcov # The folder where pytest-cov stores HTML reports