> ## Documentation Index
> Fetch the complete documentation index at: https://docs.remind.tools/llms.txt
> Use this file to discover all available pages before exploring further.

# CI/CD Pipeline

> Continuous integration and deployment documentation

# CI/CD Pipeline

Comprehensive documentation for the continuous integration and deployment pipeline.

## Overview

Remind Tools uses a multi-layered CI/CD approach:

* **GitHub Actions**: Primary CI for testing and validation
* **Codemagic**: Multi-platform builds and deployment
* **Automated releases**: Semantic versioning with changelog

## GitHub Actions

### Main Workflow

```yaml theme={null}
name: CI Pipeline

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main, develop]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: subosito/flutter-action@v2
        with:
          flutter-version: '3.19.0'
      - run: melos bootstrap
      - run: melos run analyze

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: subosito/flutter-action@v2
      - run: melos bootstrap
      - run: melos test
      - uses: codecov/codecov-action@v3
        with:
          files: ./coverage/lcov.info

  build:
    needs: [analyze, test]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        platform: [android, web]
    steps:
      - uses: actions/checkout@v3
      - uses: subosito/flutter-action@v2
      - run: melos bootstrap
      - run: melos run build:${{ matrix.platform }}
```

### Branch Protection

<Tabs>
  <Tab title="Main Branch">
    * Require PR reviews (2)
    * Dismiss stale reviews
    * Require status checks
    * Require up-to-date branches
    * Include administrators
  </Tab>

  <Tab title="Develop Branch">
    * Require PR reviews (1)
    * Require status checks
    * Allow force pushes (admins)
  </Tab>
</Tabs>

## Automated Testing

### Test Matrix

| Test Type    | Trigger    | Coverage | Time    |
| ------------ | ---------- | -------- | ------- |
| Unit Tests   | Every push | 80%+     | \~2 min |
| Widget Tests | Every push | 70%+     | \~3 min |
| Integration  | PR to main | Critical | \~5 min |
| Golden Tests | PR to main | UI       | \~2 min |

### Coverage Reports

```yaml theme={null}
# Generate coverage
- run: melos run coverage

# Upload to Codecov
- uses: codecov/codecov-action@v3
  with:
    token: ${{ secrets.CODECOV_TOKEN }}
    files: ./coverage/lcov.info
    fail_ci_if_error: true
```

## Release Process

### Semantic Versioning

<Steps>
  <Step title="Create Release Branch">
    ```bash theme={null}
    git checkout -b release/v1.2.0
    ```
  </Step>

  <Step title="Version Bump">
    ```bash theme={null}
    melos version
    # Interactive version selection
    ```
  </Step>

  <Step title="Generate Changelog">
    Automatically generated from conventional commits
  </Step>

  <Step title="Create PR">
    PR from release branch to main
  </Step>

  <Step title="Tag & Release">
    ```bash theme={null}
    git tag v1.2.0
    git push origin v1.2.0
    ```
  </Step>
</Steps>

### Conventional Commits

```bash theme={null}
# Features
feat: add expense tracking to trips

# Fixes
fix: resolve map loading issue

# Breaking changes
feat!: new authentication flow

# Documentation
docs: update API documentation

# Performance
perf: optimize image loading
```

## Deployment

### Environment Strategy

| Branch     | Environment | Trigger     | Deployment |
| ---------- | ----------- | ----------- | ---------- |
| main       | Production  | Tag/Release | Automatic  |
| develop    | Staging     | Push        | Automatic  |
| feature/\* | Preview     | PR          | Manual     |

### Platform Deployments

<CardGroup cols={3}>
  <Card title="iOS" icon="apple">
    **TestFlight**

    * Automated via Codemagic
    * Internal testing first
    * Phased rollout
  </Card>

  <Card title="Android" icon="android">
    **Play Console**

    * Internal track first
    * Open testing
    * Production release
  </Card>

  <Card title="Web" icon="globe">
    **Firebase Hosting**

    * Preview URLs for PRs
    * Staging deployment
    * Production CDN
  </Card>
</CardGroup>

## Monitoring

### Build Status

```yaml theme={null}
# Slack notifications
- uses: 8398a7/action-slack@v3
  with:
    status: ${{ job.status }}
    text: 'Build ${{ job.status }}'
  if: always()
```

### Deployment Tracking

* Build times
* Success rates
* Artifact sizes
* Error logs

## Rollback Procedures

<Warning>
  Always test rollback procedures in staging first.
</Warning>

### Quick Rollback

```bash theme={null}
# Revert last deployment
git revert HEAD
git push origin main

# Or use previous tag
git checkout v1.1.0
git tag v1.2.1
git push origin v1.2.1
```

### Platform-Specific

* **iOS**: Resubmit previous build
* **Android**: Upload previous APK
* **Web**: Redeploy previous version

## Best Practices

1. **Never skip tests** for hotfixes
2. **Use feature flags** for gradual rollouts
3. **Monitor metrics** after deployment
4. **Keep artifacts** for 90 days
5. **Document** deployment issues
6. **Automate** repetitive tasks
