|
|
|
|
|
|
| name: Beta CI/CD Pipeline
|
|
|
| on:
|
| push:
|
| branches: [ main, develop, release/* ]
|
| pull_request:
|
| branches: [ main, develop ]
|
| schedule:
|
|
|
| - cron: '0 2 * * *'
|
|
|
|
|
| env:
|
| NODE_VERSION_MATRIX: '[22]'
|
| ARTIFACT_RETENTION_DAYS: 30
|
| PACKAGE_VERSION: '2.0.0-beta.1'
|
| BETA_TESTING: true
|
|
|
| jobs:
|
|
|
|
|
|
|
|
|
| code-quality:
|
| name: Code Quality & Security
|
| runs-on: ubuntu-latest
|
|
|
| steps:
|
| - name: Checkout Repository
|
| uses: actions/checkout@v4
|
| with:
|
| fetch-depth: 0
|
|
|
| - name: Setup Node.js
|
| uses: actions/setup-node@v4
|
| with:
|
| node-version: '22'
|
|
|
| - name: Verify Package Structure
|
| run: |
|
| echo "Checking package.json..."
|
| node -e "console.log('Package:', require('./package.json').name, require('./package.json').version)"
|
|
|
| - name: Test CLI Tool
|
| run: |
|
| echo "Testing CLI functionality..."
|
| node fix-comments.js --version
|
| node fix-comments.js --help
|
|
|
| - name: License Check
|
| run: |
|
| if [ -f LICENSE ]; then
|
| echo " LICENSE file exists"
|
| head -5 LICENSE
|
| else
|
| echo " LICENSE file missing"
|
| exit 1
|
| fi
|
|
|
|
|
|
|
|
|
|
|
| test:
|
| name: Test Suite (Node ${{ matrix.node-version }})
|
| runs-on: ${{ matrix.os }}
|
| needs: code-quality
|
|
|
| strategy:
|
| fail-fast: false
|
| matrix:
|
| os: [ubuntu-latest, windows-latest, macos-latest]
|
| node-version: [22]
|
| exclude:
|
|
|
| - os: macos-latest
|
| node-version: 18
|
|
|
| steps:
|
| - name: Checkout Repository
|
| uses: actions/checkout@v4
|
|
|
| - name: Setup Node.js ${{ matrix.node-version }}
|
| uses: actions/setup-node@v4
|
| with:
|
| node-version: ${{ matrix.node-version }}
|
|
|
|
|
| - name: Test with Real Test Files
|
| run: |
|
| echo "Testing entire test directory with all JS/TS files..."
|
| node fix-comments.js test/ --dry-run --verbose
|
|
|
| echo "Testing specific complex files..."
|
| node fix-comments.js test/crazy-messy-code.js --dry-run
|
| node fix-comments.js test/brutal-ai-no-comments.js --dry-run --add-missing
|
|
|
| echo "Test completed - Check results above for comment processing"
|
|
|
| - name: Test Beta CLI Functionality
|
| run: |
|
|
|
| node fix-comments.js --help
|
| node fix-comments.js --version
|
| echo "Testing Beta features..."
|
| node fix-comments.js --dry-run . || echo "Dry run test completed"
|
| shell: bash
|
|
|
| - name: Test Beta Advanced Features
|
| run: |
|
|
|
| echo "Testing Smart Learning..."
|
| node fix-comments.js --smart-learning --dry-run . || echo "Smart Learning test completed"
|
| echo "Testing Enhanced Pattern Recognition..."
|
| node fix-comments.js --verbose --dry-run . || echo "Pattern Recognition test completed"
|
| shell: bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| integration-test:
|
| name: Integration Tests
|
| runs-on: ubuntu-latest
|
| needs: [code-quality, test]
|
|
|
| steps:
|
| - name: Checkout Repository
|
| uses: actions/checkout@v4
|
|
|
| - name: Setup Node.js
|
| uses: actions/setup-node@v4
|
| with:
|
| node-version: '22'
|
|
|
|
|
| - name: Test CLI Integration
|
| run: |
|
| echo "Testing CLI integration..."
|
| node fix-comments.js --help
|
| node fix-comments.js --version
|
| echo "CLI integration test completed"
|
|
|
| - name: Test with Real Test Files
|
| run: |
|
| echo "Testing with comprehensive test suite..."
|
|
|
|
|
| node fix-comments.js test/ --dry-run --verbose
|
|
|
|
|
| echo "Testing brutal AI engine..."
|
| node fix-comments.js test/brutal-ai-engine.js --dry-run --add-missing
|
|
|
| echo "Testing complex algorithms..."
|
| node fix-comments.js test/advanced-algorithms.js --dry-run --format
|
|
|
| - name: Test Complete
|
| run: |
|
| echo "All tests completed successfully!"
|
|
|
|
|
|
|
|
|
|
|
| performance:
|
| name: Performance Benchmarks
|
| runs-on: ubuntu-latest
|
| needs: [test]
|
| if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
|
| steps:
|
| - name: Checkout Repository
|
| uses: actions/checkout@v4
|
|
|
| - name: Setup Node.js
|
| uses: actions/setup-node@v4
|
| with:
|
| node-version: '22'
|
|
|
|
|
| - name: Run Performance Tests
|
| run: |
|
|
|
| mkdir -p perf-test
|
| for i in {1..100}; do
|
| cat > perf-test/large-file-$i.js << 'EOF'
|
| /**
|
| * Large file for performance testing
|
| */
|
| function performanceTest$i() {
|
| return "Performance test function";
|
| }
|
|
|
| /**
|
| * Another function for testing
|
| */
|
| async function asyncTest$i() {
|
| await new Promise(resolve => setTimeout(resolve, 1));
|
| }
|
| EOF
|
| done
|
|
|
|
|
| echo "Starting performance test..."
|
| time node fix-comments.js perf-test/ --dry-run
|
|
|
|
|
| rm -rf perf-test/
|
|
|
|
|
|
|
|
|
|
|
| release-check:
|
| name: Release Readiness Check
|
| runs-on: ubuntu-latest
|
| needs: [code-quality, test, integration-test]
|
| if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
|
|
|
| steps:
|
| - name: Checkout Repository
|
| uses: actions/checkout@v4
|
|
|
| - name: Setup Node.js
|
| uses: actions/setup-node@v4
|
| with:
|
| node-version: '22'
|
| registry-url: 'https://registry.npmjs.org'
|
|
|
|
|
| - name: Validate Package
|
| run: |
|
| echo "Validating package structure..."
|
| node -e "console.log('Package valid:', require('./package.json').name)"
|
| echo "Package validation completed"
|
|
|
| - name: Check Version Consistency
|
| run: |
|
| PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
| echo "Package version: $PACKAGE_VERSION"
|
|
|
| if [ -f README.md ]; then
|
| if grep -q "$PACKAGE_VERSION" README.md; then
|
| echo " Version found in README.md"
|
| else
|
| echo " Version not found in README.md"
|
| fi
|
| fi
|
|
|
| - name: Generate Release Notes
|
| if: startsWith(github.ref, 'refs/tags/v')
|
| run: |
|
| echo "## Release Notes for ${{ github.ref_name }}" > release-notes.md
|
| echo "" >> release-notes.md
|
| echo "### Changes in this release:" >> release-notes.md
|
| git log --oneline --since="1 week ago" >> release-notes.md
|
|
|
| - name: Upload Release Artifacts
|
| if: startsWith(github.ref, 'refs/tags/v')
|
| uses: actions/upload-artifact@v4
|
| with:
|
| name: release-artifacts-${{ github.ref_name }}
|
| path: |
|
| *.tgz
|
| release-notes.md
|
| retention-days: 90
|
|
|
|
|
|
|
|
|
|
|
| notify:
|
| name: Workflow Notification
|
| runs-on: ubuntu-latest
|
| needs: [code-quality, test, integration-test]
|
| if: always()
|
|
|
| steps:
|
| - name: Workflow Status Summary
|
| run: |
|
| echo "## CI/CD Pipeline Summary"
|
| echo "- Code Quality: ${{ needs.code-quality.result }}"
|
| echo "- Tests: ${{ needs.test.result }}"
|
| echo "- Integration: ${{ needs.integration-test.result }}"
|
|
|
| if [[ "${{ needs.code-quality.result }}" == "success" && "${{ needs.test.result }}" == "success" && "${{ needs.integration-test.result }}" == "success" ]]; then
|
| echo " All checks passed! Ready for deployment."
|
| echo "BUILD_STATUS=success" >> $GITHUB_ENV
|
| else
|
| echo " Some checks failed. Please review the logs."
|
| echo "BUILD_STATUS=failure" >> $GITHUB_ENV
|
| fi
|
|
|
| - name: Set Status Badge
|
| run: |
|
| if [ "$BUILD_STATUS" == "success" ]; then
|
| echo " Build successful - all systems green!"
|
| else
|
| echo " Build failed - attention required!"
|
| fi
|
|
|