Skip to content

Commit 3962ef2

Browse files
committed
Add dependabot and GitHub Actions
1 parent 01fbb41 commit 3962ef2

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directories:
5+
- "/functions/hello/"
6+
- "/functions/host-details/"
7+
- "/functions/hosts-query/"
8+
- "/functions/log-event/"
9+
- "/functions/servicenow/"
10+
schedule:
11+
interval: weekly
12+
- package-ecosystem: github-actions
13+
directory: "/"
14+
schedule:
15+
interval: weekly

.github/workflows/main.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Sample CI
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
build:
6+
strategy:
7+
matrix:
8+
function:
9+
- hello
10+
- host-details
11+
- hosts-query
12+
- log-event
13+
- servicenow
14+
name: Build and Test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.9'
22+
cache: 'pip'
23+
- name: Install Python dependencies
24+
run: pip install -r requirements.txt
25+
working-directory: functions/${{ matrix.function }}
26+
- name: Run tests if test_main.py exists
27+
run: |
28+
if [ -f "test_main.py" ]; then
29+
echo "Running tests with test_main.py"
30+
python test_main.py
31+
else
32+
echo "No test_main.py found, skipping tests"
33+
fi
34+
working-directory: functions/${{ matrix.function }}
35+
- name: Run Python function and verify output
36+
run: |
37+
python main.py > output.log 2>&1 &
38+
PID=$!
39+
# Wait for output to appear (with timeout)
40+
timeout=30
41+
elapsed=0
42+
while [ $elapsed -lt $timeout ]; do
43+
if grep -q "running at port 8081" output.log; then
44+
echo "✅ Application started successfully"
45+
exit 0
46+
fi
47+
sleep 1
48+
elapsed=$((elapsed+1))
49+
done
50+
echo "❌ Application failed to start within $timeout seconds"
51+
cat output.log
52+
exit 1
53+
working-directory: functions/${{ matrix.function }}

0 commit comments

Comments
 (0)