Skip to content

Update code coverage threshold to 70% in GitHub Actions workflow #26

Update code coverage threshold to 70% in GitHub Actions workflow

Update code coverage threshold to 70% in GitHub Actions workflow #26

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run tests
run: |
poetry run pytest --cov=./ --cov-report=xml
- name: Check code coverage
run: |
poetry run coverage report --fail-under=70
- name: Start the web app
run: |
poetry run python app.py &
- name: Wait for the web app to start
run: sleep 5
- name: Perform health check
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/health)
if [[ $response == "200" ]]; then
echo "Health check passed"
else
echo "Health check failed with status code $response"
exit 1
fi