Skip to content

Commit ebc70f6

Browse files
authored
Create CI.yml
1 parent f5a45bb commit ebc70f6

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python 3.12
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.12"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements.txt
24+
25+
- name: Build images
26+
run: docker-compose -f docker-compose.yml build
27+
28+
- name: Start services
29+
run: docker-compose --env-file .env.sample -f docker-compose.yml up -d
30+
31+
- name: Wait for postgres to be ready
32+
run: |
33+
echo "Waiting for postgres..."
34+
until docker exec $(docker ps -q -f "name=db") pg_isready -U postgres; do
35+
sleep 1
36+
done
37+
38+
- name: Wait for app to be ready
39+
run: |
40+
echo "Waiting for app..."
41+
until curl -s http://localhost:5000/health >/dev/null; do
42+
sleep 1
43+
done
44+
45+
- name: Ensure browsers are installed
46+
run: python -m playwright install --with-deps
47+
48+
- name: Run tests
49+
run: pytest --tracing=retain-on-failure tests
50+
51+
- uses: actions/upload-artifact@v4
52+
if: ${{ !cancelled() }}
53+
with:
54+
name: playwright-traces
55+
path: test-results/
56+
57+
- name: Shut down services
58+
run: docker-compose -f docker-compose.yml down -v

0 commit comments

Comments
 (0)