Integration Tests - azure-deploy #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: '' | |
| 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: | |
| DEBUG: 1 | |
| GH_HEAD_SHA: ${{ github.sha }} | |
| 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 | |
| - name: Show master report | |
| id: show-master-report | |
| run: | | |
| MASTER_REPORT=$(find reports -name "*-MASTER-REPORT.md" -type f | head -n 1) | |
| if [ -n "$MASTER_REPORT" ]; then | |
| echo "Found master report: $MASTER_REPORT" | |
| cat "$MASTER_REPORT" >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "No master report found" | |
| fi | |
| - name: Export report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: azure-deploy-test-reports | |
| path: tests/reports/ | |
| retention-days: 30 | |