Skip to content

Commit 6f22d6d

Browse files
authored
add integration test (#199)
1 parent 0558286 commit 6f22d6d

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
test:
12-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
1515
python-version: ["3.9", "3.11"]
@@ -37,7 +37,8 @@ jobs:
3737
run: python -c "import sys; print(sys.version)"
3838
- name: Setup Python
3939
run: |
40-
sudo apt-get update && sudo apt-get install python3-enchant -y
40+
sudo apt-get update
41+
sudo apt-get install python3-enchant -y
4142
pip install --upgrade pip
4243
pip install tox coveralls
4344
- name: Run tox

.github/workflows/integration.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Integration Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "develop"
8+
- "main"
9+
10+
jobs:
11+
integration:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.11"]
16+
services:
17+
postgres:
18+
image: postgres:11.1
19+
env:
20+
POSTGRES_PASSWORD: postgres
21+
POSTGRES_DB: bsync_validator
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
ports:
28+
- 5432:5432
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
- name: Setup Python dependencies
35+
run: |
36+
sudo apt-get update
37+
pip install --upgrade pip
38+
pip install -r requirements-test.txt
39+
- name: Setup Django
40+
env:
41+
DJANGO_SETTINGS_MODULE: bsyncviewer.settings.gh_actions
42+
run: |
43+
python manage.py collectstatic --noinput
44+
python manage.py migrate
45+
- name: Start Django server
46+
env:
47+
DJANGO_SETTINGS_MODULE: bsyncviewer.settings.gh_actions
48+
run: |
49+
python manage.py runserver 8000 &
50+
echo $! > server.pid
51+
sleep 10 # Give server time to start
52+
- name: Test home page loads
53+
run: |
54+
curl -f -s -o /dev/null http://localhost:8000/ || (echo "Home page failed to load" && exit 1)
55+
echo "✅ Home page loaded successfully"
56+
- name: Stop Django server
57+
if: always()
58+
run: |
59+
if [ -f server.pid ]; then
60+
kill $(cat server.pid) || true
61+
rm server.pid
62+
fi

0 commit comments

Comments
 (0)