Skip to content

Commit 2a840f8

Browse files
committed
add test branch for gh action based labs
1 parent 51c5e43 commit 2a840f8

111 files changed

Lines changed: 1766 additions & 7962 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Documentation Validation
2+
3+
on:
4+
push:
5+
paths:
6+
- 'docs/**'
7+
- '*.md'
8+
- 'Instructions/**'
9+
pull_request:
10+
paths:
11+
- 'docs/**'
12+
- '*.md'
13+
- 'Instructions/**'
14+
15+
jobs:
16+
validate-docs:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '18'
27+
28+
- name: Install markdownlint
29+
run: npm install -g markdownlint-cli
30+
31+
- name: Validate markdown files
32+
run: |
33+
markdownlint docs/ --ignore node_modules
34+
markdownlint *.md --ignore node_modules
35+
markdownlint Instructions/ --ignore node_modules
36+
continue-on-error: true
37+
38+
- name: Check markdown links
39+
uses: gaurav-nelson/github-action-markdown-link-check@v1
40+
with:
41+
use-quiet-mode: 'yes'
42+
use-verbose-mode: 'yes'
43+
config-file: '.github/workflows/markdown-link-check-config.json'
44+
folder-path: 'docs/, Instructions/'
45+
continue-on-error: true
46+
47+
spell-check:
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: '18'
58+
59+
- name: Install cspell
60+
run: npm install -g cspell
61+
62+
- name: Run spell check
63+
run: |
64+
cspell "docs/**/*.md"
65+
cspell "*.md"
66+
cspell "Instructions/**/*.md"
67+
continue-on-error: true
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: "Lab 07: Monitor GenAI Application"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Environment to deploy to'
8+
required: true
9+
default: 'dev'
10+
type: choice
11+
options:
12+
- dev
13+
- staging
14+
- prod
15+
num_requests:
16+
description: 'Number of telemetry requests to generate'
17+
required: false
18+
default: '5'
19+
type: string
20+
push:
21+
paths:
22+
- 'labs/07-observability/**'
23+
- '.github/workflows/lab-07-monitor.yml'
24+
branches:
25+
- main
26+
- 'lab/07-*'
27+
pull_request:
28+
paths:
29+
- 'labs/07-observability/**'
30+
31+
env:
32+
LAB_NAME: "07-observability"
33+
LAB_TITLE: "Monitor GenAI Application"
34+
35+
jobs:
36+
monitor-genai:
37+
runs-on: ubuntu-latest
38+
environment: ${{ github.event.inputs.environment || 'dev' }}
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Python 3.8+
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: '3.8'
48+
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install azure-ai-projects azure-identity azure-monitor-opentelemetry python-dotenv
53+
54+
- name: Azure login
55+
uses: azure/login@v1
56+
with:
57+
creds: ${{ secrets.AZURE_CREDENTIALS }}
58+
59+
- name: Set up environment variables
60+
run: |
61+
echo "PROJECT_CONNECTION_STRING=${{ secrets.PROJECT_CONNECTION_STRING }}" >> $GITHUB_ENV
62+
echo "CI_MODE=true" >> $GITHUB_ENV
63+
64+
- name: Run Lab 07 - Monitor GenAI Application
65+
working-directory: ./labs/07-observability
66+
run: |
67+
echo "::group::Lab Execution"
68+
python monitor_genai.py --ci-mode --requests ${{ github.event.inputs.num_requests || '5' }}
69+
echo "::endgroup::"
70+
71+
- name: Upload lab results
72+
uses: actions/upload-artifact@v3
73+
if: always()
74+
with:
75+
name: lab-07-monitoring-results-${{ github.run_id }}
76+
path: |
77+
labs/07-observability/monitoring_results.json
78+
retention-days: 30
79+
80+
- name: Comment on PR with results
81+
if: github.event_name == 'pull_request'
82+
uses: actions/github-script@v6
83+
with:
84+
script: |
85+
const fs = require('fs');
86+
87+
let resultsContent = 'Lab execution failed - no results file found';
88+
try {
89+
const results = JSON.parse(fs.readFileSync('labs/07-observability/monitoring_results.json', 'utf8'));
90+
91+
const summary = results.summary || {};
92+
resultsContent = `## 📊 Lab 07: Monitor GenAI Application Results
93+
94+
**Status:** ${results.status === 'success' ? '✅ Success' : '❌ Failed'}
95+
**Environment:** ${{ github.event.inputs.environment || 'dev' }}
96+
**Execution Time:** ${new Date().toISOString()}
97+
98+
### 📈 Monitoring Results
99+
- **Monitoring Enabled:** ${summary.monitoring_enabled ? '✅' : '❌'}
100+
- **Application Insights Connected:** ${summary.application_insights_connected ? '✅' : '❌'}
101+
- **Requests Generated:** ${summary.total_requests_generated || 0}
102+
- **Success Rate:** ${summary.success_rate || '0%'}
103+
- **Average Response Time:** ${Math.round(summary.avg_response_time_ms || 0)}ms
104+
105+
### 🔍 Telemetry Data
106+
- **Total Requests:** ${summary.total_requests_generated || 0}
107+
- **Successful Requests:** ${summary.successful_requests || 0}
108+
109+
${results.status === 'failed' ? `
110+
### ❌ Errors
111+
\`\`\`
112+
${results.error || 'Unknown error occurred'}
113+
\`\`\`
114+
` : ''}
115+
116+
### 🔗 View Results
117+
- **Azure AI Foundry:** Check the monitoring dashboard in your AI Foundry project
118+
- **Application Insights:** View detailed telemetry in Azure Portal
119+
- [Download detailed results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
120+
121+
### 📚 Next Steps
122+
1. Open your Azure AI Foundry project
123+
2. Navigate to the **Monitoring** section
124+
3. Review the generated telemetry data
125+
4. Set up custom alerts and dashboards
126+
`;
127+
} catch (error) {
128+
console.error('Error reading results:', error);
129+
}
130+
131+
github.rest.issues.createComment({
132+
issue_number: context.issue.number,
133+
owner: context.repo.owner,
134+
repo: context.repo.repo,
135+
body: resultsContent
136+
});
137+
138+
- name: Final status check
139+
if: always()
140+
run: |
141+
if [ -f "labs/07-observability/monitoring_results.json" ]; then
142+
status=$(python -c "import json; print(json.load(open('labs/07-observability/monitoring_results.json')).get('status', 'failed'))")
143+
if [ "$status" = "success" ]; then
144+
echo "::notice title=Lab 07 Success::Monitoring lab completed successfully! 📊"
145+
exit 0
146+
else
147+
echo "::error title=Lab 07 Failed::Monitoring lab failed. Check logs for details."
148+
exit 1
149+
fi
150+
else
151+
echo "::error title=Lab 07 Failed::No results file found."
152+
exit 1
153+
fi

.github/workflows/lab-08-trace.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: "Lab 08: Trace GenAI Application"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Environment to deploy to'
8+
required: true
9+
default: 'dev'
10+
type: choice
11+
options:
12+
- dev
13+
- staging
14+
- prod
15+
push:
16+
paths:
17+
- 'labs/08-tracing/**'
18+
- '.github/workflows/lab-08-trace.yml'
19+
branches:
20+
- main
21+
- 'lab/08-*'
22+
pull_request:
23+
paths:
24+
- 'labs/08-tracing/**'
25+
26+
env:
27+
LAB_NAME: "08-tracing"
28+
LAB_TITLE: "Trace GenAI Application"
29+
30+
jobs:
31+
trace-genai:
32+
runs-on: ubuntu-latest
33+
environment: ${{ github.event.inputs.environment || 'dev' }}
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
- name: Set up Python 3.8+
40+
uses: actions/setup-python@v4
41+
with:
42+
python-version: '3.8'
43+
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install azure-ai-projects azure-identity azure-monitor-opentelemetry azure-ai-inference python-dotenv
48+
49+
- name: Azure login
50+
uses: azure/login@v1
51+
with:
52+
creds: ${{ secrets.AZURE_CREDENTIALS }}
53+
54+
- name: Set up environment variables
55+
run: |
56+
echo "PROJECT_CONNECTION_STRING=${{ secrets.PROJECT_CONNECTION_STRING }}" >> $GITHUB_ENV
57+
echo "CI_MODE=true" >> $GITHUB_ENV
58+
59+
- name: Run Lab 08 - Trace GenAI Application
60+
working-directory: ./labs/08-tracing
61+
run: |
62+
echo "::group::Lab Execution"
63+
python trace_genai.py --ci-mode
64+
echo "::endgroup::"
65+
66+
- name: Upload lab results
67+
uses: actions/upload-artifact@v3
68+
if: always()
69+
with:
70+
name: lab-08-tracing-results-${{ github.run_id }}
71+
path: |
72+
labs/08-tracing/tracing_results.json
73+
retention-days: 30
74+
75+
- name: Comment on PR with results
76+
if: github.event_name == 'pull_request'
77+
uses: actions/github-script@v6
78+
with:
79+
script: |
80+
const fs = require('fs');
81+
82+
let resultsContent = 'Lab execution failed - no results file found';
83+
try {
84+
const results = JSON.parse(fs.readFileSync('labs/08-tracing/tracing_results.json', 'utf8'));
85+
86+
const summary = results.summary || {};
87+
resultsContent = `## 🔍 Lab 08: Trace GenAI Application Results
88+
89+
**Status:** ${results.status === 'success' ? '✅ Success' : '❌ Failed'}
90+
**Environment:** ${{ github.event.inputs.environment || 'dev' }}
91+
**Execution Time:** ${new Date().toISOString()}
92+
93+
### 🔬 Tracing Results
94+
- **Tracing Enabled:** ${summary.tracing_enabled ? '✅' : '❌'}
95+
- **Content Recording:** ${summary.content_recording_enabled ? '✅' : '❌'}
96+
- **Workflows Executed:** ${summary.workflows_executed || 0}
97+
- **Spans Created:** ${summary.total_spans_created || 0}
98+
- **Workflow Success Rate:** ${summary.workflow_success_rate || '0%'}
99+
- **Error Scenarios Traced:** ${summary.error_scenarios_traced || 0}
100+
101+
### 🏃‍♂️ Workflow Analysis
102+
- **Hiking Assistant Workflow:** Multi-step AI workflow with preferences, recommendations, and gear suggestions
103+
- **Error Scenario Tracing:** Demonstrated error handling and tracing capabilities
104+
- **Distributed Tracing:** Each step traced with detailed span information
105+
106+
${results.status === 'failed' ? `
107+
### ❌ Errors
108+
\`\`\`
109+
${results.error || 'Unknown error occurred'}
110+
\`\`\`
111+
` : ''}
112+
113+
### 🔗 View Traces
114+
- **Azure AI Foundry:** Check the tracing dashboard in your AI Foundry project
115+
- **Application Insights:** View detailed distributed traces in Azure Portal
116+
- **Transaction Search:** Use Application Insights transaction search to find specific traces
117+
- [Download detailed results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
118+
119+
### 📚 Next Steps
120+
1. Open your Azure AI Foundry project
121+
2. Navigate to the **Tracing** section
122+
3. Search for traces with your session IDs
123+
4. Analyze the workflow execution paths
124+
5. Review error scenarios and debugging information
125+
`;
126+
} catch (error) {
127+
console.error('Error reading results:', error);
128+
}
129+
130+
github.rest.issues.createComment({
131+
issue_number: context.issue.number,
132+
owner: context.repo.owner,
133+
repo: context.repo.repo,
134+
body: resultsContent
135+
});
136+
137+
- name: Final status check
138+
if: always()
139+
run: |
140+
if [ -f "labs/08-tracing/tracing_results.json" ]; then
141+
status=$(python -c "import json; print(json.load(open('labs/08-tracing/tracing_results.json')).get('status', 'failed'))")
142+
if [ "$status" = "success" ]; then
143+
echo "::notice title=Lab 08 Success::Tracing lab completed successfully! 🔍"
144+
exit 0
145+
else
146+
echo "::error title=Lab 08 Failed::Tracing lab failed. Check logs for details."
147+
exit 1
148+
fi
149+
else
150+
echo "::error title=Lab 08 Failed::No results file found."
151+
exit 1
152+
fi

0 commit comments

Comments
 (0)