Skip to content

feat: Implement Makefile-driven CI/CD architecture with automated publishing#3

Merged
levicook merged 4 commits intomainfrom
feat/makefile-driven-ci-cd
Jun 9, 2025
Merged

feat: Implement Makefile-driven CI/CD architecture with automated publishing#3
levicook merged 4 commits intomainfrom
feat/makefile-driven-ci-cd

Conversation

@levicook
Copy link
Copy Markdown
Owner

@levicook levicook commented Jun 9, 2025

🎯 Overview

This PR implements a comprehensive Makefile-driven CI/CD architecture that eliminates drift between local development and CI while providing fast feedback loops and automated publishing capabilities.

🏗️ Architecture

Philosophy: The Makefile is the single source of truth for all build operations. GitHub workflows are thin orchestration layers that delegate to Makefile targets.

Key Components

  • Makefile - Canonical build logic with multiple CI strategies
  • GitHub Actions CI - Parallel jobs for fast feedback and comprehensive validation
  • Automated Publishing - Version-tag triggered releases to crates.io
  • Documentation - Complete setup and troubleshooting guide

🎯 Makefile Targets

# Development workflow
make check      # Fast workspace validation
make test       # All tests including Solana programs
make fmt        # Format code
make ci-local   # Full local CI with all checks

# CI targets (what workflows call)
make ci-quick   # Fast feedback - publishable crate only
make ci-full    # Complete validation - all packages

🚀 What This Enables

  • Zero drift - Same commands work locally and in CI
  • Fast debugging - Reproduce any CI failure with make ci-full
  • Automated publishing - Tag v0.1.0 → automatic crates.io release
  • Quality gates - Comprehensive validation before publication
  • Professional polish - Enterprise-grade CI/CD practices

📋 Changes

New Files

  • Makefile - Build automation and CI targets
  • .github/workflows/ci.yml - Parallel CI jobs
  • .github/workflows/release.yml - Automated publishing
  • .github/WORKFLOW_SETUP.md - Complete documentation
  • CHANGELOG.md - Release notes template

Enhanced Files

  • crates/litesvm-testing/Cargo.toml - Complete crates.io metadata
  • Build scripts - Fixed clippy warnings in doctests
  • Cargo.toml - Organized workspace dependencies

🧪 Testing

All CI strategies tested locally:

  • make ci-quick - Core library validation (2-3 min)
  • make ci-full - Complete workspace including Solana programs (5-7 min)
  • make ci-local - Full development suite with clippy

🎯 Ready for Production

This PR makes the project publish-ready with:

  • Professional CI/CD pipeline
  • Automated quality gates
  • Comprehensive documentation
  • Zero-drift local/CI parity

Next step: Merge → Tag v0.1.0 → Automatic publication! 🎉

- Add comprehensive Makefile with ci-quick, ci-full, and ci-local targets
- Create GitHub Actions workflows that delegate to Makefile targets
- Implement automated publishing pipeline with version validation
- Add complete workflow documentation and troubleshooting guide
- Include CHANGELOG.md template for release management
- Fix clippy warnings in build.rs doctests
- Enhance Cargo.toml metadata for crates.io publication
- Ensure zero drift between local development and CI environments

The Makefile serves as the single source of truth for all build operations,
ensuring consistency between local development and CI while providing fast
feedback loops and easy debugging capabilities.
@levicook levicook self-assigned this Jun 9, 2025
levicook added 3 commits June 9, 2025 15:14
- Use stable channel instead of hardcoded version for future-proof builds
- Add explicit directory creation with proper permissions
- Include installation verification steps (solana --version, cargo --version)
- Enhance caching to include Solana directories for better performance
- Add cargo-build-sbf availability check for debugging
- Align installation method with official Solana documentation

This addresses the "Failed to install platform-tools" errors encountered
in GitHub Actions by using more robust installation practices.
- Add `agave-install init --no-modify-path` after Solana CLI installation
- Pre-download platform tools instead of relying on on-demand downloads
- Prevent "Failed to install platform-tools" errors during cargo build-sbf
- Add cargo-build-sbf version verification for debugging
- Apply fix to both CI and release workflows for consistency

This resolves the GitHub Actions failure where cargo build-sbf would try
to dynamically download LLVM toolchain and hit filesystem permission issues.
Based on solutions from solana-labs/solana#35719.
Replaces complex Solana toolchain installation with official Anchor
container (solanafoundation/anchor:v0.31.1) for reproducible builds.

Changes:
- GitHub workflows now trivially simple (just `make ci-docker-full`)
- All Docker complexity moved to Makefile targets
- Added Cargo registry caching for faster subsequent builds
- Docker-based release validation with `make release-validation`
- Updated documentation for new Docker-first approach

Benefits:
- Same environment locally and in CI (eliminates "works on my machine")
- Battle-tested official Solana Foundation container
- Zero Solana toolchain installation complexity
- Easy debugging: `make ci-docker-full` reproduces CI exactly
- Robust caching strategy for speed optimization

The architecture ensures reliable, maintainable, and debuggable CI/CD
using proven tools from the Solana ecosystem.
@levicook levicook marked this pull request as ready for review June 9, 2025 22:21
@levicook levicook merged commit 9a245e9 into main Jun 9, 2025
2 checks passed
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