-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 1.54 KB
/
check.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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