Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions .github/workflows/e2e-nodejs-copilot-studio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

name: E2E - Node.js Copilot Studio

on:
workflow_call: # Allow orchestrator to call this workflow
workflow_dispatch: # Allow manual triggering
push:
branches: [main]
paths:
- 'nodejs/copilot-studio/**'
- 'scripts/e2e/**'
- '.github/workflows/e2e-nodejs-copilot-studio.yml'
pull_request:
branches: [main]
paths:
- 'nodejs/copilot-studio/**'
- 'scripts/e2e/**'

permissions:
contents: read

env:
SAMPLE_PATH: nodejs/copilot-studio/sample-agent
AGENT_PORT: 3978
SCRIPTS_PATH: scripts/e2e
E2E_TESTS_PATH: tests/e2e

jobs:
nodejs-copilot-studio:
name: Node.js Copilot Studio Agent
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
working-directory: ${{ env.SAMPLE_PATH }}
run: |
if (Test-Path "package-lock.json") {
npm ci
} else {
npm install
}
if (Test-Path "tsconfig.json") {
npm run build
}
shell: pwsh

- name: Log SDK Versions
shell: pwsh
run: |
& "${{ env.SCRIPTS_PATH }}/Get-SDKVersions.ps1" `
-Runtime "nodejs" `
-WorkingDirectory "${{ env.SAMPLE_PATH }}"

- name: Acquire Bearer Token (ROPC)
id: token
shell: pwsh
run: |
$token = & "${{ env.SCRIPTS_PATH }}/Acquire-BearerToken.ps1" `
-ClientId "${{ secrets.MCP_CLIENT_ID }}" `
-TenantId "${{ secrets.MCP_TENANT_ID }}" `
-Username "${{ secrets.MCP_TEST_USERNAME }}" `
-Password "${{ secrets.MCP_TEST_PASSWORD }}"
echo "BEARER_TOKEN=$token" >> $env:GITHUB_OUTPUT
echo "::add-mask::$token"

- name: Generate .env configuration
shell: pwsh
run: |
$configMappings = @{
"NODE_ENV" = "development"
"directConnectUrl" = "${{ secrets.NODEJS_COPILOT_STUDIO_DIRECT_CONNECT_URL }}"
"environmentId" = "${{ secrets.NODEJS_COPILOT_STUDIO_ENVIRONMENT_ID }}"
"agentIdentifier" = "${{ secrets.NODEJS_COPILOT_STUDIO_AGENT_IDENTIFIER }}"
"connections__service_connection__settings__authType" = "ClientSecret"
"connections__service_connection__settings__clientId" = "${{ secrets.NODEJS_COPILOT_STUDIO_AGENT_ID }}"
"connections__service_connection__settings__clientSecret" = "${{ secrets.NODEJS_COPILOT_STUDIO_CLIENT_SECRET }}"
"connections__service_connection__settings__tenantId" = "${{ secrets.TENANT_ID }}"
"connectionsMap__0__serviceUrl" = "*"
"connectionsMap__0__connection" = "service_connection"
"agentic_scopes" = "https://api.powerplatform.com/.default"
}
& "${{ env.SCRIPTS_PATH }}/Generate-EnvConfig.ps1" `
-OutputPath "${{ env.SAMPLE_PATH }}/.env" `
-BearerToken "${{ steps.token.outputs.BEARER_TOKEN }}" `
-Port ${{ env.AGENT_PORT }} `
-ConfigMappings $configMappings

Comment thread
abdulanu0 marked this conversation as resolved.
Outdated
- name: Start Agent
id: start-agent
shell: pwsh
run: |
$agentPid = & "${{ env.SCRIPTS_PATH }}/Start-Agent.ps1" `
-AgentPath "${{ env.SAMPLE_PATH }}" `
-StartCommand "node dist/index.js" `
-Port ${{ env.AGENT_PORT }} `
-BearerToken "${{ steps.token.outputs.BEARER_TOKEN }}" `
-Environment "Development" `
-Runtime "nodejs"
echo "AGENT_PID=$agentPid" >> $env:GITHUB_OUTPUT

