diff --git a/VERSION b/VERSION index db77e0ee9..1cac385c6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.10.5 +1.11.0 diff --git a/ci/build-package.sh b/ci/build-package.sh index 5c0be9ea1..b48f4bb55 100755 --- a/ci/build-package.sh +++ b/ci/build-package.sh @@ -33,6 +33,8 @@ do done echo -e "\e[35m\e[1mPACKAGE = ${PACKAGE}\e[0m" +ROS_VERSION=$(docker exec -t tue-env bash -c 'source ~/.bashrc; echo "${ROS_VERSION}"' | tr -d '\r') +echo -e "\e[35m\e[1mROS_VERSION = ${ROS_VERSION}\e[0m" # If packages is non-zero, this is a multi-package repo. In multi-package repo, check if this package needs CI. # If a single-package repo, CI is always needed. @@ -45,5 +47,27 @@ fi # Use docker environment variables in all exec commands instead of script variables # Compile the package -echo -e "\e[35m\e[1mCompile the package (catkin build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_ENABLE_TESTING=OFF)\e[0m" -docker exec -t tue-env bash -c 'source ~/.bashrc; cd "$TUE_SYSTEM_DIR"/src/"$PACKAGE" && catkin build --this --no-status -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_ENABLE_TESTING=OFF' +if [[ "${ROS_VERSION}" == 1 ]] +then + echo -e "\e[35m\e[1mCompile the package (catkin build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_ENABLE_TESTING=OFF)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}"/src/"${PACKAGE}" && catkin build --this --no-status -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_ENABLE_TESTING=OFF' +else + echo -e "\e[35m\e[1mCheck for default mixin repo (colcon mixin list)\e[0m" + MIXIN_REPOS=$(docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && colcon mixin list | grep -v "^- "' | tr -d '\r' | awk -F ": " '{print $1}') + if ! echo -e "${MIXIN_REPOS}" | grep "^default$" -q + then + echo -e "\e[35m\e[1mAdd the default mixin repo (colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml' + else + echo -e "\e[35m\e[1mDefault mixin repo already exists\e[0m" + fi + + echo -e "\e[35m\e[1mUpdate colcon mixins (colcon mixin update)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && colcon mixin update' + + echo -e "\e[35m\e[1mDeleting the merged install directory\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && rm -rf install' + + echo -e "\e[35m\e[1mCompile the package (colcon build --mixin rel-with-deb-info build-testing-off)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && colcon build --packages-up-to "${PACKAGE}" --mixin rel-with-deb-info build-testing-off --event-handlers desktop_notification- status- terminal_title-' +fi diff --git a/ci/main/action.yml b/ci/main/action.yml index a17921127..926436501 100644 --- a/ci/main/action.yml +++ b/ci/main/action.yml @@ -1,15 +1,23 @@ name: 'TUe CI' description: 'Install, build and test package in tue-env environment' inputs: + image: + default: 'ghcr.io/tue-robotics/tue-env-ros-noetic' + description: 'Container Image to be used' + required: false + type: string package: description: 'Package name' required: true + type: string ssh-key: description: 'SSH key used during install process' required: false + type: string ssh-known-hosts: description: 'Hosts to be added known_hosts' required: false + type: string runs: using: "composite" steps: @@ -69,6 +77,7 @@ runs: done fi ${{ github.action_path }}/../install-package.sh \ + --image=${{ inputs.image }} \ --package=${{ inputs.package }} \ --branch="${BRANCH}" \ --commit="${GITHUB_SHA}" \ diff --git a/ci/modified-packages/action.yml b/ci/modified-packages/action.yml index 2a67744a1..415c090ac 100644 --- a/ci/modified-packages/action.yml +++ b/ci/modified-packages/action.yml @@ -4,9 +4,11 @@ inputs: commit-range: description: 'Range of commits to determine modified files' required: true + type: string ignored-packages: description: 'Packages to be ignored at all times' required: false + type: string outputs: packages: description: 'Modified packages' diff --git a/ci/test-package.sh b/ci/test-package.sh index 696816c43..882bd666f 100755 --- a/ci/test-package.sh +++ b/ci/test-package.sh @@ -33,6 +33,8 @@ do done echo -e "\e[35m\e[1mPACKAGE = ${PACKAGE}\e[0m" +ROS_VERSION=$(docker exec -t tue-env bash -c 'source ~/.bashrc; echo "${ROS_VERSION}"' | tr -d '\r') +echo -e "\e[35m\e[1mROS_VERSION = ${ROS_VERSION}\e[0m" # If packages is non-zero, this is a multi-package repo. In multi-package repo, check if this package needs CI. # If a single-package repo, CI is always needed. @@ -43,10 +45,26 @@ then exit 0 fi -# Build test targets -echo -e "\e[35m\e[1mBuild test targets of this package (catkin build --this --no-deps -DCATKIN_ENABLE_TESTING=ON)\e[0m" -docker exec -t tue-env bash -c 'source ~/.bashrc; cd "$TUE_SYSTEM_DIR"/src/"$PACKAGE" && catkin build --this --no-status --no-deps -DCATKIN_ENABLE_TESTING=ON' +# Use docker environment variables in all exec commands instead of script variables +if [[ "${ROS_VERSION}" == 1 ]] +then + # Build test targets + echo -e "\e[35m\e[1mBuild test targets of this package (catkin build --this --no-deps -DCATKIN_ENABLE_TESTING=ON)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}"/src/"${PACKAGE}" && catkin build --this --no-status --no-deps -DCATKIN_ENABLE_TESTING=ON' + + # Run unit tests + echo -e "\e[35m\e[1mRun tests on this package (catkin test --this --no-deps -DCATKIN_ENABLE_TESTING=ON)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}"/src/"${PACKAGE}" && catkin test --this --no-status --no-deps -DCATKIN_ENABLE_TESTING=ON' +else + # Build test targets + echo -e "\e[35m\e[1mBuild test targets of this package (colcon build --packages-select ${PACKAGE} --mixin rel-with-deb-info build-testing-on)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && colcon build --packages-select "${PACKAGE}" --mixin rel-with-deb-info build-testing-on --event-handlers desktop_notification- status- terminal_title-' -# Run unit tests -echo -e "\e[35m\e[1mRun tests on this package (catkin test --this --no-deps -DCATKIN_ENABLE_TESTING=ON)\e[0m" -docker exec -t tue-env bash -c 'source ~/.bashrc; cd "$TUE_SYSTEM_DIR"/src/"$PACKAGE" && catkin test --this --no-status --no-deps -DCATKIN_ENABLE_TESTING=ON' + # Run unit tests + echo -e "\e[35m\e[1mRun tests on this package (colcon test --packages-select ${PACKAGE} --executor sequential)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && colcon test --packages-select "${PACKAGE}" --executor sequential --event-handlers desktop_notification- status- terminal_title- console_cohesion+' + + # Check test results + echo -e "\e[35m\e[1mCheck test results (colcon test-result --verbose)\e[0m" + docker exec -t tue-env bash -c 'source ~/.bashrc; cd "${TUE_SYSTEM_DIR}" && colcon test-result --verbose' +fi diff --git a/installer/tue-install-impl.bash b/installer/tue-install-impl.bash index e3d777207..06fd45efd 100755 --- a/installer/tue-install-impl.bash +++ b/installer/tue-install-impl.bash @@ -303,8 +303,8 @@ function _try_branch_git local repo branch _checkout_error_code repo="$1" branch="$2" - tue-install-debug "git -C $repo checkout $branch --" - _try_branch_res=$(git -C "$repo" checkout "$branch" -- 2>&1) # _try_branch_res is a "global" variable from tue-install-git + tue-install-debug "git -C ${repo} checkout ${branch} --recurse-submodules --" + _try_branch_res=$(git -C "${repo}" checkout "${branch}" --recurse-submodules -- 2>&1) # _try_branch_res is a "global" variable from tue-install-git _checkout_error_code=$? tue-install-debug "_try_branch_res(${_checkout_error_code}): ${_try_branch_res}" diff --git a/installer/tue-install.bash b/installer/tue-install.bash index db23409a7..99dd8c0b4 100755 --- a/installer/tue-install.bash +++ b/installer/tue-install.bash @@ -140,7 +140,7 @@ then then echo -en "Already on branch ${branch}" else - git -C "${TUE_ENV_TARGETS_DIR}" checkout "${branch}" -- 2>&1 + git -C "${TUE_ENV_TARGETS_DIR}" checkout "${branch}" --recurse-submodules -- 2>&1 git -C "${TUE_ENV_TARGETS_DIR}" submodule sync --recursive 2>&1 git -C "${TUE_ENV_TARGETS_DIR}" submodule update --init --recursive 2>&1 echo -e "Switched to branch ${branch}"