Skip to content

Commit 46f440f

Browse files
committed
Added Test to Readme
1 parent c934c74 commit 46f440f

File tree

1 file changed

+0
-67
lines changed

1 file changed

+0
-67
lines changed
Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +0,0 @@
1-
name: Validate Azure OpenAI response
2-
3-
on:
4-
workflow_dispatch: # run on demand from the Actions tab
5-
6-
jobs:
7-
run-validation:
8-
runs-on: ubuntu-latest
9-
environment: responses # 🔑 unlocks the environment‑scoped secrets
10-
11-
# Expose the environment secrets as real process env‑vars
12-
env:
13-
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
14-
AZURE_OPENAI_V1_API_ENDPOINT: ${{ secrets.AZURE_OPENAI_V1_API_ENDPOINT }}
15-
AZURE_OPENAI_API_MODEL: ${{ secrets.AZURE_OPENAI_API_MODEL }}
16-
17-
steps:
18-
# 1 – check out the repo so the script is available
19-
- uses: actions/checkout@v4
20-
21-
# 2 – set up Python
22-
- uses: actions/setup-python@v5
23-
with:
24-
python-version: "3.11"
25-
26-
# 3 – install the script’s two lightweight deps
27-
- name: Install requirements
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install openai python-dotenv
31-
32-
# 4 – run the script, grade the result, assemble a report
33-
- name: Execute script and capture outcome
34-
id: test
35-
shell: bash
36-
run: |
37-
set +e # we want to handle failures ourselves
38-
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
39-
40-
# === run the user script ===
41-
python responses-basic-aoai-v1.py > out.txt 2>&1
42-
EXIT_CODE=$?
43-
44-
# === decide pass / fail ===
45-
if [[ $EXIT_CODE -eq 0 && -s out.txt ]]; then
46-
PASS_FAIL="PASS"
47-
else
48-
PASS_FAIL="FAIL"
49-
fi
50-
51-
# === build JSON report ===
52-
jq -n \
53-
--arg date "$TIMESTAMP" \
54-
--arg output "$(cat out.txt | tr -d '\r')" \
55-
--arg pass_fail "$PASS_FAIL" \
56-
--argjson code "$EXIT_CODE" \
57-
'{test_run_date: $date,
58-
output: $output,
59-
pass_fail: $pass_fail,
60-
error_code: $code}' > aoai-test-result.json
61-
62-
# 5 – make the report downloadable from the run summary
63-
- name: Upload result artifact
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: aoai-response-test # folder name visible in the UI
67-
path: aoai-test-result.json

0 commit comments

Comments
 (0)