123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- stages:
- - build
- - deploy
- variables:
- VCS_FILE: build_depends.repos
- AUTOWARE_CROSS_TARGET_PLATFORM: generic-aarch64
- .build: &build_common
- before_script:
- - mkdir -p src_tmp/$CI_PROJECT_NAME && mv `find -maxdepth 1 -not -name . -not -name src_tmp -not -name $VCS_FILE` src_tmp/$CI_PROJECT_NAME && mv src_tmp/ src/
- - sudo apt-get update
- - sudo apt-get install -y libarmadillo-dev libglew-dev libssh2-1-dev python-flask python-requests wget lcov
- - sudo apt-get install -y python3-pip python3-setuptools python3-colcon-common-extensions python3-vcstool
- # Update setuptools from PyPI because the version Ubuntu ships with is too old
- - pip3 install -U setuptools
- - vcs validate < $VCS_FILE
- - vcs import src/ < $VCS_FILE
- - rosdep update
- - rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
- script:
- # We first build the entire workspace normally
- - source /opt/ros/${ROS_DISTRO}/setup.bash
- - 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
- - lcov --initial --directory build --capture --output-file lcov.base
- - colcon test
- - colcon test-result --verbose
- - lcov --directory build --capture --output-file lcov.test
- - lcov -a lcov.base -a lcov.test -o lcov.total
- - lcov -r lcov.total '*/tests/*' '*/test/*' '*/build/*' '*/devel/*' '*/install/*' '*/log/*' '/usr/*' '/opt/*' '/tmp/*' '*/CMakeCCompilerId.c' '*/CMakeCXXCompilerId.cpp' -o lcov.total.filtered
- # BRANCH_NAME: gets branch name from CI_COMMIT_REF_NAME variable substituting / with _ (feature/test_this_lib becomes feature_test_this_lib)
- # CI_COMMIT_REF_NAME: (from https://docs.gitlab.com/ee/ci/variables/) The branch or tag name for which project is built
- - BRANCH_NAME="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')"
- - COVERAGE_FOLDER_NAME="coverage_$BRANCH_NAME"
- - genhtml -p "$PWD" --legend --demangle-cpp lcov.total.filtered -o $COVERAGE_FOLDER_NAME
- - tar -czvf coverage.tar.gz $COVERAGE_FOLDER_NAME
- artifacts:
- paths:
- - $CI_PROJECT_DIR/coverage.tar.gz
- expire_in: 48 hrs
- coverage: /\s*lines.*:\s(\d+\.\d+\%\s\(\d+\sof\s\d+.*\))/
- .build_cuda: &build_cuda
- before_script:
- - mkdir -p src_tmp/$CI_PROJECT_NAME && mv `find -maxdepth 1 -not -name . -not -name src_tmp -not -name $VCS_FILE` src_tmp/$CI_PROJECT_NAME && mv src_tmp/ src/
- - sudo apt-get update
- - sudo apt-get install -y libarmadillo-dev libglew-dev libssh2-1-dev python-flask python-requests wget
- - sudo apt-get install -y python3-pip python3-setuptools python3-colcon-common-extensions python3-vcstool
- # Update setuptools from PyPI because the version Ubuntu ships with is too old
- - pip3 install -U setuptools
- - vcs validate < $VCS_FILE
- - vcs import src/ < $VCS_FILE
- - rosdep update
- - rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
- script:
- # We first build the entire workspace normally
- - source /opt/ros/${ROS_DISTRO}/setup.bash
- - colcon build --cmake-args -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_BUILD_TYPE=Debug
- - colcon test
- - colcon test-result --verbose
- .build_cross_vars: &build_cross_vars
- AUTOWARE_TARGET_ARCH: aarch64
- AUTOWARE_TOOLCHAIN_FILE_PATH: $CI_PROJECT_DIR/cross_toolchain.cmake
- AUTOWARE_SYSROOT: /sysroot/${AUTOWARE_CROSS_TARGET_PLATFORM}
- .build_cross: &build_cross_common
- script:
- - mkdir -p src_tmp/$CI_PROJECT_NAME && mv `find -maxdepth 1 -not -name . -not -name src_tmp -not -name $VCS_FILE` src_tmp/$CI_PROJECT_NAME && mv src_tmp/ src/
- - apt update -qq && apt install -y python3-vcstool git wget
- - wget https://gitlab.com/autowarefoundation/autoware.ai/docker/raw/master/crossbuild/cross_toolchain.cmake
- - source ${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO}/setup.bash
- - vcs validate < $VCS_FILE
- - vcs import src/ < $VCS_FILE
- - colcon build
- --merge-install
- --cmake-args
- -DCMAKE_TOOLCHAIN_FILE=${AUTOWARE_TOOLCHAIN_FILE_PATH}
- -DCMAKE_SYSTEM_PROCESSOR=${AUTOWARE_TARGET_ARCH}
- -DCMAKE_PREFIX_PATH="${CI_PROJECT_DIR}/install;${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO}"
- -DCMAKE_FIND_ROOT_PATH=${CI_PROJECT_DIR}/install
- only:
- - merge_requests
- - master
- build_melodic:
- stage: build
- image: autoware/autoware:bleedingedge-melodic-base
- <<: *build_common
- only:
- - merge_requests
- - master
- build_melodic_cuda:
- stage: build
- image: autoware/autoware:bleedingedge-melodic-base-cuda
- <<: *build_cuda
- only:
- - merge_requests
- - master
- build_melodic_arm64:
- tags:
- - arm64
- stage: build
- image: autoware/arm64v8:bleedingedge-melodic-base
- <<: *build_common
- only:
- - branches@autowarefoundation/autoware.ai/common
- build_melodic_cross:
- stage: build
- image: autoware/build:${AUTOWARE_CROSS_TARGET_PLATFORM}-melodic-bleedingedge
- variables:
- ROS_DISTRO: melodic
- <<: *build_cross_vars
- <<: *build_cross_common
- only:
- - merge_requests
- - master
- pages:
- stage: deploy
- image: alpine
- dependencies:
- - build_melodic
- script:
- - BRANCH_NAME="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')"
- - COVERAGE_FOLDER_NAME="coverage_$BRANCH_NAME"
- - tar -xzvf coverage.tar.gz
- - mv $COVERAGE_FOLDER_NAME public
- artifacts:
- paths:
- - public
- only:
- - master
|