generated from nyu-software-engineering/final-project
-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (40 loc) · 1.33 KB
/
app-tests.yaml
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
name: Web App Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build_and_test:
runs-on: ubuntu-latest
services:
mongo:
image: mongo
env:
MONGO_INITDB_ROOT_USERNAME: ${{ secrets.MONGO_INITDB_ROOT_USERNAME }}
MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.MONGO_INITDB_ROOT_PASSWORD }}
ports:
- 27017:27017
steps:
- uses: actions/checkout@v3
- name: Set up Environment File
run: |
echo "MONGO_INITDB_ROOT_USERNAME=${{ secrets.MONGO_INITDB_ROOT_USERNAME }}" > .env
echo "MONGO_INITDB_ROOT_PASSWORD=${{ secrets.MONGO_INITDB_ROOT_PASSWORD }}" >> .env
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}">> .env
- name: Force remove all Docker containers and networks
run: |
docker rm -f $(docker ps -aq) || true
docker network prune -f
docker volume prune -f
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker Image
run: docker-compose build
- name: Run Docker Containers
run: docker-compose up -d
- name: Run Tests
run: docker exec 5-final-project-spring-2024-mjetteam_p5-web-app_1 pytest
- name: Clean up
if: always()
run: docker-compose down