Skip to content

Add GitHub Actions CI workflow with Bazel#8

Merged
timduly4 merged 1 commit intomainfrom
feature/github_workflow
Dec 8, 2025
Merged

Add GitHub Actions CI workflow with Bazel#8
timduly4 merged 1 commit intomainfrom
feature/github_workflow

Conversation

@timduly4
Copy link
Owner

@timduly4 timduly4 commented Dec 8, 2025

Add GitHub Actions CI Workflow with Bazel and Test Coverage

Summary

This PR introduces a comprehensive CI/CD pipeline using GitHub Actions to automate builds and testing for the MCP server project. The workflow leverages Bazel's hermetic build system and includes test coverage reporting.

Changes

  • Added .github/workflows/ci.yml: Complete CI workflow configuration

Features

✅ Automated Builds

  • Triggers on push to main, pull requests, and manual workflow dispatch
  • Builds all Bazel targets (//...)
  • Generates production-ready server binary
  • Uploads build artifacts (retained for 7 days)

🧪 Test Automation

  • Runs complete test suite with error output
  • Generates LCOV coverage reports
  • Instruments only application code (excludes vendor dependencies)
  • Displays coverage summary in workflow runs

📊 Coverage Reporting

  • Codecov Integration: Automatic upload to Codecov for trend analysis
  • GitHub Summary: Coverage statistics visible in Actions tab
  • Artifact Upload: Raw coverage data available for download
  • Badge Support: Ready for README coverage badge integration

⚡ Performance Optimizations

  • Multi-layer caching strategy:
    • Bazel build cache (~/.cache/bazel)
    • Bazelisk cache for version management
    • Disk cache for build outputs
    • Repository cache for external dependencies
  • Smart cache keys based on build configuration files
  • Significantly faster subsequent builds

Testing

The workflow has been designed to:

  1. Build the entire project without errors
  2. Execute all unit tests
  3. Generate coverage for internal/ and cmd/ packages
  4. Upload results to Codecov (optional, requires CODECOV_TOKEN secret)

Setup Requirements

Optional: Codecov Integration

To enable full coverage reporting:

  1. Sign up at [codecov.io](https://codecov.io) with your GitHub account

  2. Add the mcp-server repository to Codecov

  3. Copy the upload token from Codecov settings

  4. Add as GitHub repository secret:

    • Navigate to: Settings → Secrets and variables → Actions
    • Create secret: CODECOV_TOKEN
    • Paste your token
  5. (Optional) Add coverage badge to README:

    [![codecov](https://codecov.io/gh/timduly4/mcp-server/branch/main/graph/badge.svg)](https://codecov.io/gh/timduly4/mcp-server)

Note: The workflow functions without Codecov - coverage summaries and artifacts are still generated.

Workflow Triggers

  • Push to main: Validates production code
  • Pull Requests: Validates changes before merge
  • Manual Dispatch: On-demand builds via Actions tab

Artifacts Generated

  1. Server Binary (mcp-server-{sha})

    • Compiled production binary
    • 7-day retention
  2. Coverage Report (coverage-report-{sha})

    • LCOV format coverage data
    • 7-day retention
    • Usable for local analysis

Future Enhancements

Potential improvements for follow-up PRs:

  • Multi-platform builds (Linux, macOS, Windows)
  • Release automation with tagged versions
  • Docker image builds and publishing
  • Integration test suite
  • Benchmark tracking

Testing This PR

After merging, verify the workflow by:

  1. Checking the Actions tab for successful run
  2. Reviewing the coverage summary in the workflow log
  3. Downloading artifacts to verify binary and coverage data
  4. (If Codecov enabled) Viewing coverage report at codecov.io

Closes: #[issue-number] (if applicable)

Related: Addresses need for automated CI/CD as outlined in project requirements

@timduly4 timduly4 merged commit 0844f96 into main Dec 8, 2025
1 check passed
@timduly4 timduly4 deleted the feature/github_workflow branch December 8, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant