-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (53 loc) · 1.57 KB
/
main.yml
File metadata and controls
54 lines (53 loc) · 1.57 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
name: Sample CI
on: [ push, pull_request ]
jobs:
build:
strategy:
matrix:
function:
- hello
- host-details
- log-event
- servicenow
- host-info
- user-management
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install Python dependencies
run: pip install -r requirements.txt
working-directory: functions/${{ matrix.function }}
- name: Run tests if test_main.py exists
run: |
if [ -f "test_main.py" ]; then
echo "Running tests with test_main.py"
pytest
else
echo "No test_main.py found, skipping tests"
fi
working-directory: functions/${{ matrix.function }}
- name: Run Python function and verify output
run: |
python main.py > output.log 2>&1 &
PID=$!
# Wait for output to appear (with timeout)
timeout=30
elapsed=0
while [ $elapsed -lt $timeout ]; do
if grep -q "running at port 8081" output.log; then
echo "✅ Application started successfully"
exit 0
fi
sleep 1
elapsed=$((elapsed+1))
done
echo "❌ Application failed to start within $timeout seconds"
cat output.log
exit 1
working-directory: functions/${{ matrix.function }}