CI refactor #9126
This file contains hidden or 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 config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). | |
| # For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) | |
| name: CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| merge_group: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| default: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| env: | |
| - IMAGE: rolling-ci | |
| CCOV: true | |
| ROS_DISTRO: rolling | |
| - IMAGE: rolling-ci | |
| ROS_DISTRO: rolling | |
| IKFAST_TEST: true | |
| CLANG_TIDY: pedantic | |
| - IMAGE: humble-ci | |
| ROS_DISTRO: humble | |
| - IMAGE: jazzy-ci | |
| ROS_DISTRO: jazzy | |
| env: | |
| # TODO(andyz): When this clang-tidy issue is fixed, remove -Wno-unknown-warning-option | |
| # https://stackoverflow.com/a/41673702 | |
| CXXFLAGS: >- | |
| -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-unknown-warning-option | |
| # Changing linker to lld as ld has a behavior where it takes a long time to finish | |
| CMAKE_EXE_LINKER_FLAGS: -fuse-ld=lld | |
| CMAKE_SHARED_LINKER_FLAGS: -fuse-ld=lld | |
| CMAKE_MODULE_LINKER_FLAGS: -fuse-ld=lld | |
| # Compile CCOV with Debug. Enable -Werror. | |
| CMAKE_BUILD_TYPE: ${{ matrix.env.CCOV && 'Debug' || 'Release'}} | |
| CMAKE_CXX_FLAGS: "-Werror $CXXFLAGS${{ matrix.env.CCOV && ' --coverage -O2 -fno-omit-frame-pointer' || ''}}" | |
| CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| BASEDIR: ${{ github.workspace }}/.work | |
| CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }} | |
| CC: ${{ matrix.env.CLANG_TIDY && 'clang' }} | |
| CXX: ${{ matrix.env.CLANG_TIDY && 'clang++' }} | |
| ADDITIONAL_DEBS: lld | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| name: ${{ matrix.env.IMAGE }}${{ 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-latest | |
| container: moveit/moveit2:${{ matrix.env.IMAGE }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # checkout into a "src" directory so we look like a ROS workspace | |
| path: src | |
| - name: Get latest release date for rosdistro | |
| id: rosdistro_release_date | |
| uses: JafarAbdi/latest-rosdistro-release-date-action@main | |
| with: | |
| rosdistro: ${{ matrix.env.ROS_DISTRO }} | |
| - name: Cache build | |
| uses: rhaschke/cache@main | |
| with: | |
| path: ${{ env.BASEDIR }}/build | |
| key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }} | |
| restore-keys: ${{ env.CACHE_PREFIX }} | |
| env: | |
| GHA_CACHE_SAVE: always | |
| CACHE_PREFIX: build${{ 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' || '' }} | |
| - name: Configure ccache and rezero its stats | |
| run: ccache --zero-stats --max-size 10.0G | |
| - name: vcs import | |
| run: vcs import < moveit2.repos | |
| working-directory: src | |
| - name: Generate ikfast packages | |
| if: matrix.env.IKFAST_TEST | |
| run: moveit_kinematics/test/test_ikfast_plugins.sh | |
| working-directory: src | |
| - name: Build workspace | |
| run: source /opt/ros/${{ matrix.env.ROS_DISTRO }}/setup.bash && colcon build | |
| - name: Test workspace | |
| run: source /opt/ros/${{ matrix.env.ROS_DISTRO }}/setup.bash && colcon test --return-code-on-test-failure | |
| - name: Show failed tests | |
| if: failure() | |
| run: colcon test-result | |
| - name: clang-tidy | |
| if: matrix.env.CLANG_TIDY | |
| run: run-clang-tidy -p build/ src | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v5 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.env.IMAGE }} | |
| path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml | |
| overwrite: true | |
| - name: Generate codecov report | |
| uses: rhaschke/lcov-action@main | |
| if: always() && matrix.env.CCOV | |
| with: | |
| workdir: ${{ env.BASEDIR }}/target_ws | |
| lcov_capture_args: --ignore-errors=gcov,gcov,mismatch,mismatch,negative,negative | |
| ignore: '"build/*" "install/*" "*/test/*"' | |
| - name: Upload codecov report | |
| uses: codecov/codecov-action@v5 | |
| if: always() && matrix.env.CCOV | |
| with: | |
| files: ${{ env.BASEDIR }}/coverage.info | |
| - name: SonarQube Scan | |
| # Don't run if SONAR_TOKEN is not set (i.e. PR job from a fork) | |
| if: matrix.env.CCOV && env.SONAR_TOKEN != '' | |
| uses: SonarSource/[email protected] | |
| with: | |
| projectBaseDir: ${{ env.BASEDIR }}/target_ws | |
| docker: | |
| uses: ./.github/workflows/docker.yaml | |
| docker_lint: | |
| uses: ./.github/workflows/docker_lint.yaml | |
| format: | |
| uses: ./.github/workflows/format.yaml | |
| tutorial_docker: | |
| uses: ./.github/workflows/tutorial_docker.yaml |