## Build and test as catkin package
kinetic-catkin-build:
  stage: build
  image: rduweston/ubuntu-ci:kinetic
  before_script:
    - apt update && apt -y install ros-$ROS_DISTRO-teleop-twist-keyboard
  script:
    - mkdir -p /catkin_ws/src && cd /catkin_ws/src && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_init_workspace"
    - cd /catkin_ws/src && git clone -b v2.x --recursive https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/ugv_sdk.git
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/async_port.git
    - cp -r /builds/$CI_PROJECT_PATH /catkin_ws/src/scout_base
    - cd /catkin_ws && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_make"

kinetic-catkin-isolated-build:
  stage: build
  image: rduweston/ubuntu-ci:kinetic
  before_script:
    - apt update && apt -y install ros-$ROS_DISTRO-teleop-twist-keyboard
  script:
    - mkdir -p /catkin_ws/src && cd /catkin_ws/src && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_init_workspace"
    - cd /catkin_ws/src && git clone -b v2.x --recursive https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/ugv_sdk.git
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/async_port.git
    - cp -r /builds/$CI_PROJECT_PATH /catkin_ws/src/scout_base
    - cd /catkin_ws && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_make_isolated --install"

melodic-catkin-build:
  stage: build
  image: rduweston/ubuntu-ci:melodic
  before_script:
    - apt update && apt -y install ros-$ROS_DISTRO-teleop-twist-keyboard
  script:
    - mkdir -p /catkin_ws/src && cd /catkin_ws/src && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_init_workspace"
    - cd /catkin_ws/src && git clone -b v2.x --recursive https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/ugv_sdk.git
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/async_port.git
    - cp -r /builds/$CI_PROJECT_PATH /catkin_ws/src/scout_base
    - cd /catkin_ws && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_make"

melodic-catkin-isolated-build:
  stage: build
  image: rduweston/ubuntu-ci:melodic
  before_script:
    - apt update && apt -y install ros-$ROS_DISTRO-teleop-twist-keyboard
  script:
    - mkdir -p /catkin_ws/src && cd /catkin_ws/src && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_init_workspace"
    - cd /catkin_ws/src && git clone -b v2.x --recursive https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/ugv_sdk.git
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/async_port.git
    - cp -r /builds/$CI_PROJECT_PATH /catkin_ws/src/scout_base
    - cd /catkin_ws && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_make_isolated --install"

noetic-catkin-build:
  stage: build
  image: rduweston/ubuntu-ci:noetic
  before_script:
    - apt update && apt -y install ros-$ROS_DISTRO-teleop-twist-keyboard
  script:
    - mkdir -p /catkin_ws/src && cd /catkin_ws/src && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_init_workspace"
    - cd /catkin_ws/src && git clone -b v2.x --recursive https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/ugv_sdk.git
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/async_port.git
    - cp -r /builds/$CI_PROJECT_PATH /catkin_ws/src/scout_base
    - cd /catkin_ws && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_make"

noetic-catkin-isolated-build:
  stage: build
  image: rduweston/ubuntu-ci:noetic
  before_script:
    - apt update && apt -y install ros-$ROS_DISTRO-teleop-twist-keyboard
  script:
    - mkdir -p /catkin_ws/src && cd /catkin_ws/src && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_init_workspace"
    - cd /catkin_ws/src && git clone -b v2.x --recursive https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/ugv_sdk.git
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/westonrobot/public/async_port.git
    - cp -r /builds/$CI_PROJECT_PATH /catkin_ws/src/scout_base
    - cd /catkin_ws && /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin_make_isolated --install"