-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
247 additions
and
0 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,161 @@ | ||
name: Dry-Run | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * MON' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: '[${{ matrix.os }}@${{ matrix.build_type }}]' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
build_type: [Release] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@main | ||
with: | ||
ref: devel | ||
|
||
# Remove apt repos that are known to break from time to time | ||
# See https://github.com/actions/virtual-environments/issues/323 | ||
- name: Remove broken apt repos | ||
run: | | ||
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done | ||
# ============ | ||
# DEPENDENCIES | ||
# ============ | ||
- name: Dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install git build-essential cmake libace-dev libtinyxml-dev coinor-libipopt-dev libeigen3-dev libgsl-dev \ | ||
xmlstarlet zip | ||
- name: Determine Source-based Dependencies required versions | ||
shell: bash | ||
run: | | ||
cd ${GITHUB_WORKSPACE}/.. | ||
git clone https://github.com/robotology/icub-main.git --depth 1 --branch devel | ||
cd icub-main | ||
grep -m 1 YCM_REQUIRED_VERSION CMakeLists.txt | sed "s/[^0-9.]//g" >> YCM_VERSION.txt | ||
grep -m 1 YARP_REQUIRED_VERSION CMakeLists.txt | sed "s/[^0-9.]//g" >> YARP_VERSION.txt | ||
echo "ycm_version=$(cat YCM_VERSION.txt)" >> $GITHUB_ENV | ||
echo "yarp_version=$(cat YARP_VERSION.txt)" >> $GITHUB_ENV | ||
grep -m 1 icub_firmware_shared_VERSION conf/iCubFindDependencies.cmake | sed "s/[^0-9.]//g" >> icub_firmware_shared_VERSION.txt | ||
gh --repo robotology/icub-firmware-shared release list >> icub_firmware_shared_RELEASES.txt | ||
if grep -q $(cat icub_firmware_shared_VERSION.txt) icub_firmware_shared_RELEASES.txt; then | ||
echo "icub_firmware_shared_branch=v$(cat icub_firmware_shared_VERSION.txt)" >> $GITHUB_ENV | ||
else | ||
echo "icub_firmware_shared_branch=devel" >> $GITHUB_ENV | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Source-based Dependencies | ||
shell: bash | ||
run: | | ||
# ycm | ||
cd ${GITHUB_WORKSPACE}/.. | ||
git clone https://github.com/robotology/ycm.git --depth 1 --branch v${{ env.ycm_version }} | ||
cd ycm && mkdir -p build && cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | ||
cmake --build . --config ${{ matrix.build_type }} --target install | ||
# yarp | ||
cd ${GITHUB_WORKSPACE}/.. | ||
git clone https://github.com/robotology/yarp.git --depth 1 --branch v${{ env.yarp_version }} | ||
cd yarp && mkdir -p build && cd build | ||
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ | ||
-DYARP_COMPILE_DEVICE_PLUGINS:BOOL=ON -DYARP_COMPILE_CARRIER_PLUGINS:BOOL=OFF -DYARP_COMPILE_PORTMONITOR_PLUGINS:BOOL=OFF -DYARP_COMPILE_EXECUTABLES:BOOL=ON .. | ||
cmake --build . --config ${{ matrix.build_type }} --target install | ||
# icub-firmware-shared | ||
cd ${GITHUB_WORKSPACE}/.. | ||
git clone https://github.com/robotology/icub-firmware-shared.git --depth 1 --branch ${{ env.icub_firmware_shared_branch }} | ||
cd icub-firmware-shared && mkdir -p build && cd build | ||
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | ||
cmake --build . --config ${{ matrix.build_type }} --target install | ||
# icub-main | ||
cd ${GITHUB_WORKSPACE}/.. | ||
cd icub-main && mkdir -p build && cd build | ||
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ | ||
-DBUILD_SHARED_LIBS:BOOL=OFF \ | ||
-DICUB_USE_icub_firmware_shared:BOOL=ON \ | ||
-DENABLE_icubmod_skinWrapper:BOOL=ON \ | ||
-DENABLE_icubmod_sharedcan:BOOL=ON \ | ||
-DENABLE_icubmod_canmotioncontrol:BOOL=ON \ | ||
-DENABLE_icubmod_canBusAnalogSensor:BOOL=ON \ | ||
-DENABLE_icubmod_canBusInertialMTB:BOOL=ON \ | ||
-DENABLE_icubmod_canBusSkin:BOOL=ON \ | ||
-DENABLE_icubmod_canBusVirtualAnalogSensor:BOOL=ON \ | ||
-DENABLE_icubmod_embObjFTsensor:BOOL=ON \ | ||
-DENABLE_icubmod_embObjIMU:BOOL=ON \ | ||
-DENABLE_icubmod_embObjInertials:BOOL=ON \ | ||
-DENABLE_icubmod_embObjMais:BOOL=ON \ | ||
-DENABLE_icubmod_embObjMotionControl:BOOL=ON \ | ||
-DENABLE_icubmod_embObjBattery:BOOL=ON \ | ||
-DENABLE_icubmod_embObjSkin:BOOL=ON \ | ||
-DENABLE_icubmod_embObjStrain:BOOL=ON \ | ||
-DENABLE_icubmod_embObjMultipleFTsensors:BOOL=ON \ | ||
-DENABLE_icubmod_parametricCalibrator:BOOL=ON \ | ||
-DENABLE_icubmod_parametricCalibratorEth:BOOL=ON \ | ||
-DENABLE_icubmod_cartesiancontrollerserver:BOOL=ON .. | ||
cmake --build . --config ${{ matrix.build_type }} --target install | ||
# icub-contrib-common | ||
cd ${GITHUB_WORKSPACE}/.. | ||
git clone https://github.com/robotology/icub-contrib-common.git --depth 1 | ||
cd icub-contrib-common && mkdir -p build && cd build | ||
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | ||
cmake --build . --config ${{ matrix.build_type }} --target install | ||
- name: Extend Path | ||
shell: bash | ||
run: | | ||
echo "${GITHUB_WORKSPACE}/install/bin" >> $GITHUB_PATH | ||
echo "YARP_DATA_DIRS=${GITHUB_WORKSPACE}/install/share/yarp:${GITHUB_WORKSPACE}/install/share/iCub:${GITHUB_WORKSPACE}/install/share/ICUBcontrib" >> $GITHUB_ENV | ||
# =================== | ||
# CMAKE-BASED PROJECT | ||
# =================== | ||
- name: Configure | ||
shell: bash | ||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install \ | ||
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ | ||
-DBUILD_TESTING:BOOL=ON \ | ||
-DINSTALL_ALL_ROBOTS:BOOL=ON .. | ||
- name: Build | ||
shell: bash | ||
run: | | ||
cd build | ||
cmake --build . --config ${{ matrix.build_type }} | ||
- name: Install | ||
shell: bash | ||
run: | | ||
cd build | ||
cmake --build . --config ${{ matrix.build_type }} --target install | ||
- name: Test | ||
shell: bash | ||
run: | | ||
cd build | ||
ctest --timeout 60 --output-on-failure | ||
zip -q dry-run_log.zip dry-run_log_*.txt | ||
- name: Upload Output | ||
uses: actions/upload-artifact@main | ||
with: | ||
name: dry-run | ||
path: dry-run_log.zip | ||
retention-days: 30 |
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
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,75 @@ | ||
#!/usr/bin/bash | ||
################################################################################ | ||
# # | ||
# Copyright (C) 2023 Fondazione Istitito Italiano di Tecnologia (IIT) # | ||
# All Rights Reserved. # | ||
# # | ||
################################################################################ | ||
|
||
# search for paths | ||
echo "Searching for required resources..." | ||
file_yri=$(YARP_ROBOT_NAME=$1 yarp resource --context yarprobotinterface --from yarprobotinterface.ini | tail -1 | sed 's/\"//g') | ||
dir_robot=$(dirname ${file_yri}) | ||
file_general=$(find ${dir_robot} -name "general.xml") | ||
file_pc104=$(find ${dir_robot} -name "pc104.xml") | ||
|
||
# skip if not enough info | ||
if [[ ! -f "${file_yri}" || ! -f "${file_general}" || ! -f "${file_pc104}" ]]; then | ||
echo "$1 robot doesn't contain the info required for performing dry-run → skipped!" | ||
exit 0 | ||
fi | ||
|
||
# prepare for dry-run | ||
echo "Preparing the robot..." | ||
xmlstarlet edit --inplace --update "/params/group/param[@name='skipCalibration']" --value 'true' ${file_general} | ||
xmlstarlet edit --inplace --delete "/params/group[@name='DEBUG']" ${file_pc104} | ||
xmlstarlet edit --inplace --subnode /params --type elem --name "group" --var new_node '$prev' \ | ||
--insert '$new_node' --type attr --name "name" --value 'DEBUG' ${file_pc104} | ||
xmlstarlet edit --inplace --subnode "/params/group[@name='DEBUG']" --type elem --name "param" --var new_node '$prev' \ | ||
--insert '$new_node' --type attr --name "name" --value 'embBoardsConnected' ${file_pc104} | ||
xmlstarlet edit --inplace --update "/params/group[@name='DEBUG']/param" --value '0' ${file_pc104} | ||
|
||
# perform dry-run | ||
echo "Starting yarpserver..." | ||
yarpserver --write --silent & | ||
yarp wait /root | ||
|
||
echo "Starting yarprobotinterface..." | ||
log_file=dry-run_log_$1.txt | ||
YARP_ROBOT_NAME=$1 yarprobotinterface > ${log_file} 2>&1 & | ||
|
||
# robot_port may not be opened → we cannot use `yarp wait` | ||
robot_port=/$1/yarprobotinterface | ||
echo "Checking the existence of ${robot_port}..." | ||
for i in {1..5} | ||
do | ||
if yarp exists ${robot_port}; then | ||
echo "${robot_port} is active" | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
|
||
echo "Checking shutdown condition..." | ||
while true | ||
do | ||
response=$(echo "get_phase" | yarp rpc ${robot_port}) | ||
if [[ "${response}" == *"run"* ]]; then | ||
echo "yarprobotinterface was running happily" | ||
break | ||
fi | ||
|
||
if ! pgrep yarprobotinterface > /dev/null; then | ||
echo "yarprobotinterface didn't run correctly" | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
|
||
# clean up | ||
echo "Cleaning up..." | ||
killall yarpserver | ||
|
||
# parse the log | ||
|
||
exit 0 |