Skip to content

Create blank .env file during Github Actions docker build #38

Create blank .env file during Github Actions docker build

Create blank .env file during Github Actions docker build #38

Workflow file for this run

name: Backend
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build_backend:
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
working-directory: ./service
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run tests
working-directory: ./service
run: |
poetry run pytest --cov=./ --cov-report=xml
- name: Check code coverage
working-directory: ./service
run: |
poetry run coverage report --fail-under=70
- name: Start the web app
working-directory: ./service
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