-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (51 loc) · 1.57 KB
/
ci_integration_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 python-dotenv
- name: Configure Application
run: |
echo "SQLALCHEMY_DATABASE_URI=mysql+pymysql://root:password@mysql/Users" > .env
- name: Check MySQL Connection
run: |
mysql -h mysql -u root -p password -e "SHOW DATABASES;"
# 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