# ---------- GLOBAL SETUP ---------- #
workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'

stages:
  - install
  - lint
  - test

variables:
  NODE_VERSION: "24.11.1"
  BASE_LAYER: trixie-slim

default:
  image: docker.io/library/node:${NODE_VERSION}-${BASE_LAYER}
  cache:
    key: "${CI_COMMIT_REF_SLUG}"
    paths:
      - node_modules/
    policy: pull-push

# --------- INSTALLING --------- #
install:
  stage: install
  tags:
    - install
  script:
    - npm ci
  artifacts:
    paths:
      - node_modules/
    expire_in: 1h

# ---------- LINTING ---------- #
lint:
  stage: lint
  needs:
    - install
  tags:
    - lint
  script:
    - npm run lint

# ---------- TESTING ---------- #
test:
  stage: test
  needs:
    - install
  tags:
    - test
  script:
    - npm run test
