CI/CD Pipeline For Jocaagura Ecosystem On GitHub

by Admin 49 views
Standardized CI/CD Pipeline Implementation for GitHub

Hey guys! Today, we're diving deep into how to set up a standardized CI/CD (Continuous Integration/Continuous Deployment) pipeline for GitHub repositories within the Jocaagura ecosystem. This setup ensures code quality, consistent versioning, and automated validations across all your projects. Let's get started!

Standardized CI/CD pipeline implementation for GitHub repositories in the Jocaagura ecosystem

Description

The primary goal here is to implement a complete CI/CD system in jocaagura ecosystem repositories. This involves ensuring:

  • Strict validations on every developer push.
  • Automatic versioning (major, minor, patch) on pull requests (PRs) targeting develop.
  • Versioning validations on PRs targeting master.
  • Coherent and protected branch structure.
  • A complete workflow from issue creation to dev branches, rev branches, PRs, and releases.

This system standardizes code quality, versioning traceability, validation automation, and protection of critical branches.

Given

  1. The jocaagura ecosystem needs a clear, reproducible workflow for all repositories.
  2. A standard set of branches has been defined: dev/**, rev/**, develop, master.
  3. Three fundamental workflows need standardization:
    • validate_commits_and_lints.yaml
    • validate_pr.yaml
    • validate_pr_master.yaml
  4. Protection rules must ensure code integrity, consistent versioning, and signed commits.
  5. Developers require an understandable and consistent workflow across all jocaagura repositories.

When

Workflows and protection rules are implemented according to the described standard, ensuring that:

  • Each push to dev/** branches validates minimum quality.
  • rev/** branches only receive "curated" code.
  • PRs to develop execute complete validations and automatically bump the version.
  • PRs to master verify strict version increments.
  • Main branches are protected.

Then

  1. dev/** branches are automatically validated on each push.
  2. rev/** branches act as an integration point per issue without CI.
  3. PRs to develop automatically update the version and validate complete quality.
  4. PRs to master ensure correct increments and consistent releases.
  5. The repository has a reproducible, clear CI/CD system aligned with the jocaagura standard.
  6. Developers have a clear and guided experience for contributing.

Tasks

Let's break down the tasks needed to achieve this awesome CI/CD pipeline.

1. Configuration of Protection Rules

  • [ ] Create a ruleset Protect to develop with:
    • Direct push blocking
    • Signed commits
    • 1+ review
    • Checks in green
    • Code scanning
  • [ ] Create a ruleset Protect to master with:
    • Rules from develop + strict version validation
  • [ ] Create a rule review push for dev/** (future expansion)
  • [ ] Validate expected behavior through integration tests.

2. Implement workflow validate_commits_and_lints.yaml

  • [ ] Execute on push to branches except: develop, master, rev/**.
  • [ ] Validate signed commits.
  • [ ] Reject dependency_overrides.
  • [ ] Execute static analysis without warnings.
  • [ ] Validate flutter pub get in all packages.

3. Implement workflow validate_pr.yaml (PR → develop)

  • [ ] Validate format (dart format).
  • [ ] Validate analyzer (flutter analyze).
  • [ ] Execute tests (flutter test).
  • [ ] Require CHANGELOG update.
  • [ ] Obtain label (major/minor/patch).
  • [ ] Perform automatic version bump.
  • [ ] Sign the generated commit.
  • [ ] Perform automatic push to the PR branch.

4. Implement workflow validate_pr_master.yaml (PR → master)

  • [ ] Validate format.
  • [ ] Validate analyzer.
  • [ ] Execute tests.
  • [ ] Verify that the version is strictly greater than the existing one.

5. Branch Structure

  • [ ] Document usage of:
    • master (releases)
    • develop (functional integration)
    • rev/<issue> (integration per issue)
    • dev/<issue>-<devname> (individual work)
  • [ ] Integrate this structure into the repos as standard.

6. Documentation of the Complete Flow

  • [ ] Describe steps 1–8 of the CI/CD flow.
  • [ ] Include official diagram of the flow.
  • [ ] Include checklist for implementers.
  • [ ] Create a guide for new repositories.

Validations

To ensure everything is working as expected, we need to validate the following:

  1. A push to dev/<issue>-<dev> correctly activates validate_commits_and_lints and fails if:
    • There are dependency overrides.
    • There is no signature.
    • There are warnings in the analyzer.
  2. A PR to develop:
    • Bumps the version correctly.
    • Requires a CHANGELOG.
    • Validates tests/analyzer/format.
  3. A PR to master blocks if the version is not higher.
  4. All protection rules prevent direct push.
  5. The complete flow (dev → rev → develop → master) works without manual intervention.

Documentation

Proper documentation is key for maintainability and onboarding new developers. We need to:

  1. Update the repository's README with:
    • Rulesets
    • Branch structure
    • Usage of labels for versioning
    • Workflows and their purpose
  2. Create a file .github/GUIDE_CI_CD.md with a detailed guide.
  3. Include examples of commands for devs.
  4. Attach a diagram of the CI/CD flow.

Additional Notes

  • This system is compatible with any Flutter or Dart repo in the ecosystem.
  • Automating the version bump prevents conflicts and ensures semantic versioning.
  • The rev/** branches allow integrating multiple contributions without commit noise.
  • This issue serves as a template for standardizing new repositories.

References

  • Workflow oficial jocaagura
  • Documentación de GitHub Actions
  • Guía de branching del proyecto
  • SemVer.org

By implementing this standardized CI/CD pipeline, we ensure that every project within the jocaagura ecosystem benefits from consistent, high-quality code, streamlined workflows, and reliable releases. This not only makes our lives easier but also boosts developer productivity and project success. Cheers to better code and smoother deployments!