Skip to content

Test exam try 2

Test exam try 2 #48

Workflow file for this run

name: Run Tests and Deploy
on:
push:
branches:
- test
pull_request:
branches:
- test
- master
jobs:
run-tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11.6"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Set PYTHONPATH
run: export PYTHONPATH="${PYTHONPATH}:${{ github.workspace }}/functions/funcs"
- name: Start Uvicorn server
run: uvicorn algo:app &
- name: Run Tests
run: |
# Run your test command here
python tests/e2e/e2e_tests.py
python -m tests.integration.assignment4
python -m tests.integration.assignment5
python -m tests.integration.assignment7
continue-on-error: true
deploy:
needs: run-tests
runs-on: ubuntu-22.04
if: success()
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy to AWS EC2
run: |
IP_ADDRESS="${{ secrets.EC2_INSTANCE_IP }}"
SCREENADDR="${{ secrets.SCREENADDR }}"
echo "${{ secrets.AWS_KEY }}" > aws.pem
chmod 400 aws.pem
ssh -i aws.pem -o StrictHostKeyChecking=no ubuntu@$IP_ADDRESS << EOF
cd server
git pull origin master
screen -r $SCREENADDR -X stuff "^C"
python3 -m uvicorn algo:app --host 0.0.0.0 --port 8081 &
EOF
env:
SSH_PRIVATE_KEY: ${{ secrets.AWS_KEY }}
shell: bash