-
Notifications
You must be signed in to change notification settings - Fork 235
50 lines (39 loc) · 1.33 KB
/
run-backend-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
name: Run Backend tests
on: [pull_request]
jobs:
continous_integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Environment Variables
run: |
echo "OPENAI_API_KEY=${{ secrets.NEXT_PUBLIC_OPENAI_API_KEY }}" >> $GITHUB_ENV
- name: Install Curl
run: sudo apt install curl -y
- name: Start Docker Compose
run: OPENAI_API_KEY=${{ secrets.NEXT_PUBLIC_OPENAI_API_KEY }} ENVIRONMENT=github docker-compose -f "docker-compose.test.yml" up -d --build
- name: Restart Backend Service To Fetch Template Images
run: docker container restart agenta-backend-test
- name: Check Templates Exists
run: |
while true; do
if curl -s http://localhost:8000/containers/templates/; then
break
fi
sleep 5
done
- name: Wait for Backend Service
run: |
while true; do
if curl -s http://localhost:8000/openapi.json; then
break
fi
sleep 5
done
- name: Run tests
run: docker exec agenta-backend-test pytest
- name: Docker logs
if: always() #
run: docker ps -q | xargs -I {} docker logs {}
- name: Stop Docker Compose
run: docker-compose down