diff --git a/.webauto-ci.yaml b/.webauto-ci.yaml index 74a23b71d4e..2d6771107f5 100644 --- a/.webauto-ci.yaml +++ b/.webauto-ci.yaml @@ -1,9 +1,77 @@ +# The configuration file for Web.Auto CI/CD tool. +# https://docs.web.auto/user-manuals/evaluator/configuration/reference/introduction + version: 2 artifacts: - name: main + metadata: + play-ondemand.ci.web.auto/buildspec: Autoware-Humble_v0.29.0 build: - type: tier4/universe/main/amd64/v1 + type: custom + runtime: + type: standard1/amd64/large + source: + vcstool: + repositories_files: + - autoware.repos + - simulator.repos + import_path: src + environment_variables: + AUTOWARE_PATH: /opt/autoware + DEBIAN_FRONTEND: noninteractive + LANG: C.UTF-8 + phases: + - name: environment-setup + user: root + exec: ./.webauto-ci/main/environment-setup/run.sh + caches: + - name: apt-lists + mountpoint: /var/lib/apt/lists + - name: apt-archives + mountpoint: /var/cache/apt/archives + build_result_reuse: + key_files: + - .webauto-ci/main/environment-setup/**/* + - name: autoware-setup + user: autoware + exec: ./.webauto-ci/main/autoware-setup/run.sh + caches: + - name: apt-lists + mountpoint: /var/lib/apt/lists + - name: apt-archives + mountpoint: /var/cache/apt/archives + build_result_reuse: + key_files: + - .webauto-ci/main/autoware-setup/**/* + - ansible/**/* + - ansible-galaxy-requirements.yaml + - amd64.env + incremental_build: + enabled: true + - name: autoware-build + user: autoware + exec: ./.webauto-ci/main/autoware-build/run.sh + environment_variables: + PARALLEL_WORKERS: "32" + CCACHE_DIR: /tmp/build/cache/ccache + caches: + - name: apt-lists + mountpoint: /var/lib/apt/lists + - name: apt-archives + mountpoint: /var/cache/apt/archives + - name: ccache + mountpoint: /tmp/build/cache/ccache + build_result_reuse: + key_files: + - .webauto-ci/main/autoware-build/**/* + - src/**/* + base_container_image: + from: ubuntu:22.04 + output_container_image: + from: autoware-build + workdir: /opt/autoware + user: autoware simulations: - name: lexus_planning_sim @@ -13,9 +81,7 @@ simulations: type: container artifact: main runtime: - type: simulator/standard1/amd64/medium - cpu: 8 - memory: 16384 + type: standard1/amd64/medium parameters: launch_autoware: "true" autoware_launch_package: autoware_launch diff --git a/.webauto-ci/main/autoware-build/run.sh b/.webauto-ci/main/autoware-build/run.sh new file mode 100755 index 00000000000..f6d3751afad --- /dev/null +++ b/.webauto-ci/main/autoware-build/run.sh @@ -0,0 +1,44 @@ +#!/bin/bash -e + +: "${WEBAUTO_CI_SOURCE_PATH:?is not set}" +: "${WEBAUTO_CI_DEBUG_BUILD:?is not set}" + +: "${AUTOWARE_PATH:?is not set}" +: "${CCACHE_DIR:=}" +: "${CCACHE_SIZE:=1G}" +: "${PARALLEL_WORKERS:=4}" + +sudo mkdir "$AUTOWARE_PATH" +sudo chown "$(whoami)": "$AUTOWARE_PATH" +cd "$WEBAUTO_CI_SOURCE_PATH" +cp -r src .webauto-ci.* "$AUTOWARE_PATH" +cd "$AUTOWARE_PATH" + +if [ -n "$CCACHE_DIR" ]; then + mkdir -p "$CCACHE_DIR" + export USE_CCACHE=1 + export CCACHE_DIR="$CCACHE_DIR" + export CC="/usr/lib/ccache/gcc" + export CXX="/usr/lib/ccache/g++" + ccache -M "$CCACHE_SIZE" +fi + +sudo -E apt-get -y update + +# shellcheck disable=SC2012 +ROS_DISTRO=$(ls -1 /opt/ros | head -1) +# shellcheck disable=SC1090 +source "/opt/ros/$ROS_DISTRO/setup.bash" +rosdep update +rosdep install -y --from-paths src --ignore-src --rosdistro "$ROS_DISTRO" + +[[ $WEBAUTO_CI_DEBUG_BUILD == "true" ]] && build_type="RelWithDebInfo" || build_type="Release" + +colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE="$build_type" -DBUILD_TESTING=off -Wno-dev --no-warn-unused-cli \ + --symlink-install \ + --catkin-skip-building-tests \ + --executor parallel \ + --parallel-workers "$PARALLEL_WORKERS" + +sudo -E apt-get -y autoremove diff --git a/.webauto-ci/main/autoware-setup/run.sh b/.webauto-ci/main/autoware-setup/run.sh new file mode 100755 index 00000000000..a4f840c9398 --- /dev/null +++ b/.webauto-ci/main/autoware-setup/run.sh @@ -0,0 +1,20 @@ +#!/bin/bash -e + +ansible_args=() +ansible_args+=("--extra-vars" "prompt_install_nvidia=y") +ansible_args+=("--extra-vars" "prompt_download_artifacts=y") +ansible_args+=("--extra-vars" "data_dir=$HOME/autoware_data") +ansible_args+=("--extra-vars" "ros2_installation_type=ros-base") +ansible_args+=("--extra-vars" "install_devel=false") + +# read amd64 env file and expand ansible arguments +source 'amd64.env' +while read -r env_name; do + ansible_args+=("--extra-vars" "${env_name}=${!env_name}") +done < <(sed "s/=.*//" >/etc/sudoers +gpasswd -a "$user" sudo