-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (67 loc) · 1.96 KB
/
build-backend.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Backend Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# Check out the main repository
- name: Checkout main repository
uses: actions/checkout@v2
with:
path: curio
# Set up Python environment
- name: Set up Python Environment
uses: actions/setup-python@v2
with:
python-version: '3.9'
# Backend setup
- name: Install backend dependencies
working-directory: ./curio/backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run backend server
working-directory: ./curio/backend
run: |
nohup python server.py > backend.log 2>&1 &
sleep 20
cat backend.log
# Python Sandbox setup
- name: Install sandbox dependencies
working-directory: ./curio/sandbox
run: |
pip install -r requirements.txt
pip install utk-0.8.9.tar.gz
- name: Run sandbox server
working-directory: ./curio/sandbox
run: |
nohup python server.py > sandbox.log 2>&1 &
sleep 20
cat sandbox.log
# Post-build tasks
- name: Check for running processes
run: |
ps aux | grep server.py
# Verify backend server (Port 5002)
- name: Verify backend server
run: |
curl http://localhost:5002/liveness || echo "Backend not reachable"
# Verify sandbox server (Port 2000)
- name: Verify sandbox server
run: |
curl http://localhost:2000/liveness || echo "Sandbox not reachable"
# Run Unit Tests
- name: Run Unit Tests
working-directory: ./curio
run: |
python -m unittest discover -p "test_*.py" -v
# Stop all servers
- name: Stop all servers
run: |
pkill -f "python server.py" || true