fix(ts): add express dependency to resolve TypeScript errors #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GitHub Actions CI/CD Pipeline for CodeSight MCP Server | |
| # Generated: 2025-01-27 | |
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [main, develop] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| NODE_VERSION: '20' | |
| RUST_VERSION: '1.75' | |
| jobs: | |
| # Rust Core Tests | |
| rust-tests: | |
| name: Rust Core Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: [stable, beta] | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| rust-core/target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('rust-core/**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install system dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libssl-dev build-essential | |
| - name: Check Rust formatting | |
| working-directory: rust-core | |
| run: cargo fmt --all -- --check | |
| - name: Run Clippy | |
| working-directory: rust-core | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Run Rust tests | |
| working-directory: rust-core | |
| run: cargo test --all-features --verbose | |
| - name: Run Rust benchmarks | |
| working-directory: rust-core | |
| run: cargo bench --no-run | |
| - name: Build Rust release | |
| working-directory: rust-core | |
| run: cargo build --release --all-features | |
| # TypeScript Tests | |
| typescript-tests: | |
| name: TypeScript Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18, 20, 21] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| cache-dependency-path: typescript-mcp/package-lock.json | |
| - name: Install dependencies | |
| working-directory: typescript-mcp | |
| run: npm ci | |
| - name: Type checking | |
| working-directory: typescript-mcp | |
| run: npm run type-check | |
| - name: Linting | |
| working-directory: typescript-mcp | |
| run: npm run lint | |
| - name: Format checking | |
| working-directory: typescript-mcp | |
| run: npm run format:check | |
| - name: Run tests | |
| working-directory: typescript-mcp | |
| run: npm run test | |
| - name: Upload coverage to Codecov | |
| if: matrix.node-version == 20 | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: typescript-mcp/coverage/lcov.info | |
| flags: typescript | |
| name: typescript-coverage | |
| - name: Build TypeScript | |
| working-directory: typescript-mcp | |
| run: npm run build | |
| # NAPI-RS Hybrid Build (for CI integration) | |
| napi-hybrid-build: | |
| name: NAPI-RS Hybrid Build | |
| runs-on: ubuntu-latest | |
| needs: [rust-tests, typescript-tests] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| components: rustfmt, clippy | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: typescript-mcp/package-lock.json | |
| - name: Install NAPI-RS CLI | |
| run: npm install -g @napi-rs/cli | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| rust-core/target/ | |
| typescript-mcp/node_modules/ | |
| key: ${{ runner.os }}-napi-hybrid-${{ hashFiles('rust-core/**/Cargo.lock', 'typescript-mcp/package-lock.json') }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libssl-dev build-essential | |
| - name: Build NAPI-RS module | |
| working-directory: rust-core | |
| run: | | |
| cargo build --release --package code-intelligence-ffi | |
| - name: Package NAPI-RS module | |
| working-directory: rust-core | |
| run: | | |
| napi build --platform --target x86_64-unknown-linux-gnu | |
| - name: Install TypeScript dependencies | |
| working-directory: typescript-mcp | |
| run: npm ci | |
| - name: Copy NAPI module to TypeScript project | |
| run: | | |
| cp rust-core/target/x86_64-unknown-linux-gnu/release/libcode_intelligence_ffi.so typescript-mcp/codesight-native.node | |
| - name: Build TypeScript with NAPI | |
| working-directory: typescript-mcp | |
| run: | | |
| npm run build | |
| - name: Test NAPI integration | |
| working-directory: typescript-mcp | |
| run: | | |
| node -e " | |
| try { | |
| const native = require('./codesight-native.node'); | |
| console.log('NAPI-RS integration test passed'); | |
| } catch (error) { | |
| console.error('NAPI-RS integration test failed:', error); | |
| process.exit(1); | |
| } | |
| " | |
| # Integration Tests | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [rust-tests, typescript-tests, napi-hybrid-build] | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: code_intelligence_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| redis: | |
| image: redis:7 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: typescript-mcp/package-lock.json | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libssl-dev build-essential | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| rust-core/target/ | |
| typescript-mcp/node_modules/ | |
| key: ${{ runner.os }}-integration-${{ hashFiles('rust-core/**/Cargo.lock', 'typescript-mcp/package-lock.json') }} | |
| - name: Build Rust core | |
| working-directory: rust-core | |
| run: cargo build --release | |
| - name: Install TypeScript dependencies | |
| working-directory: typescript-mcp | |
| run: npm ci | |
| - name: Build TypeScript | |
| working-directory: typescript-mcp | |
| run: npm run build | |
| - name: Run integration tests | |
| working-directory: typescript-mcp | |
| run: npm run test:contract | |
| env: | |
| POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/code_intelligence_test | |
| REDIS_URL: redis://localhost:6379 | |
| TEST_TIMEOUT: 60000 | |
| # Security Audit | |
| security-audit: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Rust security audit | |
| working-directory: rust-core | |
| run: cargo audit | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install dependencies | |
| working-directory: typescript-mcp | |
| run: npm ci | |
| - name: Node.js security audit | |
| working-directory: typescript-mcp | |
| run: npm audit --audit-level=moderate | |
| # Docker Build | |
| docker-build: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| needs: [rust-tests, typescript-tests] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: msenol/codesight | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=sha | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Test Docker image | |
| run: | | |
| docker run --rm msenol/codesight:${{ github.sha }} --version | |
| # Release | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: | |
| [ | |
| rust-tests, | |
| typescript-tests, | |
| napi-hybrid-build, | |
| integration-tests, | |
| security-audit, | |
| docker-build, | |
| ] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| targets: x86_64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-apple-darwin,aarch64-apple-darwin | |
| - name: Install cross-compilation tools | |
| run: | | |
| cargo install cross | |
| - name: Build release binaries | |
| working-directory: rust-core | |
| run: | | |
| cross build --release --target x86_64-unknown-linux-gnu | |
| cross build --release --target x86_64-pc-windows-gnu | |
| cross build --release --target x86_64-apple-darwin | |
| cross build --release --target aarch64-apple-darwin | |
| - name: Package binaries | |
| run: | | |
| mkdir -p dist | |
| tar -czf dist/codesight-linux-x64.tar.gz -C rust-core/target/x86_64-unknown-linux-gnu/release . | |
| tar -czf dist/codesight-windows-x64.tar.gz -C rust-core/target/x86_64-pc-windows-gnu/release . | |
| tar -czf dist/codesight-macos-x64.tar.gz -C rust-core/target/x86_64-apple-darwin/release . | |
| tar -czf dist/codesight-macos-arm64.tar.gz -C rust-core/target/aarch64-apple-darwin/release . | |
| - name: Generate changelog | |
| run: | | |
| git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD > CHANGELOG.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: dist/* | |
| body_path: CHANGELOG.md | |
| draft: false | |
| prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to npm | |
| working-directory: typescript-mcp | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # Deployment | |
| deploy: | |
| name: Deploy to Staging | |
| runs-on: ubuntu-latest | |
| needs: [integration-tests] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| environment: staging | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Deploy to staging | |
| run: | | |
| echo "Deploying to staging environment..." | |
| # Add actual deployment commands here | |
| - name: Run smoke tests | |
| run: | | |
| echo "Running smoke tests..." | |
| # Add smoke test commands here | |
| - name: Notify deployment | |
| if: always() | |
| run: | | |
| echo "Deployment completed with status: ${{ job.status }}" | |
| # Add notification logic here (Slack, email, etc.) |