Skip to content

Test Suite (master) #5123

Test Suite (master)

Test Suite (master) #5123

Workflow file for this run

name: Test Suite (master)
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
schedule:
- cron: '0 23 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
# XXX: Workaround for https://github.com/actions/cache/issues/1141
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
jobs:
test-sources:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test sources') || github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11]
include:
- os: ubuntu-20.04
DEPENDENCIES_INSTALLATION: "sudo apt update; sudo apt -y install clang-format-10 cppcheck"
- os: macos-11
DEPENDENCIES_INSTALLATION: "brew install clang-format@11 cppcheck; ln /usr/local/bin/clang-format-11 /usr/local/bin/clang-format"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
if: matrix.os == 'ubuntu-20.04' || github.event.pull_request.draft == false
with:
submodules: true
- name: Set up Python 3.8
if: matrix.os == 'ubuntu-20.04' || github.event.pull_request.draft == false
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Test Sources
if: matrix.os == 'ubuntu-20.04' || github.event.pull_request.draft == false
run: |
${{ matrix.DEPENDENCIES_INSTALLATION }}
export OPENDR_HOME=$PWD
export OPENDR_DEVICE=cpu
pip install -r tests/requirements.txt
python -m unittest discover -s tests
install-toolkit:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test tools') || github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Cache Python dependencies and virtual environment
id: cache-python-deps
uses: actions/cache@v3
with:
path: |
~/.cache/pip
venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dependencies.ini') }}-${{ hashFiles('**/install.sh') }}
# restore-keys: |
# ${{ runner.os }}-pip-
- name: Install toolkit and dependencies
if: steps.cache-python-deps.outputs.cache-hit != 'true'
run: |
export ROS_DISTRO=noetic
./bin/install.sh
source bin/activate.sh
python3 -m pip install -r tests/requirements.txt
test-tools:
needs: install-toolkit
if: ${{ contains(github.event.pull_request.labels.*.name, 'test tools') || github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
package:
- engine
- utils
- perception/activity_recognition
- perception/compressive_learning
- perception/face_recognition
- perception/heart_anomaly_detection
- perception/multimodal_human_centric
- perception/pose_estimation
- perception/fall_detection
- perception/gesture_recognition
- perception/speech_recognition
- perception/skeleton_based_action_recognition/costgcn
- perception/skeleton_based_action_recognition/pstgcn
- perception/skeleton_based_action_recognition/stbln
- perception/skeleton_based_action_recognition/stgcn
- perception/skeleton_based_action_recognition/tagcn
- perception/semantic_segmentation
- perception/binary_high_resolution
- perception/object_tracking_2d
# - perception/object_tracking_3d # passes, but disabled due to free() crash
- perception/object_tracking_3d/single_object_tracking
- perception/object_detection_2d/centernet
- perception/object_detection_2d/detr
- perception/object_detection_2d/gem
- perception/object_detection_2d/ssd
- perception/object_detection_2d/nanodet
- perception/object_detection_2d/yolov3
- perception/object_detection_2d/yolov5
- perception/object_detection_2d/retinaface
- perception/object_detection_2d/nms
- perception/speech_transcription/vosk
- perception/speech_transcription/whisper
# - perception/object_detection_3d # passes, but disabled due to free() crash
- perception/facial_expression_recognition
- simulation/human_model_generation
- control/mobile_manipulation
# - control/single_demo_grasp # Throws error, probably due to detectron2 installation #463
- planning/end_to_end_planning
- control/multi_object_search
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Restore Python dependencies and virtual environment cache
id: cache-python-deps
uses: actions/cache@v3
with:
path: |
~/.cache/pip
venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dependencies.ini') }}-${{ hashFiles('**/install.sh') }}
- name: Run toolkit tests without cache
if: steps.cache-python-deps.outputs.cache-hit != 'true'
run: |
echo "Restore cache failed, running regular installation and testing..."
export ROS_DISTRO=noetic
export OPENDR_HOME=$PWD
echo "Running full OpenDR installation"
./bin/install.sh
source bin/activate.sh
python3 -m pip install -r tests/requirements.txt
if [ ${{ matrix.package }} = "ctests" ]; then
make ctests
else
if [[ ${{ matrix.package }} == "control/mobile_manipulation" || ${{ matrix.package }} == "planning/end_to_end_planning" ]]; then
source tests/sources/tools/control/mobile_manipulation/run_ros.sh
fi
echo "Running unittest discover for ${{ matrix.package }}"
python3 -m unittest discover -s tests/sources/tools/${{ matrix.package }}
fi
- name: Run toolkit tests with cache
if: steps.cache-python-deps.outputs.cache-hit == 'true'
run: |
export ROS_DISTRO=noetic
export OPENDR_HOME=$PWD
export OPENDR_DEVICE=cpu
# Reinstall some system dependencies
echo "Installing system dependencies"
sudo apt-get update
sudo apt-get install --yes unzip libfreetype6-dev lsb-release git python3-pip curl wget python3.8-venv ffmpeg
sudo apt-get install --yes libopenblas-dev libsndfile1 libboost-dev
source bin/activate.sh
echo "OpenDR env activated, running retinaface make"
# This should probably run conditionally for tools that need it
cd $OPENDR_HOME/src/opendr/perception/object_detection_2d/retinaface
make
cd $OPENDR_HOME
if [ ${{ matrix.package }} = "ctests" ]; then
make ctests
else
if [[ ${{ matrix.package }} == "control/mobile_manipulation" || ${{ matrix.package }} == "planning/end_to_end_planning" || ${{ matrix.package }} == "control/multi_object_search" ]]; then
echo "ROS $ROS_DISTRO Installation"
echo "Adding ROS repositories keys"
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' \
&& curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
# ROS package dependencies
if [[ ${ROS_DISTRO} == "noetic" || ${ROS_DISTRO} == "melodic" ]]; then
echo "Installing ROS dependencies"
sudo apt-get -y install ros-$ROS_DISTRO-vision-msgs ros-$ROS_DISTRO-geometry-msgs ros-$ROS_DISTRO-sensor-msgs ros-$ROS_DISTRO-audio-common-msgs ros-$ROS_DISTRO-hri-msgs ros-$ROS_DISTRO-usb-cam ros-$ROS_DISTRO-webots-ros
fi
# ROS2 package dependencies
if [[ ${ROS_DISTRO} == "foxy" || ${ROS_DISTRO} == "humble" ]]; then
echo "Installing ROS2 dependencies"
sudo apt-get -y install python3-lark ros-$ROS_DISTRO-usb-cam ros-$ROS_DISTRO-webots-ros2 python3-colcon-common-extensions ros-$ROS_DISTRO-vision-msgs ros-$ROS_DISTRO-sensor-msgs-py
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ros/$ROS_DISTRO/lib/controller
cd $OPENDR_HOME/projects/opendr_ws_2/
git clone --depth 1 --branch ros2 https://github.com/ros-drivers/audio_common src/audio_common
rosdep install -i --from-path src/audio_common --rosdistro $ROS_DISTRO -y
cd $OPENDR_HOME
fi
# Install libegl required by multi-object search
if [ ${{ matrix.package}} == "control/multi_object_search" ]; then
echo "Installing libegl1 for multi-object search"
sudo apt install libegl1-mesa-dev
fi
# Make and run mobile manipulation test
# End-to-end planning requires mobile manipulation to run
if [[ ${{ matrix.package }} == "control/mobile_manipulation" || ${{ matrix.package }} == "planning/end_to_end_planning" ]]; then
echo "Installing mobile manipulation"
cd src/opendr/control/mobile_manipulation/
make
cd ../../../..
echo "Running mobile manipulation test"
source tests/sources/tools/control/mobile_manipulation/run_ros.sh
fi
fi
echo "Running unittest discover for ${{ matrix.package }}"
python3 -m unittest discover -s tests/sources/tools/${{ matrix.package }}
fi
build-wheel:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test release') || github.event_name == 'schedule' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install prerequisites
run: |
python3 -m pip install --upgrade pip
python3 -m pip install setuptools wheel twine
- name: Build Wheel
run:
./bin/build_wheel.sh
- name: Upload wheel as artifact
uses: actions/upload-artifact@v2
with:
name: wheel-artifact
path:
dist/*.tar.gz
build-docker:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test release') || github.event_name == 'schedule' }}
runs-on: ubuntu-20.04
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@v1.3.1
- uses: actions/checkout@v3
with:
submodules: true
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Build image
run: |
docker build --no-cache --tag opendr/opendr-toolkit:cpu_test --build-arg branch=${{ steps.branch-name.outputs.current_branch }} --build-arg ros_distro=noetic --file Dockerfile .
docker save opendr/opendr-toolkit:cpu_test > cpu_test.zip
- name: Upload image artifact
uses: actions/upload-artifact@v2
with:
name: docker-artifact
path:
cpu_test.zip
test-wheel:
needs: build-wheel
if: ${{ contains(github.event.pull_request.labels.*.name, 'test release') || github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
package:
- engine
- utils
- perception/activity_recognition
- perception/compressive_learning
- perception/face_recognition
- perception/heart_anomaly_detection
- perception/multimodal_human_centric
- perception/pose_estimation
- perception/fall_detection
- perception/gesture_recognition
- perception/speech_recognition
- perception/skeleton_based_action_recognition/costgcn
- perception/skeleton_based_action_recognition/pstgcn
- perception/skeleton_based_action_recognition/stbln
- perception/skeleton_based_action_recognition/stgcn
- perception/skeleton_based_action_recognition/tagcn
- perception/semantic_segmentation
- perception/binary_high_resolution
- perception/object_tracking_2d
# - perception/object_tracking_3d # passes, but disabled due to free() crash
- perception/object_detection_2d/centernet
- perception/object_detection_2d/detr
- perception/object_detection_2d/gem
- perception/object_detection_2d/ssd
- perception/object_detection_2d/nanodet
- perception/object_detection_2d/yolov3
- perception/object_detection_2d/yolov5
- perception/object_detection_2d/retinaface
- perception/object_detection_2d/nms
- perception/speech_transcription/vosk
- perception/speech_transcription/whisper
# - perception/object_detection_3d # passes, but disabled due to free() crash
- perception/facial_expression_recognition
- simulation/human_model_generation
#- control/multi_object_search
#- control/mobile_manipulation
#- control/single_demo_grasp
#- planning/end_to_end_planning
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: artifact
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Test Wheel
run: |
export OPENDR_HOME=$PWD
export DISABLE_BCOLZ_AVX2=true
export OPENDR_DEVICE=cpu
export PYTHONPATH=$OPENDR_HOME/src:$PYTHONPATH
export ROS_DISTRO=noetic
sudo apt-get update
sudo apt -y install python3.8-venv libfreetype6-dev git build-essential cmake python3-dev wget libopenblas-dev libsndfile1 libboost-dev python3-dev python3-six ffmpeg
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install wheel==0.38.4 six
# install all tools one at a time
while read f; do
package=$(sed "s/_/-/g" <<< $f)
package=(${package//// })
if [ ! -z ${package[1]} ]; then package=${package[1]}; fi
if [ "$package" != "opendr" ]; then
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-$package-*.tar.gz
fi
done < packages.txt
cd src/opendr/perception/object_detection_2d/retinaface; make; cd $OPENDR_HOME
# run the test
python3 -m unittest discover -s tests/sources/tools/${{ matrix.package }}
test-wheel-separate:
needs: build-wheel
if: ${{ contains(github.event.pull_request.labels.*.name, 'test release') || github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
package:
- engine
- utils
- perception/activity_recognition
- perception/compressive_learning
- perception/face_recognition
- perception/heart_anomaly_detection
- perception/multimodal_human_centric
- perception/pose_estimation
- perception/fall_detection
- perception/gesture_recognition
- perception/speech_recognition
- perception/skeleton_based_action_recognition/costgcn
- perception/skeleton_based_action_recognition/pstgcn
- perception/skeleton_based_action_recognition/stbln
- perception/skeleton_based_action_recognition/stgcn
- perception/skeleton_based_action_recognition/tagcn
- perception/semantic_segmentation
- perception/binary_high_resolution
- perception/object_tracking_2d
# - perception/object_tracking_3d # passes, but disabled due to free() crash
- perception/object_detection_2d/centernet
- perception/object_detection_2d/detr
- perception/object_detection_2d/gem
- perception/object_detection_2d/ssd
- perception/object_detection_2d/nanodet
- perception/object_detection_2d/yolov3
- perception/object_detection_2d/yolov5
- perception/object_detection_2d/retinaface
- perception/object_detection_2d/nms
- perception/speech_transcription/vosk
- perception/speech_transcription/whisper
# - perception/object_detection_3d # passes, but disabled due to free() crash
- perception/facial_expression_recognition
- simulation/human_model_generation
#- control/multi_object_search
#- control/mobile_manipulation
#- control/single_demo_grasp
#- planning/end_to_end_planning
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: artifact
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Test Wheel Separate
run: |
export OPENDR_HOME=$PWD
export DISABLE_BCOLZ_AVX2=true
export OPENDR_DEVICE=cpu
export ROS_DISTRO=noetic
sudo apt-get update
sudo apt -y install python3.8-venv libfreetype6-dev git build-essential cmake python3-dev wget libopenblas-dev libsndfile1 libboost-dev libeigen3-dev python3-dev python3-six ffmpeg
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install wheel==0.38.4 six
# get the name of the wheel to install based on the test being run
package=$(sed "s/_/-/g" <<< ${{ matrix.package }})
package=(${package//// })
if [ ! -z ${package[1]} ]; then package=${package[1]}; fi
# all packages require the engine
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-engine-*.tar.gz
# install specific package
if [ ${{ matrix.package }} == "utils" ]; then
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-hyperparameter-tuner-*.tar.gz
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-ambiguity-measure-*.tar.gz
else
# install required dependencies for derived tools, we do so manually to ensure the local one is used
if [ ${{ matrix.package }} == "perception/fall_detection" ]; then
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-pose-estimation-*.tar.gz
elif [ ${{ matrix.package }} == "perception/heart_anomaly_detection" ]; then
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-compressive-learning-*.tar.gz
elif [ ${{ matrix.package }} == "perception/gesture_recognition" ]; then
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-object-detection-2d-*.tar.gz
elif [ ${{ matrix.package }} == "perception/multimodal_human_centric" ]; then
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-compressive-learning-*.tar.gz
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-object-detection-2d-*.tar.gz
elif [ ${{ matrix.package }} == "perception/object_tracking_3d" ]; then
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-object-detection-3d-*.tar.gz
fi
# install the package itself
python3 -m pip install --find-links ./artifact/wheel-artifact/ ./artifact/wheel-artifact/opendr-toolkit-$package-*.tar.gz
fi
if [[ ${{ matrix.package }} == "perception/object_detection_2d/retinaface" ]]; then
cd src/opendr/perception/object_detection_2d/retinaface; make; cd $OPENDR_HOME
fi
# run the test
python3 -m unittest discover -s tests/sources/tools/${{ matrix.package }}
test-docker:
needs: build-docker
if: ${{ contains(github.event.pull_request.labels.*.name, 'test release') || github.event_name == 'schedule' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
package:
- engine
- utils
- perception/activity_recognition
- perception/compressive_learning
- perception/face_recognition
- perception/heart_anomaly_detection
- perception/multimodal_human_centric
- perception/pose_estimation
- perception/fall_detection
- perception/gesture_recognition
- perception/speech_recognition
- perception/skeleton_based_action_recognition/costgcn
- perception/skeleton_based_action_recognition/pstgcn
- perception/skeleton_based_action_recognition/stbln
- perception/skeleton_based_action_recognition/stgcn
- perception/skeleton_based_action_recognition/tagcn
- perception/semantic_segmentation
- perception/binary_high_resolution
- perception/object_tracking_2d
# - perception/object_tracking_3d # passes, but disabled due to free() crash
- perception/object_detection_2d/centernet
- perception/object_detection_2d/detr
- perception/object_detection_2d/gem
- perception/object_detection_2d/ssd
- perception/object_detection_2d/nanodet
- perception/object_detection_2d/yolov3
- perception/object_detection_2d/yolov5
- perception/object_detection_2d/retinaface
- perception/object_detection_2d/nms
- perception/speech_transcription/vosk
- perception/speech_transcription/whisper
# - perception/object_detection_3d # passes, but disabled due to free() crash
- perception/facial_expression_recognition
- simulation/human_model_generation
- control/mobile_manipulation
# - control/single_demo_grasp
- planning/end_to_end_planning
# - control/multi_object_search # needs CUDA Docker container
runs-on: ubuntu-20.04
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@v1.3.1
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: artifact
- name: Test docker
run: |
docker load < ./artifact/docker-artifact/cpu_test.zip
docker run --name toolkit -i opendr/opendr-toolkit:cpu_test bash
docker start toolkit
if [[ ${{ matrix.package }} == "control/mobile_manipulation" || ${{ matrix.package }} == "planning/end_to_end_planning" ]]; then
docker exec -i toolkit bash -c "source bin/activate.sh && source tests/sources/tools/control/mobile_manipulation/run_ros.sh && python3 -m unittest discover -s tests/sources/tools/${{ matrix.package }}"
else
docker exec -i toolkit bash -c "source bin/activate.sh && python3 -m unittest discover -s tests/sources/tools/${{ matrix.package }}"
fi
delete-docker-artifacts:
needs: [build-docker, test-docker]
if: ${{ always() }}
strategy:
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Delete docker artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: docker-artifact
delete-wheel-artifacts:
needs: [build-wheel, test-wheel, test-wheel-separate]
if: ${{ always() }}
strategy:
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Delete wheel artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: wheel-artifact