CI of NMPC (catkin) #93
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
name: CI of NMPC (catkin) | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
clang-format: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Install clang-format-10 | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq install clang-format-10 | |
- name: Run clang-format-check | |
run: | | |
./.clang-format-check.sh | |
build-and-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
build-type: [Debug, RelWithDebInfo, Release] | |
include: | |
- build-type: Debug | |
optimize-for-native: OFF | |
- build-type: RelWithDebInfo | |
optimize-for-native: OFF | |
- build-type: Release | |
optimize-for-native: ON | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set ROS version | |
run: | | |
if [ "${{ matrix.os }}" == "ubuntu-20.04" ] | |
then | |
echo "ROS_DISTRO=noetic" >> $GITHUB_ENV | |
echo "PYTHON_PACKAGE_PREFIX=python3" >> $GITHUB_ENV | |
else # if [ "${{ matrix.os }}" == "ubuntu-18.04" ] | |
echo "ROS_DISTRO=melodic" >> $GITHUB_ENV | |
echo "PYTHON_PACKAGE_PREFIX=python" >> $GITHUB_ENV | |
fi | |
- name: Install ROS | |
run: | | |
set -e | |
set -x | |
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' | |
wget http://packages.ros.org/ros.key -O - | sudo apt-key add - | |
sudo apt-get update -qq | |
sudo apt-get install -qq ros-${ROS_DISTRO}-ros-base ${PYTHON_PACKAGE_PREFIX}-catkin-tools ${PYTHON_PACKAGE_PREFIX}-rosdep doxygen | |
- name: Setup catkin workspace | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE}/catkin_ws/src/ | |
cd ${GITHUB_WORKSPACE}/catkin_ws | |
. /opt/ros/${ROS_DISTRO}/setup.bash | |
catkin init | |
catkin build --limit-status-rate 0.1 | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
path: catkin_ws/src/NMPC | |
- name: Rosdep install | |
run: | | |
set -e | |
set -x | |
cd ${GITHUB_WORKSPACE}/catkin_ws | |
. devel/setup.bash | |
sudo rosdep init | |
rosdep update | |
rosdep install -y -r --from-paths src --ignore-src | |
- name: Catkin build | |
run: | | |
set -e | |
set -x | |
cd ${GITHUB_WORKSPACE}/catkin_ws | |
. devel/setup.bash | |
catkin build nmpc --limit-status-rate 0.1 -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ | |
-DOPTIMIZE_FOR_NATIVE=${{ matrix.optimize-for-native }} -DINSTALL_DOCUMENTATION=ON | |
- name: Run tests | |
run: | | |
set -e | |
set -x | |
cd ${GITHUB_WORKSPACE}/catkin_ws | |
. devel/setup.bash | |
catkin build --limit-status-rate 0.1 --catkin-make-args run_tests -- nmpc --no-deps | |
catkin_test_results --verbose --all build | |
- name: Upload documentation | |
# Only run for one configuration and on origin master branch | |
if: matrix.os == 'ubuntu-20.04' && matrix.build-type == 'RelWithDebInfo' && github.repository_owner == 'isri-aist' && github.ref == 'refs/heads/master' | |
run: | | |
set -e | |
set -x | |
cd ${GITHUB_WORKSPACE}/catkin_ws/src/NMPC | |
git config --global user.name "Masaki Murooka" | |
git config --global user.email "[email protected]" | |
git remote set-url origin "https://mmurooka:${{ secrets.CI_TOKEN }}@github.com/isri-aist/NMPC" | |
git fetch --depth=1 origin gh-pages:gh-pages | |
git checkout --quiet gh-pages | |
rm -rf nmpc_ddp/ nmpc_fmpc/ nmpc_cgmres/ cmake/ | |
cp -r ${GITHUB_WORKSPACE}/catkin_ws/build/nmpc_ddp/doc/html/ nmpc_ddp | |
cp -r ${GITHUB_WORKSPACE}/catkin_ws/build/nmpc_fmpc/doc/html/ nmpc_fmpc | |
cp -r ${GITHUB_WORKSPACE}/catkin_ws/build/nmpc_cgmres/doc/html/ nmpc_cgmres | |
git add nmpc_ddp nmpc_fmpc nmpc_cgmres | |
git_status=`git status -s` | |
if test -n "$git_status"; then | |
git commit --quiet -m "Update Doxygen HTML files from commit ${{ github.sha }}" | |
git push origin gh-pages | |
else | |
echo "Github pages documentation is already up-to-date." | |
fi |