Skip to content

Add Gulp build system with NBGV versioning #2

Add Gulp build system with NBGV versioning

Add Gulp build system with NBGV versioning #2

# 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tests/package-lock.json
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Run tests
env:
CI: true
SKILL_NAME: ${{ inputs.skill-name }}
COVERAGE: ${{ inputs.coverage }}
EVENT_NAME: ${{ github.event_name }}
run: |
TEST_ARGS=""
if [ -n "$SKILL_NAME" ]; then
TEST_ARGS="--testPathPatterns=$SKILL_NAME"
fi
if [ "$COVERAGE" = "true" ] || [ "$EVENT_NAME" = "push" ]; then
npm run test:ci -- --coverage $TEST_ARGS
else
npm run test:ci -- $TEST_ARGS
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: test-results-all
path: tests/reports/junit.xml
retention-days: 30
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '20'
- name: Download coverage artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: coverage-all
path: tests/coverage/
- name: Generate coverage grid
run: npm run coverage:grid