image: node:20

stages:
  - install
  - lint
  - test

cache:
  paths:
    - node_modules/

before_script:
  - npm install
  - apt-get update

install_dependencies:
  stage: install
  script:
    - npm install
  artifacts:
    paths:
      - node_modules/
    expire_in: 1 week

lint:
  stage: test
  script:
    - npm run lint
    - npm run types
  only:
    - branches
    - merge_requests

test:
  stage: test
  script:
    - npm test
  only:
    - branches
    - merge_requests
