Skip to content

🤘🏿 Add organization to mentor user #201

🤘🏿 Add organization to mentor user

🤘🏿 Add organization to mentor user #201

Workflow file for this run

name: Backend Tests
on:
pull_request:
branches:
- dev
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
MONGO_USER: ${{ secrets.MONGO_USER }}
MONGO_PASSWORD: ${{ secrets.MONGO_PASSWORD }}
MONGO_HOST: ${{ secrets.MONGO_HOST }}
MONGO_DB: ${{ secrets.MONGO_DB }}
FIREBASE_SERVICE_KEY: ${{ secrets.FIREBASE_SERVICE_KEY }}
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
IMGUR_KEY: ${{ secrets.IMGUR_KEY }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }}
TWILIO_PHONE: ${{ secrets.TWILIO_PHONE }}
FLASK_APP: ${{ secrets.FLASK_APP }}
BASE_URL: ${{ secrets.BASE_URL }}
TEST_MENTOR_EMAIL: ${{ secrets.TEST_MENTOR_EMAIL }}
TEST_MENTOR_PASSWORD: ${{ secrets.TEST_MENTOR_PASSWORD }}
TEST_MENTOR_PHONE_NUMBER: ${{ secrets.TEST_MENTOR_PHONE_NUMBER }}
TEST_MENTEE_EMAIL: ${{ secrets.TEST_MENTEE_EMAIL }}
TEST_MENTEE_PASSWORD: ${{ secrets.TEST_MENTEE_PASSWORD }}
TEST_MENTEE_PHONE_NUMBER: ${{ secrets.TEST_MENTEE_PHONE_NUMBER }}
TEST_PARTNER_EMAIL: ${{ secrets.TEST_PARTNER_EMAIL }}
TEST_PARTNER_PASSWORD: ${{ secrets.TEST_PARTNER_PASSWORD }}
TEST_GUEST_EMAIL: ${{ secrets.TEST_GUEST_EMAIL }}
TEST_GUEST_PASSWORD: ${{ secrets.TEST_GUEST_PASSWORD }}
TEST_ADMIN_EMAIL: ${{ secrets.TEST_ADMIN_EMAIL }}
TEST_ADMIN_PASSWORD: ${{ secrets.TEST_ADMIN_PASSWORD }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build and run Backend
run: |
cd backend
touch firebase_service_key.json
echo "$FIREBASE_SERVICE_KEY" > firebase_service_key.json
cp firebase_service_key.json ./tests
ls
cat firebase_service_key.json
docker build -t backend .
docker images
docker run --name backend -d -e SENDGRID_API_KEY="$SENDGRID_API_KEY" -e SENDER_EMAIL="$SENDER_EMAIL" -e TWILIO_ACCOUNT_SID="$TWILIO_ACCOUNT_SID" -e TWILIO_AUTH_TOKEN="$TWILIO_AUTH_TOKEN" -e TWILIO_PHONE="$TWILIO_PHONE" -e FLASK_APP="$FLASK_APP" -e IMGUR_KEY="$IMGUR_KEY" -e FIREBASE_API_KEY="$FIREBASE_API_KEY" -e MONGO_USER="$MONGO_USER" -e MONGO_PASSWORD="$MONGO_PASSWORD" -e MONGO_HOST="$MONGO_HOST" -e MONGO_DB="$MONGO_DB" -e GOOGLE_APPLICATION_CREDENTIALS="$GOOGLE_APPLICATION_CREDENTIALS" -e BASE_URL="$BASE_URL" -e TEST_MENTOR_EMAIL="$TEST_MENTOR_EMAIL" -e TEST_MENTOR_PASSWORD="$TEST_MENTOR_PASSWORD" -e TEST_MENTOR_PHONE_NUMBER="$TEST_MENTOR_PHONE_NUMBER" -e TEST_MENTEE_EMAIL="$TEST_MENTEE_EMAIL" -e TEST_MENTEE_PASSWORD="$TEST_MENTEE_PASSWORD" -e TEST_MENTEE_PHONE_NUMBER="$TEST_MENTEE_PHONE_NUMBER" -e TEST_PARTNER_EMAIL=$TEST_PARTNER_EMAIL -e TEST_PARTNER_PASSWORD=$TEST_PARTNER_PASSWORD -e TEST_GUEST_EMAIL="$TEST_GUEST_EMAIL" -e TEST_GUEST_PASSWORD="$TEST_GUEST_PASSWORD" -e TEST_ADMIN_EMAIL="$TEST_ADMIN_EMAIL" -e TEST_ADMIN_PASSWORD="$TEST_ADMIN_PASSWORD" -p 8000:8000 backend
- name: Install pytest
run: |
docker exec backend /bin/bash -c "pip install -U pytest"
- name: Check if Flask server is up
run: |
retries=100
until curl -sSf http://localhost:8000/api/translation; do
((retries--)) || exit 1
sleep 1
done
- name: Run Tests
run: |
docker ps
docker exec backend /bin/bash -c "cd tests && pytest"