include:
  # This remote project centralize our CI "golden path" https://docs.gitlab.com/ee/ci/yaml/#includefile
  remote: 'https://gitlab.com/drupalspoons/composer-plugin/-/raw/master/templates/.gitlab-ci.yml'

# Override phpcs config
phpcs:
  stage: test
  script:
    - cp -u phpcs.xml $WEB_ROOT/modules/custom
    - composer phpcs -- --report-junit=junit.xml --report-full --report-summary
  allow_failure: false
  artifacts:
    expose_as: junit
    expire_in: 6 mos
    paths:
      - junit.xml
    reports:
      junit: junit.xml

# Disable stylelint
stylelint:
  stage: test
  script:
    - yarn version

frontend:
  stage: build
  image: node:16.13-alpine
  variables:
    GIT_STRATEGY: fetch
    GIT_CHECKOUT: "true"
  script:
    - apk add bash git openssh
    - npm install
    - npm run build
    - 'git diff --exit-code src dist || (echo "Error: Uncommitted changes detected"; exit 1)'
  artifacts:
    paths:
      - node_modules/
    expire_in: 6 mos
