Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added workflow tests #13

Merged
merged 7 commits into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/app-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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

- 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
Loading