diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a44679..20b31a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ jobs: environment: TERM: xterm # use xterm to get full display output from build INIT_ENV: /home/carma/.base-image/init-env.sh - ROS_2_ENV: /opt/ros/foxy/setup.bash + ROS_1_ENV: /opt/ros/noetic/setup.bash working_directory: "/opt/carma/" # Execution steps steps: @@ -51,20 +51,19 @@ jobs: command: | source ${INIT_ENV} ./src/CARMASscInterfaceWrapper/docker/checkout.bash --ros1_build -r ${PWD} - sed -i '/colcon build/ s/$/ --packages-up-to ssc_interface_wrapper_ros2 pacmod3 kvaser_interface/' ~/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash - sudo apt update - sudo apt -y install ros-foxy-pacmod3 + ./src/CARMASscInterfaceWrapper/docker/install.sh "$ACCESS_ID" "$SECRET_KEY" --ros1_build + sed -i '/colcon build/ s/$/ --packages-up-to ssc_interface_wrapper/' ~/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash - run: name: Build Driver command: | source ${INIT_ENV} - source ${ROS_2_ENV} + source ${ROS_1_ENV} make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov - run: name: Run C++ Tests command: | source ${INIT_ENV} - source ${ROS_2_ENV} + source ${ROS_1_ENV} make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov # Run SonarCloud analysis # PR Branchs and number extracted from Circle variables and github api diff --git a/docker/install.sh b/docker/install.sh old mode 100644 new mode 100755 index 0bbe0b2..6a41059 --- a/docker/install.sh +++ b/docker/install.sh @@ -25,14 +25,22 @@ while [[ $# -gt 0 ]]; do arg="$1" case $arg in -ros1|--ros1_build) - dir=~/workspace_ros1 + if [[ "$CI" == "true" ]]; then + dir=/opt/carma + else + dir=~/workspace_ros1 + fi echo "Install and build ros1 packages" build_ros1_pkgs="$true" build_ros2_pkgs="$false" shift ;; -ros2|--ros2_build) - dir=~/workspace_ros2 + if [[ "$CI" == "true" ]]; then + dir=/opt/carma + else + dir=~/workspace_ros2 + fi echo "Install and build ros2 packages" build_ros1_pkgs="$false" build_ros2_pkgs="$true" @@ -60,9 +68,11 @@ if [ -z $secret_key ]; exit 1 fi +sudo apt-get update + if [ $build_ros1_pkgs -eq 1 ]; then # ROS1 build and install - cd ~/workspace_ros1 + cd "$dir" || exit 1 echo "ROS1 build" source /home/carma/catkin/setup.bash source /opt/autoware.ai/ros/install/setup.bash @@ -72,8 +82,10 @@ if [ $build_ros1_pkgs -eq 1 ]; then sudo apt-get install ros-noetic-pacmod-msgs sudo apt-get install python3-catkin-pkg - colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base /opt/carma/install - chmod -R ugo+x /opt/carma/install + if [ -z "$CI" ]; then + colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base /opt/carma/install + chmod -R ugo+x /opt/carma/install + fi unset ROS_LANG_DISABLE # Get the exit code from the ROS1 build so we can skip the ROS2 build if the ROS1 build failed @@ -88,15 +100,15 @@ if [ $build_ros1_pkgs -eq 1 ]; then elif [ $build_ros2_pkgs -eq 1 ]; then - cd ~/workspace_ros2 + cd "$dir" || exit 1 source /opt/autoware.ai/ros/install_ros2/setup.bash - sudo apt-get update sudo apt-get install -y apt-utils sudo apt-get install ros-foxy-pacmod-msgs sudo apt-get install ros-foxy-pacmod3-msgs - colcon build --packages-up-to ssc_interface_wrapper_ros2 pacmod3 kvaser_interface --build-base ./build_ssc_interface_wrapper --install-base /opt/carma/install_ros2 --cmake-args -DCMAKE_BUILD_TYPE=Release - + if [ -z "$CI" ]; then + colcon build --packages-up-to ssc_interface_wrapper_ros2 pacmod3 kvaser_interface --build-base ./build_ssc_interface_wrapper --install-base /opt/carma/install_ros2 --cmake-args -DCMAKE_BUILD_TYPE=Release + fi # Get the exit code from the ROS2 build status=$? @@ -108,9 +120,11 @@ elif [ $build_ros2_pkgs -eq 1 ]; then exit #Success building ros2 pkgs fi -cd ~ +if [[ "$CI" == "true" ]]; then + exit +fi + source /opt/autoware.ai/ros/install_ros2/setup.bash -sudo apt-get update sudo apt-get -qq install apt-transport-s3 sudo sh -c 'echo "AccessKeyId = '$access_id'" > /etc/apt/s3auth.conf'