Skip to content

Commit 09b023b

Browse files
author
Emre Savas
committed
2 parents c644617 + e87839e commit 09b023b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build-test-deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
17+
- name: Create .env file
18+
run: |
19+
echo "PYTHONUNBUFFERED=1" > .env
20+
echo "FLASK_ENV=development" >> .env
21+
echo "API_KEY=your_api_key" >> .env
22+
23+
- name: Install Docker compose
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y docker-compose
27+
28+
- name: Build Docker
29+
run: |
30+
docker-compose up -d --build
31+
32+
- name: Wait for API
33+
run: |
34+
timeout 30 sh -c 'until curl -s http://localhost:8080/; do sleep 2; done'
35+
36+
- name: Run API tests
37+
run: |
38+
python tests.py
39+
40+
- name: Shut down Docker Compose
41+
if: always()
42+
run: docker-compose down

0 commit comments

Comments
 (0)