-
Notifications
You must be signed in to change notification settings - Fork 8
85 lines (69 loc) · 2.73 KB
/
ci.yml
File metadata and controls
85 lines (69 loc) · 2.73 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
76
77
78
79
80
81
82
83
84
85
name: CI Tests
on:
push:
branches: [ main, develop, 'pr-*' ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
# Don't set up Python 3.12, use system default Python to match python3-tdb package
- name: Setup
run: |
set -e # Exit on any error
echo "Running CI setup script..."
scripts/setup_ci.sh
echo "Setup completed successfully"
- name: Run Tests
run: |
set -e # Exit on any error
echo "Running test script..."
scripts/run_tests.sh -j 16
echo "All tests completed successfully"
docker-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Initialize submodules
run: |
git submodule update --init --recursive
- name: Build Docker image
run: |
docker build -t supportproxy-test -f docker/Dockerfile .
- name: Test Docker container
run: |
# Test that the binary exists and is executable
docker run --rm --entrypoint=/bin/bash supportproxy-test -c "ls -la /app/supportproxy && test -x /app/supportproxy && echo '/app/supportproxy is executable'"
# Create a volume for persistent data as shown in README
docker volume create supportproxy-test-data
# Initialize the database in the volume (as shown in README)
docker run --rm -v supportproxy-test-data:/app/data supportproxy-test keydb.py initialise
# Add a test user to the database (as shown in README)
docker run --rm -v supportproxy-test-data:/app/data supportproxy-test keydb.py add 10001 10002 'TestUser' TestPass123
# Test that the container runs supportproxy and creates proxy.log
docker run --rm --name supportproxy-test-run -v supportproxy-test-data:/app/data -d supportproxy-test
sleep 3
# Check if proxy.log is being created/filled
if docker exec supportproxy-test-run test -f /app/data/proxy.log; then
echo 'SupportProxy is running and proxy.log exists'
log_size=$(docker exec supportproxy-test-run wc -c /app/data/proxy.log | cut -d' ' -f1)
echo "proxy.log size: $log_size bytes"
if [ "$log_size" -gt 0 ]; then
echo 'proxy.log is being filled - SupportProxy is working correctly'
else
echo 'proxy.log exists but is empty'
fi
docker stop supportproxy-test-run
else
echo 'SupportProxy container failed - proxy.log not found'
docker stop supportproxy-test-run
exit 1
fi
# Cleanup
docker volume rm supportproxy-test-data