|
| 1 | +name: CI of CentroidalControlCollection (colcon) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - '**' |
| 10 | + |
| 11 | +jobs: |
| 12 | + |
| 13 | + clang-format: |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + steps: |
| 16 | + - name: Checkout repository code |
| 17 | + uses: actions/checkout@v3 |
| 18 | + - name: Install clang-format-14 |
| 19 | + run: | |
| 20 | + sudo apt-get -qq update |
| 21 | + sudo apt-get -qq install clang-format-14 |
| 22 | + - name: Run clang-format-check |
| 23 | + run: | |
| 24 | + ./.clang-format-check.sh |
| 25 | +
|
| 26 | + build-and-test: |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + os: [ubuntu-22.04] |
| 31 | + build-type: [RelWithDebInfo] |
| 32 | + standalone: [colcon] |
| 33 | + runs-on: ${{ matrix.os }} |
| 34 | + steps: |
| 35 | + - name: Set environment variables |
| 36 | + run: | |
| 37 | + set -e |
| 38 | + set -x |
| 39 | + echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV |
| 40 | + if [ "${{ matrix.os }}" == "ubuntu-22.04" ] && \ |
| 41 | + [ "${{ matrix.build-type }}" == "RelWithDebInfo" ] && \ |
| 42 | + [ "${{ matrix.standalone }}" == "colcon" ] && \ |
| 43 | + [ "${{ github.repository_owner }}" == "isri-aist" ] && \ |
| 44 | + [ "${{ github.ref }}" == "refs/heads/master" ] |
| 45 | + then |
| 46 | + echo "UPLOAD_DOCUMENTATION=true" >> $GITHUB_ENV |
| 47 | + sudo apt-get install -qq doxygen graphviz |
| 48 | + else |
| 49 | + echo "UPLOAD_DOCUMENTATION=false" >> $GITHUB_ENV |
| 50 | + fi |
| 51 | + - name: Install ROS2 |
| 52 | + if: matrix.standalone == 'colcon' |
| 53 | + uses: jrl-umi3218/github-actions/install-dependencies@master |
| 54 | + with: |
| 55 | + ros: | |
| 56 | + apt: ros-base |
| 57 | + - name: Install Dependencies |
| 58 | + uses: jrl-umi3218/github-actions/install-dependencies@master |
| 59 | + with: |
| 60 | + build-type: ${{ matrix.build-type }} |
| 61 | + ubuntu: | |
| 62 | + apt-mirrors: |
| 63 | + mc-rtc: |
| 64 | + cloudsmith: mc-rtc/head |
| 65 | + apt: libgtest-dev libeigen-qld-dev libmc-rtc-dev |
| 66 | +
|
| 67 | + - name: Checkout repository code |
| 68 | + uses: actions/checkout@v3 |
| 69 | + with: |
| 70 | + path: colcon_ws/src/CentroidalControlCollection |
| 71 | + - name: Checkout QpSolverCollection |
| 72 | + uses: actions/checkout@v3 |
| 73 | + with: |
| 74 | + repository: isri-aist/QpSolverCollection |
| 75 | + path: colcon_ws/src/QpSolverCollection |
| 76 | + - name: Checkout ForceControlCollection |
| 77 | + uses: actions/checkout@v3 |
| 78 | + with: |
| 79 | + repository: isri-aist/ForceControlCollection |
| 80 | + path: colcon_ws/src/ForceControlCollection |
| 81 | + - name: Checkout NMPC |
| 82 | + uses: actions/checkout@v3 |
| 83 | + with: |
| 84 | + repository: isri-aist/NMPC |
| 85 | + submodules: recursive |
| 86 | + path: colcon_ws/src/NMPC |
| 87 | + - name: Rosdep install |
| 88 | + run: | |
| 89 | + set -e |
| 90 | + set -x |
| 91 | + cd ${GITHUB_WORKSPACE}/colcon_ws |
| 92 | + if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ] |
| 93 | + then |
| 94 | + sudo rosdep init |
| 95 | + fi |
| 96 | + rosdep update |
| 97 | + rosdep install -y -r --from-paths src --ignore-src |
| 98 | + - name: Colcon build |
| 99 | + run: | |
| 100 | + set -e |
| 101 | + set -x |
| 102 | + cd ${GITHUB_WORKSPACE}/colcon_ws |
| 103 | + colcon build --merge-install --cmake-args -DUSE_ROS2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DENABLE_QLD=ON -DINSTALL_DOCUMENTATION=${{ env.UPLOAD_DOCUMENTATION }} |
| 104 | + - name: Run tests |
| 105 | + run: | |
| 106 | + set -e |
| 107 | + set -x |
| 108 | + cd ${GITHUB_WORKSPACE}/colcon_ws |
| 109 | + set +x |
| 110 | + . install/setup.bash |
| 111 | + set -x |
| 112 | + colcon test --merge-install --packages-select centroidal_control_collection |
| 113 | + colcon test-result --all --verbose |
| 114 | + - name: Upload documentation |
| 115 | + # Only run for one configuration and on origin master branch |
| 116 | + if: env.UPLOAD_DOCUMENTATION == 'true' |
| 117 | + run: | |
| 118 | + set -e |
| 119 | + set -x |
| 120 | + cd ${GITHUB_WORKSPACE}/colcon_ws/src/${{ github.repository }} |
| 121 | + git config --global user.name "Masaki Murooka" |
| 122 | + git config --global user.email "m-murooka@aist.go.jp" |
| 123 | + git remote set-url origin "https://mmurooka:${{ secrets.CI_TOKEN }}@github.com/isri-aist/CentroidalControlCollection" |
| 124 | + git fetch --depth=1 origin gh-pages:gh-pages |
| 125 | + git checkout --quiet gh-pages |
| 126 | + rm -rf doxygen/ cmake/ |
| 127 | + cp -r ${GITHUB_WORKSPACE}/colcon_ws/build/centroidal_control_collection/doc/html/ doxygen |
| 128 | + git add doxygen |
| 129 | + git_status=`git status -s` |
| 130 | + if test -n "$git_status"; then |
| 131 | + git commit --quiet -m "Update Doxygen HTML files from commit ${{ github.sha }}" |
| 132 | + git push origin gh-pages |
| 133 | + else |
| 134 | + echo "Github pages documentation is already up-to-date." |
| 135 | + fi |
0 commit comments