Skip to content

Commit 7f95ecf

Browse files
Copilotguygregory
andcommitted
Fix GitHub Action workflow formatting and add .gitignore
Co-authored-by: guygregory <16044916+guygregory@users.noreply.github.com>
1 parent e6dfdc1 commit 7f95ecf

3 files changed

Lines changed: 122 additions & 101 deletions

File tree

Lines changed: 102 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Test Azure OpenAI Responses API
23

34
on:
@@ -7,111 +8,111 @@ jobs:
78
test-responses-api:
89
runs-on: ubuntu-latest
910
environment: responses # Use the 'responses' environment for secrets
10-
11+
1112
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-
# Create test results directory
34-
mkdir -p test-results
35-
36-
# Get current timestamp
37-
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
38-
echo "Test run timestamp: $timestamp"
39-
40-
# Run the script and capture output
41-
python responses-basic-aoai-v1.py > output.txt 2>&1
42-
exit_code=$?
43-
44-
# Initialize test result variables
45-
pass_fail="PASS"
46-
error_code=""
47-
output_text=""
48-
49-
# Check if script executed successfully
50-
if [ $exit_code -eq 0 ]; then
51-
echo "✅ Script executed successfully"
52-
53-
# Check if output was generated and capture it
54-
if [ -s output.txt ]; then
55-
output_text=$(cat output.txt)
56-
echo "✅ Script produced output:"
57-
echo "$output_text"
58-
59-
# Test whether response.output_text contains a valid string
60-
# Valid means: non-empty, no error indicators, and actual content
61-
if [ -n "$output_text" ] && ! echo "$output_text" | grep -qi "error\|exception\|traceback\|failed\|none\|null"; then
62-
echo "✅ Output contains valid string content"
63-
pass_fail="PASS"
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
26+
- name: Test Azure OpenAI Responses API
27+
env:
28+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
29+
AZURE_OPENAI_V1_API_ENDPOINT: ${{ secrets.AZURE_OPENAI_V1_API_ENDPOINT }}
30+
AZURE_OPENAI_API_MODEL: ${{ secrets.AZURE_OPENAI_API_MODEL }}
31+
run: |
32+
echo "Testing responses-basic-aoai-v1.py script..."
33+
34+
# Create test results directory
35+
mkdir -p test-results
36+
37+
# Get current timestamp
38+
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
39+
echo "Test run timestamp: $timestamp"
40+
41+
# Run the script and capture output
42+
python responses-basic-aoai-v1.py > output.txt 2>&1
43+
exit_code=$?
44+
45+
# Initialize test result variables
46+
pass_fail="PASS"
47+
error_code=""
48+
output_text=""
49+
50+
# Check if script executed successfully
51+
if [ $exit_code -eq 0 ]; then
52+
echo "✅ Script executed successfully"
53+
54+
# Check if output was generated and capture it
55+
if [ -s output.txt ]; then
56+
output_text=$(cat output.txt)
57+
echo "✅ Script produced output:"
58+
echo "$output_text"
59+
60+
# Test whether response.output_text contains a valid string
61+
# Valid means: non-empty, no error indicators, and actual content
62+
if [ -n "$output_text" ] && ! echo "$output_text" | grep -qi "error\|exception\|traceback\|failed\|none\|null"; then
63+
echo "✅ Output contains valid string content"
64+
pass_fail="PASS"
65+
else
66+
echo "❌ Output does not contain valid string content"
67+
pass_fail="FAIL"
68+
error_code="INVALID_OUTPUT"
69+
fi
6470
else
65-
echo "❌ Output does not contain valid string content"
71+
echo "❌ Script produced no output"
6672
pass_fail="FAIL"
67-
error_code="INVALID_OUTPUT"
73+
error_code="NO_OUTPUT"
6874
fi
6975
else
70-
echo "❌ Script produced no output"
76+
echo "❌ Script failed with exit code: $exit_code"
77+
echo "Error output:"
78+
cat output.txt
79+
output_text=$(cat output.txt)
7180
pass_fail="FAIL"
72-
error_code="NO_OUTPUT"
81+
error_code="SCRIPT_ERROR_$exit_code"
7382
fi
74-
else
75-
echo "❌ Script failed with exit code: $exit_code"
76-
echo "Error output:"
77-
cat output.txt
78-
output_text=$(cat output.txt)
79-
pass_fail="FAIL"
80-
error_code="SCRIPT_ERROR_$exit_code"
81-
fi
82-
83-
# Create test results JSON (using jq for proper JSON formatting)
84-
jq -n \
85-
--arg timestamp "$timestamp" \
86-
--arg output "$output_text" \
87-
--arg pass_fail "$pass_fail" \
88-
--arg error_code "$error_code" \
89-
'{
90-
test_last_run_date: $timestamp,
91-
output: $output,
92-
pass_fail: $pass_fail,
93-
error_code: $error_code
94-
}' > test-results/test-results.json
95-
96-
# Display final results
97-
echo "=== Test Results ==="
98-
echo "Timestamp: $timestamp"
99-
echo "Pass/Fail: $pass_fail"
100-
echo "Error Code: $error_code"
101-
echo "Output: $output_text"
102-
103-
# Exit with error if test failed
104-
if [ "$pass_fail" = "FAIL" ]; then
105-
echo "❌ Test failed"
106-
exit 1
107-
else
108-
echo "🎉 Test completed successfully!"
109-
fi
110-
111-
- name: Upload test results artifact
112-
uses: actions/upload-artifact@v4
113-
if: always() # Upload artifact even if the test fails
114-
with:
115-
name: azure-openai-test-results
116-
path: test-results/
117-
retention-days: 30
83+
84+
# Create test results JSON (using jq for proper JSON formatting)
85+
jq -n \
86+
--arg timestamp "$timestamp" \
87+
--arg output "$output_text" \
88+
--arg pass_fail "$pass_fail" \
89+
--arg error_code "$error_code" \
90+
'{
91+
test_last_run_date: $timestamp,
92+
output: $output,
93+
pass_fail: $pass_fail,
94+
error_code: $error_code
95+
}' > test-results/test-results.json
96+
97+
# Display final results
98+
echo "=== Test Results ==="
99+
echo "Timestamp: $timestamp"
100+
echo "Pass/Fail: $pass_fail"
101+
echo "Error Code: $error_code"
102+
echo "Output: $output_text"
103+
104+
# Exit with error if test failed
105+
if [ "$pass_fail" = "FAIL" ]; then
106+
echo "❌ Test failed"
107+
exit 1
108+
else
109+
echo "🎉 Test completed successfully!"
110+
fi
111+
112+
- name: Upload test results artifact
113+
uses: actions/upload-artifact@v4
114+
if: always() # Upload artifact even if the test fails
115+
with:
116+
name: azure-openai-test-results
117+
path: test-results/
118+
retention-days: 30

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Python cache files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Environment files
7+
.env
8+
9+
# Virtual environments
10+
venv/
11+
env/
12+
ENV/
13+
14+
# IDE files
15+
.vscode/
16+
.idea/
17+
18+
# OS files
19+
.DS_Store
20+
Thumbs.db
-800 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)