28
28
- name : Run pre-commit hooks
29
29
uses : pre-commit/action@v3.0.1
30
30
31
+
31
32
unit-tests :
32
33
runs-on : ubuntu-24.04
34
+
33
35
if : github.event.pull_request.draft == false
34
36
needs : pre-commit
35
37
env :
@@ -48,58 +50,26 @@ jobs:
48
50
- name : Install dependencies
49
51
run : |
50
52
python -m pip install --upgrade pip
51
- if [ -f requirements.txt ]; then
53
+ if [ -f requirements.txt ];
54
+ then
52
55
pip install -r requirements.txt
53
56
fi
54
57
55
58
- name : Install Azure Functions Core Tools
56
59
run : |
57
60
npm install -g azure-functions-core-tools@4 --unsafe-perm true
58
61
59
- - name : Test function imports
60
- run : |
61
- echo "Testing function_app.py import..."
62
- python -c "
63
- try:
64
- import function_app
65
- print('SUCCESS: function_app imported')
66
- except Exception as e:
67
- print('FAILED:', str(e))
68
- exit(1)
69
- "
70
-
71
62
- name : Start Azure Functions
72
63
run : |
73
64
# Start Azure Functions in the background
74
- func start --port 7071 --no-build --verbose > func.log 2>&1 &
65
+ func start --port 7071 --no-build > func.log 2>&1 &
75
66
echo $! > func.pid
76
-
77
- # Wait for the functions to be ready with better checking
78
- echo "Waiting for Azure Functions to start..."
79
- for i in {1..30}; do
80
- if curl -s -f http://localhost:7071/api/resources/filters > /dev/null 2>&1; then
81
- echo "Azure Functions is ready! (attempt $i)"
82
- break
83
- fi
84
- if [ $i -eq 30 ]; then
85
- echo "Functions failed to start after 30 attempts. Logs:"
86
- cat func.log
87
- exit 1
88
- fi
89
- echo "Attempt $i/30: Functions not ready yet..."
90
- sleep 2
91
- done
67
+ # Wait for the functions to be ready (adjust time as needed)
68
+ sleep 20
92
69
93
70
- name : Run tests
94
71
run : |
95
72
python3 -m unittest tests.resources_api_unit_tests -v
96
-
97
- - name : Show logs on failure
98
- if : failure()
99
- run : |
100
- echo "=== Azure Functions Logs ==="
101
- cat func.log || echo "No func.log found"
102
-
103
73
- name : Cleanup Azure Functions
104
74
if : always()
105
75
run : |
0 commit comments