variables: CI_SOURCE_PATH: $CI_PROJECT_DIR GIT_SUBMODULE_STRATEGY: recursive .build: &build_common before_script: - mkdir -p src_tmp/${CI_PROJECT_NAME} && mv `find -maxdepth 1 -not -name . -not -name src_tmp` src_tmp/${CI_PROJECT_NAME} && mv src_tmp/ src/ - apt-get update - apt-get install -y wget python3-pip python3-setuptools python3-colcon-common-extensions # Update setuptools from PyPI because the version Ubuntu ships with is too old - pip3 install -U setuptools - rosdep update script: - source /opt/ros/${ROS_DISTRO}/setup.bash - rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} # We first build the entire workspace normally - colcon build --cmake-args -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_BUILD_TYPE=Debug # And then build the tests target. catkin (ROS1) packages add their tests to the tests target # which is not the standard target for CMake projects. We need to trigger the tests target so that # tests are built and any fixtures are set up. - colcon build --cmake-target tests --cmake-args -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_BUILD_TYPE=Debug - colcon test - colcon test-result coverage: /\s*lines.*:\s(\d+\.\d+\%\s\(\d+\sof\s\d+.*\))/ only: - merge_requests - master .build_cross_vars: &build_cross_vars AUTOWARE_HOME: $CI_PROJECT_DIR AUTOWARE_TARGET_ARCH: aarch64 AUTOWARE_TARGET_PLATFORM: generic-aarch64 AUTOWARE_BUILD_PATH: $CI_PROJECT_DIR/build-${AUTOWARE_TARGET_PLATFORM} AUTOWARE_INSTALL_PATH: $CI_PROJECT_DIR/install-${AUTOWARE_TARGET_PLATFORM} AUTOWARE_TOOLCHAIN_FILE_PATH: $CI_PROJECT_DIR/cross_toolchain.cmake AUTOWARE_SYSROOT: /sysroot/${AUTOWARE_TARGET_PLATFORM} .build_cross: &build_cross_common script: - wget https://gitlab.com/autowarefoundation/autoware.ai/docker/raw/master/crossbuild/cross_toolchain.cmake - 'docker run -e AUTOWARE_SYSROOT=${AUTOWARE_SYSROOT} --rm -v ${AUTOWARE_HOME}:${AUTOWARE_HOME} -w ${AUTOWARE_HOME} autoware/build:${AUTOWARE_TARGET_PLATFORM}-${ROS_DISTRO}-${AUTOWARE_DOCKER_DATE} bash -c " source ${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO}/setup.bash && colcon build --merge-install --build-base ${AUTOWARE_BUILD_PATH} --install-base ${AUTOWARE_INSTALL_PATH} --cmake-args -DCMAKE_TOOLCHAIN_FILE=${AUTOWARE_TOOLCHAIN_FILE_PATH} -DCMAKE_SYSTEM_PROCESSOR=${AUTOWARE_TARGET_ARCH} -DCMAKE_PREFIX_PATH=\"${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO};${AUTOWARE_INSTALL_PATH}\" -DCMAKE_FIND_ROOT_PATH=${AUTOWARE_INSTALL_PATH} " ' only: - merge_requests - master build_kinetic: image: ros:kinetic-perception variables: ROS_DISTRO: kinetic <<: *build_common build_melodic: image: ros:melodic-perception variables: ROS_DISTRO: melodic <<: *build_common build_kinetic_cross: image: docker services: - docker:dind variables: ROS_DISTRO: kinetic AUTOWARE_DOCKER_DATE: "latest" <<: *build_cross_vars <<: *build_cross_common build_melodic_cross: image: docker services: - docker:dind variables: ROS_DISTRO: melodic AUTOWARE_DOCKER_DATE: "latest" <<: *build_cross_vars <<: *build_cross_common