Skip to content

Removed the aggregated GC line and legend from the GC SVG in local ar… #39

Removed the aggregated GC line and legend from the GC SVG in local ar…

Removed the aggregated GC line and legend from the GC SVG in local ar… #39

Workflow file for this run

name: Test Action Build
on:
pull_request:
branches: [ main, develop ]
paths:
- 'src/**'
- 'build.sh'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- 'action.yaml'
- '.github/workflows/test-action.yml'
push:
branches: [ main, develop ]
paths:
- 'src/**'
- 'build.sh'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- 'action.yaml'
- '.github/workflows/test-action.yml'
workflow_dispatch:
workflow_call:
jobs:
build:
name: Build Action
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: |
echo "📦 Installing npm dependencies..."
npm ci
- name: Build TypeScript action
run: |
echo "🔨 Building TypeScript action..."
npm run build
- name: Verify build outputs
run: |
echo "✅ Verifying build outputs..."
if [ ! -f "dist/index_with_backend.js" ]; then
echo "❌ ERROR: dist/index_with_backend.js not found!"
exit 1
fi
echo "✅ dist/index_with_backend.js exists"
if [ ! -f "dist/cleanup.js" ]; then
echo "❌ ERROR: dist/cleanup.js not found!"
exit 1
fi
echo "✅ dist/cleanup.js exists"
if [ ! -f "monitor_with_backend.sh" ]; then
echo "❌ ERROR: monitor_with_backend.sh not found!"
exit 1
fi
echo "✅ monitor_with_backend.sh exists"
# Check if we can make it executable (the action will do this at runtime)
chmod +x monitor_with_backend.sh
if [ -x "monitor_with_backend.sh" ]; then
echo "✅ monitor_with_backend.sh can be made executable"
else
echo "❌ ERROR: Cannot make monitor_with_backend.sh executable!"
exit 1
fi
echo "✅ All required files present and valid"
- name: Check action metadata
run: |
echo "📋 Validating action.yaml..."
if [ ! -f "action.yaml" ]; then
echo "❌ ERROR: action.yaml not found!"
exit 1
fi
echo "✅ action.yaml found"
- name: TypeScript type check
run: |
echo "🔍 Running TypeScript type check..."
npx tsc --noEmit
- name: Test collect_gc functionality
run: |
echo "🧪 Testing collect_gc functionality"
echo "===================================="
echo ""
# Test 1: Verify script recognizes COLLECT_GC
echo "Test 1: Verifying script recognizes COLLECT_GC variable"
if grep -q "COLLECT_GC" monitor_with_backend.sh; then
echo "✅ PASS: Script references COLLECT_GC variable"
else
echo "❌ FAIL: Script does not reference COLLECT_GC!"
exit 1
fi
echo ""
# Test 2: Verify script uses COLLECT_GC to set log header
echo "Test 2: Verifying log header includes GC column when COLLECT_GC=true"
if grep -A 5 'if \[ "\$COLLECT_GC" = "true" \]' monitor_with_backend.sh | grep -q "GC_Time_S"; then
echo "✅ PASS: Script includes GC_Time_S in header when COLLECT_GC=true"
else
echo "⚠️ WARNING: Could not verify GC header logic in script"
fi
echo ""
# Test 3: Verify script excludes GC column when COLLECT_GC=false
echo "Test 3: Verifying log header excludes GC column when COLLECT_GC=false"
if grep -B 5 -A 5 'if \[ "\$COLLECT_GC" = "true" \]' monitor_with_backend.sh | grep -q "Elapsed_Time.*PID.*Name.*Heap"; then
echo "✅ PASS: Script has alternative header without GC when COLLECT_GC=false"
else
echo "⚠️ WARNING: Could not verify non-GC header logic"
fi
echo ""
# Test 4: Verify action.yaml has collect_gc input
echo "Test 4: Verifying action.yaml includes collect_gc input"
if grep -q "collect_gc:" action.yaml; then
echo "✅ PASS: action.yaml includes collect_gc input"
else
echo "❌ FAIL: action.yaml does not include collect_gc input!"
exit 1
fi
echo ""
# Test 5: Verify TypeScript code reads collect_gc
echo "Test 5: Verifying TypeScript code reads collect_gc input"
if grep -q "collect_gc" src/index_with_backend.ts; then
echo "✅ PASS: TypeScript code references collect_gc"
# Check if it's exported as COLLECT_GC
if grep -q "COLLECT_GC" src/index_with_backend.ts; then
echo "✅ PASS: TypeScript code exports COLLECT_GC environment variable"
else
echo "❌ FAIL: TypeScript code does not export COLLECT_GC!"
exit 1
fi
else
echo "❌ FAIL: TypeScript code does not reference collect_gc!"
exit 1
fi
echo ""
echo "===================================="
echo "✅ All collect_gc tests passed!"
echo "===================================="
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: action-dist
path: |
dist/
monitor_with_backend.sh
retention-days: 7
- name: Build summary
run: |
echo "✅ Action build completed successfully!"
echo "📦 Built files:"
ls -lh dist/