Skip to content

chore(backend): clarify kb_librarian is internal-only, delete unreach… #731

chore(backend): clarify kb_librarian is internal-only, delete unreach…

chore(backend): clarify kb_librarian is internal-only, delete unreach… #731

Workflow file for this run

# Frontend Testing Suite workflow
# Uses self-hosted runner to avoid GitHub Actions quota limits
name: Frontend Testing Suite
on:
push:
branches: [main, develop, 'Dev_*']
paths:
- 'autobot-frontend/**'
- '.github/workflows/frontend-test.yml'
pull_request:
branches: [main, develop]
paths:
- 'autobot-frontend/**'
- '.github/workflows/frontend-test.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '20'
permissions:
contents: read
jobs:
# Job 1: Unit and Integration Tests
unit-tests:
name: Unit & Integration Tests
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies
working-directory: autobot-frontend
run: npm ci
- name: Run type checking
working-directory: autobot-frontend
run: npm run type-check
- name: Run linting
working-directory: autobot-frontend
run: npm run lint
- name: Run unit tests
working-directory: autobot-frontend
run: npm run test:unit
- name: Run integration tests
working-directory: autobot-frontend
run: npm run test:integration
- name: Generate coverage report
working-directory: autobot-frontend
run: npm run test:coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v6
with:
files: ./autobot-frontend/coverage/lcov.info
directory: ./autobot-frontend/coverage
flags: frontend
name: autobot-frontend-coverage
fail_ci_if_error: false
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: test-results-unit
path: |
autobot-frontend/test-results/
autobot-frontend/coverage/
retention-days: 30
- name: Cleanup node_modules
if: always()
run: |
rm -rf autobot-frontend/node_modules || true
# Job 2: Security Scanning
security-scan:
name: Security Scan
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies
working-directory: autobot-frontend
run: npm ci
- name: Run npm audit
working-directory: autobot-frontend
run: |
npm audit --audit-level=high || true
npm audit --json > audit-results.json || true
- name: Run dependency vulnerability scan
working-directory: autobot-frontend
run: |
npx auditjs ossi || true
- name: Upload security scan results
uses: actions/upload-artifact@v7
if: always()
with:
name: security-scan-results
path: autobot-frontend/audit-results.json
retention-days: 30
- name: Cleanup
if: always()
run: |
rm -rf autobot-frontend/node_modules || true
# Job 3: Build Test
build-test:
name: Build Test
runs-on: self-hosted
needs: unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies
working-directory: autobot-frontend
run: npm ci
- name: Build application
working-directory: autobot-frontend
run: npm run build
- name: Analyze bundle size
working-directory: autobot-frontend
run: |
du -sh dist/
find dist/ -name "*.js" -exec du -h {} \; | sort -hr
- name: Cleanup
if: always()
run: |
rm -rf autobot-frontend/node_modules autobot-frontend/dist || true
# Job 4: Test Summary and Reporting
test-summary:
name: Test Summary
runs-on: self-hosted
needs: [unit-tests, security-scan, build-test]
if: always()
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: test-artifacts
- name: Generate test summary
run: |
echo "# 🧪 Frontend Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Test Jobs Status:" >> $GITHUB_STEP_SUMMARY
echo "- Unit Tests: ${{ needs.unit-tests.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Security Scan: ${{ needs.security-scan.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Build Test: ${{ needs.build-test.result }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -d "test-artifacts/test-results-unit/coverage" ]; then
echo "## Coverage Report Available" >> $GITHUB_STEP_SUMMARY
echo "Coverage reports have been uploaded to Codecov." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
fi
if [ -d "test-artifacts" ]; then
echo "## Available Artifacts:" >> $GITHUB_STEP_SUMMARY
find test-artifacts -type d -name "*results*" | while read dir; do
echo "- $(basename "$dir")" >> $GITHUB_STEP_SUMMARY
done
echo "" >> $GITHUB_STEP_SUMMARY
fi
echo "## Quick Links:" >> $GITHUB_STEP_SUMMARY
echo "- [View Coverage Report](https://app.codecov.io/gh/${{ github.repository }})" >> $GITHUB_STEP_SUMMARY
echo "- [Download Test Artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY