stages:
  - test
  - build
  - docu


rq-pytests:
  stage: test
  image: ros:humble
  before_script:
   - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@mygit.th-deg.de/roboct/robo_quality/rq_interfaces
   - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@mygit.th-deg.de/roboct/robo_quality/rq_hardware
   - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@mygit.th-deg.de/roboct/robo_quality/rq_controller
   - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@mygit.th-deg.de/roboct/robo_quality/rq_ddetection
   - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@mygit.th-deg.de/roboct/robo_quality/rq_trajectory
   - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@mygit.th-deg.de/roboct/robo_quality/rq_reconstruction
   - rosdep install --from-paths . -y --ignore-src
   - colcon build --merge-install

  script:
   - pytest ./rq_controller/tests/
   
build-ros:
  stage: build
  image: ros:humble
  dependencies: [rq-pytests]
  needs:
  - rq-pytests
  artifacts:
    when: always
    paths:
      - install

create-docu:
  stage: docu
  image: ros:humble
  dependencies: [rq-pytests]
  needs:
  - rq-pytests
  before_script:
    - pip install pdoc3
    - source ./install/setup.bash
  script:
    - mkdir doc
    - pdoc3 --html rq_controller -o=./doc/rq_controller -c show_source_code=True
  artifacts:
    when: always
    paths:
      - doc
