Skip to content

print

print #1

name: CI_integration
on:
pull_request:
branches:
- main
jobs:
integration-test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: Users
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest flask-testing
- name: Configure Application
run: |
echo "SQLALCHEMY_DATABASE_URI=mysql+pymysql://root:password@localhost/Users" > .env
# Additional step for initializing the database
- name: Initialize Database
run: |
export FLASK_APP=app2.py
flask db init
flask db migrate -m "Initial migration."
flask db upgrade
- name: Start Application
run: |
python app2.py &
sleep 10 # Wait for application to start
- name: Run Integration Tests
run: pytest integration_test.py
- name: Cleanup
if: always()
run: killall python