Skip to main content

4 (CI) Workflow

Overview

A Continuous Integration (CI) workflow defines the process of automatically building, testing, and validating every change made to a codebase before it is merged.
The goal of CI is to ensure that the application remains stable, functional, and deployable at all times by detecting issues early in the development cycle.

CI workflows are triggered whenever developers push changes to the version control system (VCS) (e.g., GitHub, GitLab, Bitbucket). Automated pipelines then verify the integrity of the application.


Objectives of a CI Workflow

  • Early Bug Detection: Find and fix issues as soon as they are introduced.
  • Automated Testing: Run unit, integration, and regression tests automatically.
  • Build Validation: Ensure that code compiles and passes quality checks.
  • Consistent Code Quality: Enforce coding standards and style guidelines.
  • Faster Feedback: Provide immediate feedback to developers.
  • Deployment Readiness: Ensure every commit is potentially releasable.

Key Stages of a CI Workflow

1. Code Commit & Trigger

  • Developers commit changes to the main repository.
  • Triggers can be:
    • Push events (code pushed to a branch).
    • Pull/Merge requests (opening or updating a PR).
    • Scheduled jobs (nightly builds).
  • CI server (e.g., Jenkins, GitHub Actions, GitLab CI) detects the change.

2. Source Retrieval

  • The pipeline checks out the latest code from the repository.
  • Dependencies and submodules are fetched.
  • Code versioning ensures reproducibility.

3. Build Stage

  • Application is compiled or packaged.
  • Dependency management tools (Maven, Gradle, npm, pip, etc.) resolve and install libraries.
  • Generated artifacts may be stored in an artifact repository (e.g., JFrog Artifactory, Nexus).

  • Code is scanned for style violations, code smells, and potential bugs.
  • Tools: SonarQube, ESLint, Pylint, Checkstyle.
  • Helps enforce consistent coding standards.

5. Automated Testing

  • Unit Tests: Validate individual components or functions.
  • Integration Tests: Check interactions between modules or services.
  • Regression Tests: Ensure new changes do not break existing functionality.
  • Security & Vulnerability Tests (DevSecOps): Scan dependencies for known issues.

Tests are critical: if any fail, the workflow fails immediately and alerts the developer.


6. Build Artifact Creation

  • Successful builds are packaged into deployable units:
    • JAR/WAR files (Java).
    • Docker images.
    • Python wheels.
    • Node.js bundles.
  • These artifacts are stored for deployment in later stages.

7. Reporting & Notifications

  • Developers are notified of build/test results via:
    • Emails.
    • ChatOps integrations (Slack, Microsoft Teams).
    • Dashboard visualization (Jenkins Blue Ocean, GitLab UI).
  • Clear feedback ensures faster resolution of issues.

Example CI Workflow Diagram

ASCII Diagram

 Developer Commit


+------------------+
| Source Control |
+------------------+


+------------------+
| Build & Compile|
+------------------+


+------------------+
| Automated Testing|
+------------------+


+------------------+
| Package/Artifact|
+------------------+


+------------------+
| Reporting & Alerts|
+------------------+