|
1 | | -name: Test AOAI Responses API |
| 1 | +name: Test Azure OpenAI response |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
@@ -32,33 +32,32 @@ jobs: |
32 | 32 | AZURE_OPENAI_API_MODEL: ${{ secrets.AZURE_OPENAI_API_MODEL }} |
33 | 33 | run: | |
34 | 34 | python - <<'PY' |
35 | | -import datetime, json, os, subprocess, sys, textwrap, shlex, pathlib |
| 35 | + import datetime, json, os, subprocess, sys, pathlib |
36 | 36 |
|
37 | | -# Execute the existing script and capture its stdout / exit code |
38 | | -proc = subprocess.run( |
39 | | - [sys.executable, "responses-basic-aoai-v1.py"], |
40 | | - capture_output=True, text=True |
41 | | -) |
42 | | -output = proc.stdout.strip() |
43 | | -error_code = proc.returncode |
44 | | -passed = bool(output) and error_code == 0 # tweak this test however you like |
| 37 | + # Execute the existing script and capture its stdout / exit code |
| 38 | + proc = subprocess.run( |
| 39 | + [sys.executable, "responses-basic-aoai-v1.py"], |
| 40 | + capture_output=True, text=True |
| 41 | + ) |
| 42 | + output = proc.stdout.strip() |
| 43 | + error_code = proc.returncode |
| 44 | + passed = bool(output) and error_code == 0 # tweak this test however you like |
45 | 45 |
|
46 | | -result = { |
47 | | - "run_timestamp_utc": datetime.datetime.utcnow().isoformat(timespec="seconds") + "Z", |
48 | | - "output": output, |
49 | | - "pass": passed, |
50 | | - "error_code": error_code, |
51 | | -} |
| 46 | + result = { |
| 47 | + "run_timestamp_utc": datetime.datetime.utcnow().isoformat(timespec="seconds") + "Z", |
| 48 | + "output": output, |
| 49 | + "pass": passed, |
| 50 | + "error_code": error_code, |
| 51 | + } |
52 | 52 |
|
53 | | -path = pathlib.Path("aoai_test_result.json") |
54 | | -path.write_text(json.dumps(result, indent=2), encoding="utf-8") |
| 53 | + pathlib.Path("aoai_test_result.json").write_text( |
| 54 | + json.dumps(result, indent=2), encoding="utf-8" |
| 55 | + ) |
55 | 56 |
|
56 | | -# Surface the “pass” status to later steps |
57 | | -print(f"pass={passed}", file=sys.stderr) |
58 | | -# Exit non‑zero only if you want the job to fail on an invalid response: |
59 | | -if not passed: |
60 | | - sys.exit(error_code or 1) |
61 | | -PY |
| 57 | + # Exit non‑zero if the test failed so the job goes red |
| 58 | + if not passed: |
| 59 | + sys.exit(error_code or 1) |
| 60 | + PY |
62 | 61 |
|
63 | 62 | # ───────────── UPLOAD REPORT ───────────── |
64 | 63 | - name: 📤 Upload test artifact |
|
0 commit comments