.gitlab-ci.yml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. variables:
  2. CI_SOURCE_PATH: $CI_PROJECT_DIR
  3. GIT_SUBMODULE_STRATEGY: recursive
  4. .build: &build_common
  5. before_script:
  6. - 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/
  7. - apt-get update
  8. - apt-get install -y wget python3-pip python3-setuptools python3-colcon-common-extensions
  9. # Update setuptools from PyPI because the version Ubuntu ships with is too old
  10. - pip3 install -U setuptools
  11. - rosdep update
  12. script:
  13. - source /opt/ros/${ROS_DISTRO}/setup.bash
  14. - rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO}
  15. # We first build the entire workspace normally
  16. - 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
  17. # And then build the tests target. catkin (ROS1) packages add their tests to the tests target
  18. # which is not the standard target for CMake projects. We need to trigger the tests target so that
  19. # tests are built and any fixtures are set up.
  20. - 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
  21. - colcon test
  22. - colcon test-result
  23. coverage: /\s*lines.*:\s(\d+\.\d+\%\s\(\d+\sof\s\d+.*\))/
  24. only:
  25. - merge_requests
  26. - master
  27. .build_cross_vars: &build_cross_vars
  28. AUTOWARE_HOME: $CI_PROJECT_DIR
  29. AUTOWARE_TARGET_ARCH: aarch64
  30. AUTOWARE_TARGET_PLATFORM: generic-aarch64
  31. AUTOWARE_BUILD_PATH: $CI_PROJECT_DIR/build-${AUTOWARE_TARGET_PLATFORM}
  32. AUTOWARE_INSTALL_PATH: $CI_PROJECT_DIR/install-${AUTOWARE_TARGET_PLATFORM}
  33. AUTOWARE_TOOLCHAIN_FILE_PATH: $CI_PROJECT_DIR/cross_toolchain.cmake
  34. AUTOWARE_SYSROOT: /sysroot/${AUTOWARE_TARGET_PLATFORM}
  35. .build_cross: &build_cross_common
  36. script:
  37. - wget https://gitlab.com/autowarefoundation/autoware.ai/docker/raw/master/crossbuild/cross_toolchain.cmake
  38. - 'docker run
  39. -e AUTOWARE_SYSROOT=${AUTOWARE_SYSROOT}
  40. --rm
  41. -v ${AUTOWARE_HOME}:${AUTOWARE_HOME}
  42. -w ${AUTOWARE_HOME}
  43. autoware/build:${AUTOWARE_TARGET_PLATFORM}-${ROS_DISTRO}-${AUTOWARE_DOCKER_DATE}
  44. bash
  45. -c "
  46. source ${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO}/setup.bash &&
  47. colcon build
  48. --merge-install
  49. --build-base ${AUTOWARE_BUILD_PATH}
  50. --install-base ${AUTOWARE_INSTALL_PATH}
  51. --cmake-args
  52. -DCMAKE_TOOLCHAIN_FILE=${AUTOWARE_TOOLCHAIN_FILE_PATH}
  53. -DCMAKE_SYSTEM_PROCESSOR=${AUTOWARE_TARGET_ARCH}
  54. -DCMAKE_PREFIX_PATH=\"${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO};${AUTOWARE_INSTALL_PATH}\"
  55. -DCMAKE_FIND_ROOT_PATH=${AUTOWARE_INSTALL_PATH}
  56. "
  57. '
  58. only:
  59. - merge_requests
  60. - master
  61. build_kinetic:
  62. image: ros:kinetic-perception
  63. variables:
  64. ROS_DISTRO: kinetic
  65. <<: *build_common
  66. build_melodic:
  67. image: ros:melodic-perception
  68. variables:
  69. ROS_DISTRO: melodic
  70. <<: *build_common
  71. build_kinetic_cross:
  72. image: docker
  73. services:
  74. - docker:dind
  75. variables:
  76. ROS_DISTRO: kinetic
  77. AUTOWARE_DOCKER_DATE: "latest"
  78. <<: *build_cross_vars
  79. <<: *build_cross_common
  80. build_melodic_cross:
  81. image: docker
  82. services:
  83. - docker:dind
  84. variables:
  85. ROS_DISTRO: melodic
  86. AUTOWARE_DOCKER_DATE: "latest"
  87. <<: *build_cross_vars
  88. <<: *build_cross_common