forked from ubi-agni/mujoco_ros_pkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add workflows based on moveit
- Loading branch information
Showing
14 changed files
with
552 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# mujoco_ros/mujoco_ros:noetic-ci-testing | ||
|
||
ARG IMAGE=noetic | ||
FROM davidpl1/mujoco_ros:${IMAGE}-ci | ||
|
||
# Switch to ros-testing | ||
RUN echo "deb http://packages.ros.org/ros-testing/ubuntu `lsb_release -cs` main" | tee /etc/apt/sources.list.d/ros1-latest.list | ||
|
||
# Upgrade packages to ros-testing and clean apt-cache within one RUN command | ||
RUN apt-get -qq update && \ | ||
apt-get -qq -y dist-upgrade && \ | ||
# | ||
# Clear apt-cache to reduce image size | ||
rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
ARG ROS_DISTRO=noetic | ||
FROM ros:${ROS_DISTRO}-ros-base | ||
|
||
ARG MUJOCO_VERSIONS=[2.3.6] | ||
|
||
ENV TERM xterm | ||
ENV MUJOCO_DIR=${HOME}/mujoco/2.3.6 | ||
|
||
# Setup temporary ROS workspace | ||
WORKDIR /root/ws_mujoco | ||
|
||
# Copy MuJoCo ROS sources from docker context | ||
COPY . src/mujoco_ros_pkgs | ||
|
||
# Combined commands for less stages | ||
RUN \ | ||
apt-get -q update && \ | ||
apt-get -q -y dist-upgrade && \ | ||
# | ||
# Base dependencies | ||
apt-get -q install --no-install-recommends -y \ | ||
wget curl git sudo python3-wstool \ | ||
# Build tools | ||
python3-catkin-tools \ | ||
clang clang-format-10 clang-tidy clang-tools \ | ||
ccache && \ | ||
# | ||
# Install MuJoCo Versions | ||
MUJOCO_VERSIONS=${MUJOCO_VERSIONS} ./src/mujoco_ros_pkgs/.docker/ci/mujoco_installer.sh >> mujoco_install.log && \ | ||
# | ||
# Download upstream repo dependencies | ||
wstool init --shallow src ./src/mujoco_ros_pkgs/.github/workflows/upstream.rosinstall && \ | ||
# | ||
# Download all dependencies | ||
rosdep update && \ | ||
DEBIAN_FRONTEND=noninteractive \ | ||
rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false && \ | ||
# Remove sources from the container | ||
rm -rf src && \ | ||
# | ||
# Clear apt-cache to reduce image size | ||
rm -rf /var/lib/apt/lists/* && \ | ||
# | ||
# Globally disable git security | ||
git config --global --add safe.directory "*" | ||
|
||
ENV IN_DOCKER 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p ${HOME}/mujoco | ||
rm -rf ${HOME}/mujoco/* | ||
echo parsing MuJoCo versions: $MUJOCO_VERSIONS | ||
newstr=$(echo $MUJOCO_VERSIONS | sed 's/\[//' ) # remove [ | ||
newstr2=$(echo $newstr | sed 's/\]//' ) # remove ] | ||
IFS=, # split on , | ||
read -r -a versions <<< "$newstr2" | ||
#set -o noglob # disable glob | ||
#set -- $newstr2 # split+glob with glob disabled | ||
|
||
for mj_version in "${versions[@]}" | ||
do | ||
echo "installing MuJoCo Version ${mj_version} ..." | ||
available=$(curl -o /dev/null --silent -Iw '%{http_code}' \ | ||
https://github.com/google-deepmind/mujoco/releases/download/${mj_version}/mujoco-${mj_version}-linux-x86_64.tar.gz) | ||
if [[ $available -eq 404 ]]; then | ||
echo "version ${mj_version} could not be found!" | ||
continue | ||
fi | ||
curl -O -L https://github.com/google-deepmind/mujoco/releases/download/${mj_version}/mujoco-${mj_version}-linux-x86_64.tar.gz || echo "could not find version ${mj_version}!" | ||
mkdir ${HOME}/mujoco/${mj_version} | ||
tar -xzf mujoco-${mj_version}-linux-x86_64.tar.gz -C ${HOME}/mujoco/${mj_version} --strip-components 1 | ||
rm mujoco-${mj_version}-linux-x86_64.tar.gz | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG IMAGE=noetic | ||
|
||
FROM davidpl1/mujoco_ros:${IMAGE}-ci-testing | ||
|
||
ENV PYTHONIOENCODING UTF-8 | ||
# Export ROS_UNDERLAY for downstream docker containers | ||
ENV ROS_UNDERLAY /root/ws_mujoco/install | ||
# Environment variable used in instructions on moveit.ros.org website for running clang-tidy | ||
ENV CATKIN_WS $(realpath $ROS_UNDERLAY/..) | ||
WORKDIR $ROS_UNDERLAY/.. | ||
|
||
# Copy MoveIt sources from docker context | ||
COPY . src/mujoco_ros_pkgs | ||
|
||
# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size | ||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers | ||
RUN --mount=type=cache,target=/root/.ccache/ \ | ||
# Enable ccache | ||
PATH=/usr/lib/ccache:$PATH && \ | ||
# Fetch required upstream sources for building | ||
wstool init --shallow src src/mujoco_ros_pkgs/.github/workflows/upstream.rosinstall && \ | ||
# | ||
catkin config --extend /opt/ros/$ROS_DISTRO --install --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && \ | ||
# Status rate is limited so that just enough info is shown to keep Docker from timing out, | ||
# but not too much such that the Docker log gets too long (another form of timeout) | ||
catkin build --limit-status-rate 0.001 --no-notify && \ | ||
ccache -s && \ | ||
# | ||
# Update /ros_entrypoint.sh to source our new workspace | ||
sed -i "s#/opt/ros/\$ROS_DISTRO/setup.bash#$ROS_UNDERLAY/setup.sh#g" /ros_entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
* | ||
|
||
!.docker/** | ||
!.github/workflows/upstream.rosinstall | ||
!.github/workflows/downstream.rosinstall | ||
!**/package.xml | ||
!**/CATKIN_IGNORE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- noetic-devel | ||
- noetic-master | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
default: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
env: | ||
- IMAGE: noetic-ci | ||
CCOV: true | ||
BUILDER: catkin_tools_devel | ||
MUJOCO_VERSION: 2.3.6 | ||
- IMAGE: noetic-ci | ||
CCOV: true | ||
BUILDER: catkin_tools_devel | ||
MUJOCO_VERSION: 2.3.7 | ||
- IMAGE: master-ci | ||
CATKIN_LINT: true | ||
env: | ||
DOCKER_RUN_OPTS: -e MUJOCO_DIR=/mujoco/${{ matrix.env.MUJOCO_VERSION }} | ||
CXXFLAGS: -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls | ||
CLANG_TIDY_ARGS: --fix --fix-errors --format-style=file | ||
DOCKER_IMAGE: docker.io/davidpl1/mujoco_ros:${{ matrix.env.IMAGE }} | ||
UPSTREAM_WORKSPACE: .github/workflows/upstream.rosinstall | ||
# DOWNSTREAM_WORKSPACE: .github/workflows/downstream.rosinstall | ||
# Pull any updates to the upstream workspace | ||
AFTER_SETUP_UPSTREAM_WORKSPACE: vcs pull $BASEDIR/upstream_ws/src | ||
AFTER_SETUP_DOWNSTREAM_WORKSPACE: vcs pull $BASEDIR/downstream_ws/src | ||
# Clear ccache stats before and log the stats after the build | ||
AFTER_SETUP_CCACHE: ccache --zero-stats --max-size=10.0G | ||
AFTER_BUILD_TARGET_WORKSPACE: ccache --show-stats | ||
AFTER_BUILD_DOWNSTREAM_WORKSPACE: ccache --show-stats | ||
# Compile CCOV with Debug. Enable -Werror. | ||
TARGET_CMAKE_ARGS: > | ||
-DCMAKE_BUILD_TYPE=${{ matrix.env.CCOV && 'Debug' || 'Release'}} | ||
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS${{ matrix.env.CCOV && ' --coverage -O2 -fno-omit-frame-pointer'}}" | ||
UPSTREAM_CMAKE_ARGS: "-DCMAKE_CXX_FLAGS=''" | ||
DOWNSTREAM_CMAKE_ARGS: -DCMAKE_CXX_FLAGS="-Wall -Wextra" | ||
CCACHE_DIR: ${{ github.workspace }}/.ccache | ||
BASEDIR: ${{ github.workspace }}/.work | ||
CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }} | ||
BEFORE_CLANG_TIDY_CHECKS: | | ||
# Show list of applied checks | ||
(cd $TARGET_REPO_PATH; clang-tidy --list-checks) | ||
BUILDER: ${{ matrix.env.BUILDER || 'catkin_tools' }} | ||
CC: ${{ matrix.env.CLANG_TIDY && 'clang' }} | ||
CXX: ${{ matrix.env.CLANG_TIDY && 'clang++' }} | ||
|
||
name: "${{ matrix.env.IMAGE }}${{ matrix.env.CATKIN_LINT && ' + catkin_lint' || ''}}${{ matrix.env.CCOV && ' + ccov' || ''}}${{ matrix.env.IKFAST_TEST && ' + ikfast' || ''}}${{ matrix.env.CLANG_TIDY && (github.event_name != 'workflow_dispatch' && ' + clang-tidy (delta)' || ' + clang-tidy (all)') || '' }}" | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: "Free up disk space" | ||
if: matrix.env.CCOV | ||
run: | | ||
sudo apt-get -qq purge build-essential "ghc*" | ||
sudo apt-get clean | ||
# cleanup docker images not used by us | ||
docker system prune -af | ||
# shift ccache folder to /mnt on a separate disk | ||
sudo mkdir -p /mnt/ccache | ||
sudo mkdir ${{ env.CCACHE_DIR }} | ||
sudo mount --bind ${{ env.CCACHE_DIR }} /mnt/ccache | ||
# free up a lot of stuff from /usr/local | ||
sudo rm -rf /usr/local | ||
df -h | ||
- uses: actions/checkout@v3 | ||
- name: Cache upstream workspace | ||
uses: rhaschke/cache@main | ||
with: | ||
path: ${{ env.BASEDIR }}/upstream_ws | ||
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }} | ||
restore-keys: ${{ env.CACHE_PREFIX }} | ||
env: | ||
GHA_CACHE_SAVE: always | ||
CACHE_PREFIX: upstream_ws-${{ matrix.env.IMAGE }}-${{ hashFiles('.github/workflows/upstream.rosinstall', '.github/workflows/ci.yaml') }} | ||
- name: Cache downstream workspace | ||
uses: rhaschke/cache@main | ||
with: | ||
path: ${{ env.BASEDIR }}/downstream_ws | ||
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }} | ||
restore-keys: ${{ env.CACHE_PREFIX }} | ||
env: | ||
GHA_CACHE_SAVE: always | ||
CACHE_PREFIX: downstream_ws-${{ matrix.env.IMAGE }}-${{ hashFiles('.github/workflows/downstream.rosinstall', '.github/workflows/ci.yaml') }} | ||
# The target directory cache doesn't include the source directory because | ||
# that comes from the checkout. See "prepare target_ws for cache" task below | ||
- name: Cache target workspace | ||
if: "!matrix.env.CCOV" | ||
uses: rhaschke/cache@main | ||
with: | ||
path: ${{ env.BASEDIR }}/target_ws | ||
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }} | ||
restore-keys: ${{ env.CACHE_PREFIX }} | ||
env: | ||
GHA_CACHE_SAVE: always | ||
CACHE_PREFIX: target_ws${{ matrix.env.CCOV && '-ccov' || '' }}-${{ matrix.env.IMAGE }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml', '.github/workflows/ci.yaml') }} | ||
- name: Cache ccache | ||
uses: rhaschke/cache@main | ||
with: | ||
path: ${{ env.CCACHE_DIR }} | ||
key: ${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }} | ||
restore-keys: | | ||
${{ env.CACHE_PREFIX }}-${{ github.sha }} | ||
${{ env.CACHE_PREFIX }} | ||
env: | ||
GHA_CACHE_SAVE: always | ||
CACHE_PREFIX: ccache-${{ matrix.env.IMAGE }}${{ matrix.env.CCOV && '-ccov' || '' }} | ||
|
||
- id: ici | ||
name: Run industrial_ci | ||
uses: ros-industrial/industrial_ci@master | ||
env: ${{ matrix.env }} | ||
|
||
- name: Upload test artifacts (on failure) | ||
uses: actions/upload-artifact@v3 | ||
if: failure() && (steps.ici.outputs.run_target_test || steps.ici.outputs.target_test_results) | ||
with: | ||
name: test-results-${{ matrix.env.IMAGE }} | ||
path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml | ||
- name: Generate codecov report | ||
uses: rhaschke/lcov-action@main | ||
if: always() && matrix.env.CCOV && steps.ici.outputs.target_test_results == '0' | ||
with: | ||
docker: $DOCKER_IMAGE | ||
workdir: ${{ env.BASEDIR }}/target_ws | ||
ignore: '"*/target_ws/build/*" "*/target_ws/install/*" "*/test/*"' | ||
- name: Upload codecov report | ||
uses: codecov/codecov-action@v3 | ||
if: always() && matrix.env.CCOV && steps.ici.outputs.target_test_results == '0' | ||
with: | ||
files: ${{ env.BASEDIR }}/target_ws/coverage.info | ||
- name: Upload clang-tidy changes | ||
uses: rhaschke/upload-git-patch-action@main | ||
if: always() && matrix.env.CLANG_TIDY | ||
with: | ||
name: clang-tidy | ||
path: ${{ env.BASEDIR }}/target_ws/src/$(basename $(pwd)) | ||
- name: Prepare target_ws for cache | ||
if: always() && !matrix.env.CCOV | ||
run: | | ||
du -sh ${{ env.BASEDIR }}/target_ws | ||
sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete | ||
sudo rm -rf ${{ env.BASEDIR }}/target_ws/src ${{ env.BASEDIR }}/target_ws/logs | ||
du -sh ${{ env.BASEDIR }}/target_ws |
Oops, something went wrong.