build-vue:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  script:
    - cd frontend
    - docker build --pull -t vue .
  rules:
    - if: $CI_MERGE_REQUEST_ID
      changes:
        - frontend/**/*
      when: always
    - when: never

build-backend:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  script:
    - cd backend
    - docker build --pull -t backend .
  rules:
    - if: $CI_MERGE_REQUEST_ID
      changes:
        - backend/**/*
      when: always
    - when: never
    

build-android:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  script: 
    - cd android
    - docker build --pull -t android .
  rules:
    - if: $CI_MERGE_REQUEST_ID
      changes:
        - android/**/*
      when: always
    - when: never

build-documentation:
  image: icaotix/latex:full-incremental
  stage: build
  script:
    - export CI_JOB_TIMESTAMP=$(date --utc -I)
    - cd documentation
    - latexmk -pdf documentation
    - mv "documentation.pdf" "documentation-${CI_JOB_TIMESTAMP}.pdf"
  artifacts:
    paths:
      - "**/documentation*.pdf"
  rules:
    - if: $CI_MERGE_REQUEST_ID
      changes:
        - documentation/**/*
      when: always
    - when: never
