gitlab-ci-test-jobslisted
Install: claude install-skill testland/qa
# gitlab-ci-test-jobs
## Overview
Configured via `.gitlab-ci.yml` at the repo root. Structure:
**stages** (sequential phases) → **jobs** (parallel within a
stage) → **steps** (a job's `script:` array).
## When to use
- Project hosts on GitLab (self-hosted or .com).
- Existing `.gitlab-ci.yml` needs standardization.
- The team values GitLab's tight VCS / CI / registry / artifacts
integration.
## Step 1 - Basic test job
```yaml
# .gitlab-ci.yml
stages:
- test
test:
stage: test
image: node:22
script:
- npm ci
- npm test
```
Default: runs on every push to any branch. Per-branch / per-MR
filtering via `rules:` (Step 7).
## Step 2 - Parallel matrix
```yaml
test:
stage: test
image: node:22
parallel:
matrix:
- NODE_VERSION: ['20', '22']
OS_IMAGE: ['node:20', 'node:22']
script:
- npm ci
- npm test
```
`parallel: matrix:` runs the job once per matrix entry. Use
GitLab's matrix syntax for cross-product / explicit `include` for
specific combinations.
## Step 3 - Services (PostgreSQL, Redis)
```yaml
test:
stage: test
image: node:22
services:
- name: postgres:15
alias: postgres
variables:
POSTGRES_PASSWORD: test
- name: redis:7
alias: redis
variables:
DATABASE_URL: 'postgres://postgres:test@postgres:5432/postgres'
REDIS_URL: 'redis://redis:6379'
script:
- npm ci
- npm test
```
The service hostname is the `alias` field; reachable from the job
container.
## Step 4 -