-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.43 KB
/
python-app.yml
File metadata and controls
75 lines (64 loc) · 2.43 KB
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: custom-https-server CI
on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "0 9 1 * *"
jobs:
test-server:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install psutil
- name: Test server starts on port 8080
working-directory: ./custom-https-server
run: |
echo "Launching server on port 8080..."
timeout 30 python3 custom_https_server.py --path . --port 8080 --bind 127.0.0.1 --mode read --user admin --pass password > /tmp/server8080.log 2>&1 &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"
sleep 10
if ps -p $SERVER_PID > /dev/null 2>&1; then
echo "✅ Server process started successfully on port 8080"
kill $SERVER_PID 2>/dev/null || true
exit 0
else
echo "❌ Server process failed to start"
echo "=== Server logs ==="
cat /tmp/server8080.log
exit 1
fi
shell: bash
- name: Test server starts on port 8081
run: |
echo "Creating test file in /tmp..."
echo "Hello from /tmp" > /tmp/test.txt
echo "Launching server on port 8081..."
timeout 30 python3 ./custom-https-server/custom_https_server.py --path /tmp --port 8081 --bind 127.0.0.1 --mode read --user admin --pass password > /tmp/server8081.log 2>&1 &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"
sleep 10
if ps -p $SERVER_PID > /dev/null 2>&1; then
echo "✅ Server process started successfully on port 8081"
kill $SERVER_PID 2>/dev/null || true
exit 0
else
echo "❌ Server process failed to start"
echo "=== Server logs ==="
cat /tmp/server8081.log
exit 1
fi
shell: bash