Skip to content

Reference AVM Flex Consumption patterns for Azure Functions Terraform generation #652

Reference AVM Flex Consumption patterns for Azure Functions Terraform generation

Reference AVM Flex Consumption patterns for Azure Functions Terraform generation #652

# Test All Skills - non-integration
#
# Runs the non-integration test suite for all skills.
# Triggered manually or on significant changes.
name: Test All Skills - non-integration
permissions:
contents: read
on:
workflow_dispatch:
inputs:
skill-name:
description: 'Skill to test (leave empty for all skills)'
required: false
type: string
default: ''
coverage:
description: 'Generate coverage report'
required: false
type: boolean
default: true
push:
branches:
- main
paths:
- 'tests/**'
- 'plugin/skills/**'
- '.github/workflows/test-*.yml'
pull_request:
paths:
- 'tests/**'
- 'plugin/skills/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Run All Skill Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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
- name: Run tests
run: |
TEST_ARGS=""
if [ -n "${{ inputs.skill-name }}" ]; then
TEST_ARGS="--testPathPattern=${{ inputs.skill-name }}"
fi
if [ "${{ inputs.coverage }}" = "true" ] || [ "${{ github.event_name }}" = "push" ]; then
npm run test:ci -- --coverage $TEST_ARGS
else
npm run test:ci -- $TEST_ARGS
fi
env:
CI: true
continue-on-error: true
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-all
path: tests/reports/junit.xml
retention-days: 30
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-all
path: tests/coverage/
retention-days: 30
- name: Test Report Summary
if: always()
run: |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f reports/junit.xml ]; then
# Parse junit.xml for summary
TESTS=$(grep -o 'tests="[0-9]*"' reports/junit.xml | head -1 | grep -o '[0-9]*')
FAILURES=$(grep -o 'failures="[0-9]*"' reports/junit.xml | head -1 | grep -o '[0-9]*')
ERRORS=$(grep -o 'errors="[0-9]*"' reports/junit.xml | head -1 | grep -o '[0-9]*')
echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Tests | $TESTS |" >> $GITHUB_STEP_SUMMARY
echo "| Failures | $FAILURES |" >> $GITHUB_STEP_SUMMARY
echo "| Errors | $ERRORS |" >> $GITHUB_STEP_SUMMARY
fi
- name: Coverage Summary
if: always() && (inputs.coverage == true || github.event_name == 'push')
run: |
echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f coverage/coverage-summary.json ]; then
node -e "
const c = require('./coverage/coverage-summary.json').total;
console.log('| Metric | Coverage |');
console.log('|--------|----------|');
console.log('| Statements | ' + c.statements.pct + '% |');
console.log('| Branches | ' + c.branches.pct + '% |');
console.log('| Functions | ' + c.functions.pct + '% |');
console.log('| Lines | ' + c.lines.pct + '% |');
" >> $GITHUB_STEP_SUMMARY
fi
update-readme:
name: Update Coverage Grid
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
defaults:
run:
working-directory: tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
name: coverage-all
path: tests/coverage/
- name: Generate coverage grid
run: npm run coverage:grid