Skip to content

feat: Add a CI Workflow (.github/workflows/ci.yml) #4

Description

@amirrezaalasti

Problem Statement

Currently, the .github/workflows directory contains a deployment script but lacks a fundamental Continuous Integration (CI) pipeline. Without automated checks running on every code change, we are vulnerable to regressions, build failures, and linting errors slipping into the main branch. We need an automated way to verify code quality before it is merged.

Proposed Solution / API Design

We should add a standard GitHub Actions workflow (.github/workflows/ci.yml) that triggers on all pull requests and pushes to the main branch. This workflow will check out the code, set up Node.js, and run our standard installation, linting, and build steps to ensure everything compiles correctly.

# .github/workflows/ci.yml
name: CI Pipeline

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build-and-lint:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Set up Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '20.x' # Update to match the project's target Node version
        cache: 'npm'

    - name: Install dependencies
      run: npm ci

    - name: Run Linter
      run: npm run lint

    - name: Build Workspace
      run: npm run build

Alternatives Considered

  • Local Git Hooks (Husky): We could rely solely on local pre-commit/pre-push hooks to enforce linting and building. However, this is easily bypassed by developers (using --no-verify) and doesn't provide a centralized source of truth for repository health.
  • Third-party CI/CD Services (CircleCI, Travis CI): While powerful, these require additional setup and accounts. Since the repository already uses GitHub Actions for deployment, sticking with GitHub Actions for CI minimizes context switching and configuration overhead.

Additional Context

  • Once this workflow is merged, we should update the repository's Branch Protection Rules to require the build-and-lint job to pass before pull requests can be merged into the main branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions