Skip to content

update ci/cd workflow #135

update ci/cd workflow

update ci/cd workflow #135

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
- ms5
- testing
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11] # Test against multiple Python versions
steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Python environment (specifically Python 3.11)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Step 2.1: Set PYTHONPATH to include the root directory (or src if relevant)
- name: Set PYTHONPATH
run: echo "PYTHONPATH=${PYTHONPATH}:$(pwd)/src" >> $GITHUB_ENV
- name: Install dependencies
run: |
pip install -r requirements.txt
# 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: Run API integration tests
# 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