Skip to content

unxed/f4 / .agents/skills/aif-ci

aif-ci

Flagged

Generate CI/CD pipeline (GitHub Actions / GitLab CI) with linting, static analysis, tests, security. Use when user says "ci", "setup ci", "github actions", "gitlab ci", "pipeline".

references/GITLAB-PATTERNS.md

View on GitHub
# GitLab CI Patterns

## Pipeline Structure

```yaml
stages:
  - install
  - lint
  - test
  - build

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

default:
  interruptible: true
```

## Job Organization

| Stage | Jobs | Notes |
|-------|------|-------|
| `install` | `install` | Install dependencies, cache + artifact for downstream |
| `lint` | `code-style`, `lint`, `static-analysis`, `rector` | All `needs: [install]`, run in parallel |
| `test` | `tests` | `needs: [install]` |
| `build` | `build` | `needs: [tests, lint, ...]` |
| `security` | `security` | `needs: [install]`, `allow_failure: true` |

## GitLab-Specific Features

1. **Cache strategy**: Use `policy: pull-push` on `install` job, `policy: pull` on all others
2. **Cache key**: Use `key: files:` with lock file for automatic invalidation
3. **Artifacts**: Pass `vendor/`/`node_modules/` via artifacts from install job (faster than cache for same-pipeline)
4. **Reports**: Use `artifacts.reports.junit` for test results, `artifacts.reports.codequality` for lint output
5. **DAG**: Use `needs:` keyword for parallel execution within stages
6. **Hidden jobs**: Use `.setup` anchors for shared `before_script` and cache config
7. **Coverage regex**: Add `coverage:` regex for test jobs

## PHP-Specific GitLab Patterns

```yaml
image: php:8.3-cli

variables:
  COMPOSER_HOME: $CI_PROJECT_DIR/.composer

.composer-setup:
  before_script:
    - apt-get update && apt-get install -y git unzip
    - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
```

## Report Formats for GitLab Integration

| Tool | Flag | Report Type |
|------|------|-------------|
| PHPStan | `--error-format=gitlab` | `codequality` |
| ESLint | `--format json` | `codequality` |
| Ruff | `--output-format=gitlab` | `codequality` |
| golangci-lint | `--out-format code-climate` | `codequality` |
| PHPUnit | `--log-junit report.xml` | `junit` |
| Jest | `--reporters=jest-junit` | `junit` |
| pytest | `--junitxml=report.xml` | `junit` |
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall