-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.24 KB
/
test.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
name: Run Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Delete Existing SQLite Test DB
run: |
if [ -f db.sqlite3 ]; then rm db.sqlite3; fi
- name: Run migrations
run: |
python manage.py makemigrations
python manage.py migrate
- name: Insert fixture data
run: |
chmod +x scripts/create_fixture_data.sh
./scripts/create_fixture_data.sh
- name: Insert dummy data if DB is empty
run: |
chmod +x scripts/create_dummy_data.sh
./scripts/create_dummy_data.sh
- name: Start Django server in the background
run: |
python manage.py runserver 0.0.0.0:8000 &
env:
MYSQL_ACTIVE: false
- name: Run tests
run: |
python manage.py test
- name: Stop Django server
run: |
kill $(lsof -t -i:8000) || echo "Server stopped"