- name: Verify Agent Running
shell: pwsh
run: |
$agentPid = "${{ steps.start-agent.outputs.AGENT_PID }}"
if ($agentPid) {
try {
$proc = Get-Process -Id $agentPid -ErrorAction Stop
Write-Host "Agent process (PID: $agentPid) is running: $($proc.ProcessName)" -ForegroundColor Green
} catch {
Write-Host "ERROR: Agent process (PID: $agentPid) is NOT running!" -ForegroundColor Red
throw "Agent process has stopped"
}
}
$agentUrl = "http://localhost:${{ env.AGENT_PORT }}"
$healthResponse = Invoke-WebRequest -Uri "$agentUrl/api/health" -Method GET -UseBasicParsing -ErrorAction SilentlyContinue
Write-Host "Health check: $($healthResponse.StatusCode)" -ForegroundColor Green

- name: Restore E2E Test Dependencies
run: dotnet restore "${{ env.E2E_TESTS_PATH }}/Agent365.E2E.Tests.csproj"

- name: Run .NET E2E Tests
shell: pwsh
run: |
dotnet test "${{ env.E2E_TESTS_PATH }}/Agent365.E2E.Tests.csproj" `
--no-restore `
--verbosity normal `
--logger "console;verbosity=detailed" `
--logger "trx;LogFileName=test-results-nodejs-copilot-studio.trx" `
--filter "Category=HTTP"
env:
AGENT_URL: http://localhost:${{ env.AGENT_PORT }}
TEST_RESULTS_DIR: ${{ runner.temp }}/TestConversations

- name: Emit Test Conversations
if: always()
shell: pwsh
run: |
& "${{ env.SCRIPTS_PATH }}/Emit-TestConversations.ps1" `
-TestResultsDir "${{ runner.temp }}/TestConversations"

- name: Capture Agent Logs
if: always()
shell: pwsh
run: |
& "${{ env.SCRIPTS_PATH }}/Capture-AgentLogs.ps1" `
-AgentPath "${{ env.SAMPLE_PATH }}"

- name: Stop Agent Process
if: always()
shell: pwsh
run: |
$agentPid = "${{ steps.start-agent.outputs.AGENT_PID }}"
if ($agentPid) {
& "${{ env.SCRIPTS_PATH }}/Stop-AgentProcess.ps1" -AgentPID $agentPid
}

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-nodejs-copilot-studio
path: |
${{ env.E2E_TESTS_PATH }}/TestResults/**/*.trx
${{ env.E2E_TESTS_PATH }}/TestResults/**/*-logs.txt
retention-days: 7
43 changes: 41 additions & 2 deletions .github/workflows/e2e-orchestrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ on:
options:
- ''
- 'python-openai'
- 'python-af'
- 'python-google-adk'
- 'nodejs-openai'
- 'nodejs-langchain'
- 'nodejs-copilot-studio'
- 'dotnet-sk'
- 'dotnet-af'

Expand All @@ -37,6 +40,18 @@ jobs:
if: ${{ github.event.inputs.sample == '' || github.event.inputs.sample == 'python-openai' }}
uses: ./.github/workflows/e2e-python-openai.yml
secrets: inherit

python-af:
name: Python Agent Framework E2E
if: ${{ github.event.inputs.sample == '' || github.event.inputs.sample == 'python-af' }}
uses: ./.github/workflows/e2e-python-agent-framework.yml
secrets: inherit

python-google-adk:
name: Python Google ADK E2E
if: ${{ github.event.inputs.sample == '' || github.event.inputs.sample == 'python-google-adk' }}
uses: ./.github/workflows/e2e-python-google-adk.yml
secrets: inherit

nodejs-openai:
name: Node.js OpenAI E2E
Expand All @@ -49,6 +64,12 @@ jobs:
if: ${{ github.event.inputs.sample == '' || github.event.inputs.sample == 'nodejs-langchain' }}
uses: ./.github/workflows/e2e-nodejs-langchain.yml
secrets: inherit

nodejs-copilot-studio:
name: Node.js Copilot Studio E2E
if: ${{ github.event.inputs.sample == '' || github.event.inputs.sample == 'nodejs-copilot-studio' }}
uses: ./.github/workflows/e2e-nodejs-copilot-studio.yml
secrets: inherit

dotnet-sk:
name: .NET Semantic Kernel E2E
Expand All @@ -69,7 +90,7 @@ jobs:
e2e-status:
name: E2E Status
runs-on: ubuntu-latest
needs: [python-openai, nodejs-openai, nodejs-langchain, dotnet-sk, dotnet-af]
needs: [python-openai, python-af, python-google-adk, nodejs-openai, nodejs-langchain, nodejs-copilot-studio, dotnet-sk, dotnet-af]
if: always()

steps:
Expand All @@ -78,7 +99,7 @@ jobs:
echo "Checking E2E test results..."

# Get all job results (skipped jobs are fine, failed jobs are not)
results="${{ needs.python-openai.result }} ${{ needs.nodejs-openai.result }} ${{ needs.nodejs-langchain.result }} ${{ needs.dotnet-sk.result }} ${{ needs.dotnet-af.result }}"
results="${{ needs.python-openai.result }} ${{ needs.python-af.result }} ${{ needs.python-google-adk.result }} ${{ needs.nodejs-openai.result }} ${{ needs.nodejs-langchain.result }} ${{ needs.nodejs-copilot-studio.result }} ${{ needs.dotnet-sk.result }} ${{ needs.dotnet-af.result }}"

echo "Job results: $results"

Expand All @@ -97,17 +118,23 @@ jobs:
# Determine overall status
OVERALL_STATUS="✅ All Tests Passed"
if [[ "${{ needs.python-openai.result }}" != "success" ]] || \
[[ "${{ needs.python-af.result }}" != "success" ]] || \
[[ "${{ needs.python-google-adk.result }}" != "success" ]] || \
[[ "${{ needs.nodejs-openai.result }}" != "success" ]] || \
[[ "${{ needs.nodejs-langchain.result }}" != "success" ]] || \
[[ "${{ needs.nodejs-copilot-studio.result }}" != "success" ]] || \
[[ "${{ needs.dotnet-sk.result }}" != "success" ]] || \
[[ "${{ needs.dotnet-af.result }}" != "success" ]]; then
OVERALL_STATUS="⚠️ Some Tests Failed"
fi

# Generate status icons using if-else for reliability
if [[ "${{ needs.python-openai.result }}" == "success" ]]; then PYTHON_OPENAI_ICON="✅"; else PYTHON_OPENAI_ICON="❌"; fi
if [[ "${{ needs.python-af.result }}" == "success" ]]; then PYTHON_AF_ICON="✅"; else PYTHON_AF_ICON="❌"; fi
if [[ "${{ needs.python-google-adk.result }}" == "success" ]]; then PYTHON_GOOGLE_ADK_ICON="✅"; else PYTHON_GOOGLE_ADK_ICON="❌"; fi
if [[ "${{ needs.nodejs-openai.result }}" == "success" ]]; then NODEJS_OPENAI_ICON="✅"; else NODEJS_OPENAI_ICON="❌"; fi
if [[ "${{ needs.nodejs-langchain.result }}" == "success" ]]; then NODEJS_LANGCHAIN_ICON="✅"; else NODEJS_LANGCHAIN_ICON="❌"; fi
if [[ "${{ needs.nodejs-copilot-studio.result }}" == "success" ]]; then NODEJS_COPILOT_STUDIO_ICON="✅"; else NODEJS_COPILOT_STUDIO_ICON="❌"; fi
if [[ "${{ needs.dotnet-sk.result }}" == "success" ]]; then DOTNET_SK_ICON="✅"; else DOTNET_SK_ICON="❌"; fi
if [[ "${{ needs.dotnet-af.result }}" == "success" ]]; then DOTNET_AF_ICON="✅"; else DOTNET_AF_ICON="❌"; fi

Expand All @@ -118,8 +145,11 @@ jobs:
echo "| Sample | Status | Result |" >> $GITHUB_STEP_SUMMARY
echo "|--------|--------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Python OpenAI | $PYTHON_OPENAI_ICON | ${{ needs.python-openai.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Python Agent Framework | $PYTHON_AF_ICON | ${{ needs.python-af.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Python Google ADK | $PYTHON_GOOGLE_ADK_ICON | ${{ needs.python-google-adk.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Node.js OpenAI | $NODEJS_OPENAI_ICON | ${{ needs.nodejs-openai.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Node.js LangChain | $NODEJS_LANGCHAIN_ICON | ${{ needs.nodejs-langchain.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Node.js Copilot Studio | $NODEJS_COPILOT_STUDIO_ICON | ${{ needs.nodejs-copilot-studio.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| .NET Semantic Kernel | $DOTNET_SK_ICON | ${{ needs.dotnet-sk.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| .NET Agent Framework | $DOTNET_AF_ICON | ${{ needs.dotnet-af.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
Expand All @@ -131,14 +161,20 @@ jobs:
with:
script: |
const pythonOpenaiIcon = '${{ needs.python-openai.result }}' === 'success' ? '✅' : '❌';
const pythonAfIcon = '${{ needs.python-af.result }}' === 'success' ? '✅' : '❌';
const pythonGoogleAdkIcon = '${{ needs.python-google-adk.result }}' === 'success' ? '✅' : '❌';
const nodejsOpenaiIcon = '${{ needs.nodejs-openai.result }}' === 'success' ? '✅' : '❌';
const nodejsLangchainIcon = '${{ needs.nodejs-langchain.result }}' === 'success' ? '✅' : '❌';
const nodejsCopilotStudioIcon = '${{ needs.nodejs-copilot-studio.result }}' === 'success' ? '✅' : '❌';
const dotnetSkIcon = '${{ needs.dotnet-sk.result }}' === 'success' ? '✅' : '❌';
const dotnetAfIcon = '${{ needs.dotnet-af.result }}' === 'success' ? '✅' : '❌';

const allPassed = '${{ needs.python-openai.result }}' === 'success' &&
'${{ needs.python-af.result }}' === 'success' &&
'${{ needs.python-google-adk.result }}' === 'success' &&
'${{ needs.nodejs-openai.result }}' === 'success' &&
'${{ needs.nodejs-langchain.result }}' === 'success' &&
'${{ needs.nodejs-copilot-studio.result }}' === 'success' &&
'${{ needs.dotnet-sk.result }}' === 'success' &&
'${{ needs.dotnet-af.result }}' === 'success';

Expand All @@ -150,8 +186,11 @@ jobs:
'| Sample | Status | Result |',
'|--------|--------|--------|',
`| Python OpenAI | ${pythonOpenaiIcon} | ${{ needs.python-openai.result }} |`,
`| Python Agent Framework | ${pythonAfIcon} | ${{ needs.python-af.result }} |`,
`| Python Google ADK | ${pythonGoogleAdkIcon} | ${{ needs.python-google-adk.result }} |`,
`| Node.js OpenAI | ${nodejsOpenaiIcon} | ${{ needs.nodejs-openai.result }} |`,
`| Node.js LangChain | ${nodejsLangchainIcon} | ${{ needs.nodejs-langchain.result }} |`,
`| Node.js Copilot Studio | ${nodejsCopilotStudioIcon} | ${{ needs.nodejs-copilot-studio.result }} |`,
`| .NET Semantic Kernel | ${dotnetSkIcon} | ${{ needs.dotnet-sk.result }} |`,
`| .NET Agent Framework | ${dotnetAfIcon} | ${{ needs.dotnet-af.result }} |`,
'',
Expand Down
Loading
Loading