-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (73 loc) · 2.41 KB
/
main.yml
File metadata and controls
76 lines (73 loc) · 2.41 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
name: Sample CI
on: [ push, pull_request ]
permissions:
contents: read
jobs:
test-functions:
strategy:
matrix:
function:
- hello
- host-details
- log-event
- servicenow
- host-info
- user-management
name: Test ${{ matrix.function }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.13'
cache: 'pip'
cache-dependency-path: 'functions/${{ matrix.function }}/requirements.txt'
- 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: Verify function starts
run: |
timeout 30s bash -c '
python main.py > output.log 2>&1 &
PID=$!
while ! grep -q "running at port 8081" output.log 2>/dev/null; do
sleep 1
done
echo "✅ Application started successfully"
kill $PID 2>/dev/null || true
' || {
echo "❌ Application failed to start"
cat output.log 2>/dev/null || echo "No output log found"
exit 1
}
working-directory: functions/${{ matrix.function }}
build-ui:
name: Build UI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Node
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'ui/extensions/hello/package-lock.json'
- name: Install dependencies
run: npm ci
working-directory: ui/extensions/hello
- name: Build React app
run: npm run build
working-directory: ui/extensions/hello
- name: Test React app
run: npm test
working-directory: ui/extensions/hello