Skip to content

Integration Tests - azure-deploy #22

Integration Tests - azure-deploy

Integration Tests - azure-deploy #22

# Test azure-deploy deployment tests
#
# Runs the deployment test groups for azure-deploy skill.
# Triggered manually.
name: Integration Tests - azure-deploy
permissions:
id-token: write
contents: read
on:
workflow_dispatch:
inputs:
group-name:
description: 'Deploy test group name to run (e.g. static-web-apps-deploy). If empty, all groups will be run.'
required: false
type: string
default: ''
debug:
description: 'Whether to set DEBUG=1 for jest tests'
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Run azure-deploy deployment tests
environment: cideploytest
runs-on: ubuntu-latest
env:
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
defaults:
run:
working-directory: tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install azd
uses: Azure/setup-azd@v2
- name: Log in with Azure (Federated Credentials)
run: |
azd auth login `
--client-id "$Env:AZURE_CLIENT_ID" `
--federated-credential-provider "github" `
--tenant-id "$Env:AZURE_TENANT_ID"
shell: pwsh
- name: Azure login
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: tests/package-lock.json
- name: Install dependencies
run: npm ci
# COPILOT_CLI_TOKEN must be a fine-grained access token with the Account level Copilot Request permission
# saved to the secrets of the microsoft/GitHub-Copilot-for-Azure repo.
# As a known issue, when the permission of the token doesn't grant sufficient access,
# the agent will hang instead of giving an error.
# If you see the agent hang indefinitely, try refreshing the access token.
# See https://github.com/github/copilot-sdk/issues/343 for more details.
- name: Setup Copilot CLI
id: setup-copilot-cli
uses: mvkaran/setup-copilot-cli@v1
with:
token: ${{ secrets.COPILOT_CLI_TOKEN }}
- name: Integration tests
id: integration-tests
env:
GH_HEAD_SHA: ${{ github.sha }}
DEBUG: ${{ inputs.debug && '1' || '' }}
run: |
if [ -n "${{ inputs.group-name }}" ]; then
TEST_ARGS="--testNamePattern=${{ inputs.group-name }}"
fi
npm run test:integration -- --testPathPattern="azure-deploy" $TEST_ARGS
continue-on-error: true
- name: Generate report
id: generate-report
run: npm run report -- --skill azure-deploy
- name: Show skill report
id: show-skill-report
run: |
SKILL_REPORT=$(find reports -name "*-SKILL-REPORT.md" -type f | head -n 1)
if [ -n "$SKILL_REPORT" ]; then
echo "Found skill report: $SKILL_REPORT"
cat "$SKILL_REPORT" >> "$GITHUB_STEP_SUMMARY"
else
echo "No skill report found"
fi
- name: Export report
uses: actions/upload-artifact@v4
with:
name: azure-deploy-test-reports
path: tests/reports/
retention-days: 30