1+ name : Test Azure OpenAI Responses API
2+
3+ on :
4+ workflow_dispatch : # Allows manual triggering of the workflow
5+
6+ jobs :
7+ test-responses-api :
8+ runs-on : ubuntu-latest
9+ environment : responses # Use the 'responses' environment for secrets
10+
11+ steps :
12+ - name : Checkout repository
13+ uses : actions/checkout@v4
14+
15+ - name : Set up Python
16+ uses : actions/setup-python@v4
17+ with :
18+ python-version : ' 3.11'
19+
20+ - name : Install dependencies
21+ run : |
22+ python -m pip install --upgrade pip
23+ pip install -r requirements.txt
24+
25+ - name : Test Azure OpenAI Responses API
26+ env :
27+ AZURE_OPENAI_API_KEY : ${{ secrets.AZURE_OPENAI_API_KEY }}
28+ AZURE_OPENAI_V1_API_ENDPOINT : ${{ secrets.AZURE_OPENAI_V1_API_ENDPOINT }}
29+ AZURE_OPENAI_API_MODEL : ${{ secrets.AZURE_OPENAI_API_MODEL }}
30+ run : |
31+ echo "Testing responses-basic-aoai-v1.py script..."
32+
33+ # Run the script and capture output
34+ python responses-basic-aoai-v1.py > output.txt 2>&1
35+ exit_code=$?
36+
37+ # Check if script executed successfully
38+ if [ $exit_code -eq 0 ]; then
39+ echo "✅ Script executed successfully"
40+ else
41+ echo "❌ Script failed with exit code: $exit_code"
42+ echo "Error output:"
43+ cat output.txt
44+ exit 1
45+ fi
46+
47+ # Check if output was generated
48+ if [ -s output.txt ]; then
49+ echo "✅ Script produced output:"
50+ cat output.txt
51+
52+ # Basic validation that output is not empty and doesn't contain common error patterns
53+ if grep -qi "error\|exception\|traceback\|failed" output.txt; then
54+ echo "❌ Output contains error indicators"
55+ exit 1
56+ else
57+ echo "✅ Output appears to be valid (no error indicators found)"
58+ fi
59+ else
60+ echo "❌ Script produced no output"
61+ exit 1
62+ fi
63+
64+ echo "🎉 Test completed successfully!"
0 commit comments