Skip to content

Commit 76294c7

Browse files
authored
Update test-aoai-response.yml
1 parent b72606f commit 76294c7

1 file changed

Lines changed: 7 additions & 40 deletions

File tree

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,25 @@
1-
name: Test Azure OpenAI response
2-
3-
on:
4-
workflow_dispatch: # run only when you click “Run workflow”
5-
6-
jobs:
7-
response-test:
8-
runs-on: ubuntu-latest
9-
environment: responses # pulls in the secrets already in that env
10-
11-
steps:
12-
- name: ⬇️ Check out repo
13-
uses: actions/checkout@v4
14-
15-
- name: 🐍 Set up Python
16-
uses: actions/setup-python@v5
17-
with:
18-
python-version: '3.11'
19-
20-
- name: 📦 Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install openai python-dotenv
24-
25-
# ───────────── CORE TEST STEP ─────────────
261
- name: 🧪 Run script & build report
272
id: test
28-
shell: python # <<< everything below is pure Python
293
env:
304
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
315
AZURE_OPENAI_V1_API_ENDPOINT: ${{ secrets.AZURE_OPENAI_V1_API_ENDPOINT }}
326
AZURE_OPENAI_API_MODEL: ${{ secrets.AZURE_OPENAI_API_MODEL }}
337
run: |
8+
python - <<'PY'
349
import datetime, json, pathlib, subprocess, sys
3510
36-
# run the existing file and capture its stdout / exit code
11+
# Execute your existing script and capture its stdout / exit code
3712
proc = subprocess.run(
3813
[sys.executable, "responses-basic-aoai-v1.py"],
3914
capture_output=True, text=True
4015
)
41-
output = proc.stdout.strip()
42-
error_code = proc.returncode
43-
passed = bool(output) and error_code == 0 # tweak if you need stricter logic
16+
output = proc.stdout.strip()
17+
error_code = proc.returncode
18+
passed = bool(output) and error_code == 0 # customise as needed
4419
4520
result = {
4621
"run_timestamp_utc": datetime.datetime.utcnow()
47-
.isoformat(timespec="seconds") + "Z",
22+
.isoformat(timespec="seconds") + "Z",
4823
"output": output,
4924
"pass": passed,
5025
"error_code": error_code,
@@ -54,14 +29,6 @@ jobs:
5429
json.dumps(result, indent=2), encoding="utf-8"
5530
)
5631
57-
# Fail the job if the test failed
5832
if not passed:
5933
sys.exit(error_code or 1)
60-
61-
# ───────────── UPLOAD REPORT ─────────────
62-
- name: 📤 Upload test artifact
63-
if: always() # still run even if the step above failed
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: aoai-response-test
67-
path: aoai_test_result.json
34+
PY

0 commit comments

Comments
 (0)