Skip to content

Test action-ros-ci #13665

Test action-ros-ci

Test action-ros-ci #13665

Workflow file for this run

name: "Test action-ros-ci"
on:
pull_request:
push:
branches:
- master
- "releases/*"
schedule:
# Run the CI automatically twice per day to look for flakyness.
- cron: "0 */12 * * *"
defaults:
run:
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
pre_condition:
name: "Don't run scheduled jobs on forks"
runs-on: ubuntu-latest
if: ${{ (github.event_name != 'schedule') || (github.event_name == 'schedule' && github.repository == 'ros-tooling/action-ros-ci') }}
steps:
- run: 'true'
test_ros:
name: "Test ROS package"
runs-on: ubuntu-latest
needs: pre_condition
strategy:
fail-fast: false
matrix:
ros_distribution: # ROS 1 tests only run on Ubuntu
- melodic
- noetic
# Define the Docker image(s) associated with each ROS distribution.
# The include syntax allows additional variables to be defined, like
# docker_image in this case. See documentation:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build
#
# Platforms are defined in REP 3: https://ros.org/reps/rep-0003.html
include:
# Melodic Morenia (May 2018 - May 2023)
- docker_image: rostooling/setup-ros-docker:ubuntu-bionic-ros-melodic-ros-base-latest
ros_distribution: melodic
# Noetic Ninjemys (May 2020 - May 2025)
- docker_image: rostooling/setup-ros-docker:ubuntu-focal-ros-noetic-ros-base-latest
ros_distribution: noetic
container:
image: ${{ matrix.docker_image }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.6.0
with:
node-version: "16.x"
- run: .github/workflows/build-and-test.sh
- uses: ./
id: action-ros-ci
with:
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/ros_tutorials.repos"
package-name: roscpp_tutorials
target-ros1-distro: ${{ matrix.ros_distribution }}
- run: test -d "${{ steps.action-ros-ci.outputs.ros-workspace-directory-name }}/install/roscpp_tutorials"
name: "Check that roscpp_tutorials install directory is present"
test_ros2:
name: "Test ROS 2 packages in repository"
runs-on: ${{ matrix.os }}
needs: pre_condition
strategy:
fail-fast: false
matrix:
os: [macOS-latest, windows-2019]
ros_distribution: [foxy, humble]
env:
INSTALL_TYPE: ${{ matrix.os == 'windows-2019' && 'merged' || 'default' }}
INSTALL_PATH: ${{ matrix.os == 'windows-2019' && 'install/share' || 'install' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.6.0
with:
node-version: "16.x"
- run: .github/workflows/build-and-test.sh
- uses: ros-tooling/setup-ros@master
with:
required-ros-distributions: ${{ matrix.ros_distribution }}
- uses: ./
id: test_all_packages_in_repo
name: "Test all packages in single repo, default options"
with:
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_cpp_package.repos"
- name: "Check that osrf_testing_tools_cpp install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_all_packages_in_repo.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/osrf_testing_tools_cpp"
- name: "Check that test_osrf_testing_tools_cpp install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_all_packages_in_repo.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/test_osrf_testing_tools_cpp"
test_ros2_foxy_package_with_dependencies:
name: "Test ROS 2 foxy package with ROS dependencies"
runs-on: ubuntu-20.04
needs: pre_condition
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@master
with:
required-ros-distributions: foxy
- uses: ./
with:
package-name: rmw
target-ros2-distro: foxy
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_cpp_with_dependency.repos"
test_ros2_foxy_rosdep_skip_keys:
name: "Test with rosdep-skip-keys option"
runs-on: ubuntu-20.04
needs: pre_condition
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@master
with:
required-ros-distributions: foxy
# Skip installing test_depend dependency and verifies it isn't installed.
- uses: ./
with:
package-name: rmw
target-ros2-distro: foxy
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_cpp_with_dependency.repos"
extra-cmake-args: -DBUILD_TESTING=Off
skip-tests: true
rosdep-skip-keys: osrf_testing_tools_cpp
- name: Install dpkg
run: sudo apt -y install dpkg
- name: "Verify dependencies were skipped"
run: |
[[ $(dpkg -s ros-foxy-osrf-testing-tools-cpp) -eq 0 ]]
# Install dependencies as usual and verifies it is now installed.
- uses: ./
with:
package-name: rmw
target-ros2-distro: foxy
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_cpp_with_dependency.repos"
- name: "Verify dependencies weren't skipped"
run: |
dpkg -s ros-foxy-osrf-testing-tools-cpp
test_private_repo:
name: "Test with private repos"
runs-on: ubuntu-20.04
needs: pre_condition
# We don't have access to the secret token for the test repo on a fork
if: ${{ !github.event.repository.fork && !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@master
with:
required-ros-distributions: foxy
- uses: ./
with:
import-token: ${{ secrets.TOKEN_PRIVATE_REPO_TEST }}
package-name: simple_package
target-ros2-distro: foxy
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_private_repo.repos"
test_ros2_docker:
name: "ROS 2 Docker"
runs-on: ubuntu-latest
needs: pre_condition
strategy:
fail-fast: false
matrix:
ros_distribution:
- foxy
# - humble
# Define the Docker image(s) associated with each ROS distribution.
# The include syntax allows additional variables to be defined, like
# docker_image in this case. See documentation:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build
#
# Platforms are defined in REP 2000: https://ros.org/reps/rep-2000.html
include:
# Foxy Fitzroy (May 2020 - May 2023)
- docker_image: rostooling/setup-ros-docker:ubuntu-focal-ros-foxy-ros-base-latest
ros_distribution: foxy
# Humble Hawksbill (May 2022 - May 2027)
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
ros_distribution: humble
# Rolling Ridley (see REP 2002: https://www.ros.org/reps/rep-2002.html)
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
ros_distribution: rolling
container:
image: ${{ matrix.docker_image }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.6.0
with:
node-version: "16.x"
- run: .github/workflows/build-and-test.sh
- uses: ./
name: "Test rosdep installs from correct distro"
with:
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: .github/workflows/repo_file_for_test_rosdep_distro.repos
# test_msgs depends on test_interface_files, which should be installed by rosdep
# If the dependencies are installed for the wrong distribution, then the build should fail
package-name: test_msgs
# Verify that rosdep installed the required Debian package
- run: dpkg -s ros-${{ matrix.ros_distribution }}-test-interface-files
- uses: ./
id: test_all_packages_in_repo
name: "Test all packages in repo, default options"
with:
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_cpp_package.repos"
- run: test -d "${{ steps.test_all_packages_in_repo.outputs.ros-workspace-directory-name }}/install/osrf_testing_tools_cpp"
- run: test -d "${{ steps.test_all_packages_in_repo.outputs.ros-workspace-directory-name }}/install/test_osrf_testing_tools_cpp"
test_ros2_from_source:
name: "ROS 2 from source"
runs-on: ${{ matrix.os }}
needs: pre_condition
strategy:
fail-fast: false
matrix:
os: [macOS-latest, windows-2019, ubuntu-20.04, ubuntu-22.04]
ros_distribution: [foxy, humble, rolling]
exclude:
- os: ubuntu-22.04
ros_distribution: foxy
- os: ubuntu-20.04
ros_distribution: humble
- os: ubuntu-20.04
ros_distribution: rolling
env:
DISTRO_REPOS_URL: "https://raw.githubusercontent.com/ros2/ros2/${{ matrix.ros_distribution == 'rolling' && 'master' || matrix.ros_distribution }}/ros2.repos"
INSTALL_TYPE: ${{ matrix.os == 'windows-2019' && 'merged' || 'default' }}
INSTALL_PATH: ${{ matrix.os == 'windows-2019' && 'install/share' || 'install' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.6.0
with:
node-version: "16.x"
- run: .github/workflows/build-and-test.sh
- uses: ros-tooling/setup-ros@master
- uses: ./
id: test_single_package
name: "Test single package, default options"
with:
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ env.DISTRO_REPOS_URL }}
- name: "Check that ament_copyright install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_single_package.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/ament_copyright"
- uses: ./
id: test_multiple_packages
name: "Test multiple package, default options"
with:
package-name: ament_copyright ament_lint
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ env.DISTRO_REPOS_URL }}
- name: "Check that ament_copyright install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_multiple_packages.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/ament_copyright"
- name: "Check that ament_lint install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_multiple_packages.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/ament_lint"
- uses: ./
id: test_connext_dependency
name: "Test single package with Connext dependency, default options"
if: startsWith(matrix.os, 'ubuntu-')
with:
package-name: rmw_implementation
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ env.DISTRO_REPOS_URL }}
- run: test -d "${{ steps.test_connext_dependency.outputs.ros-workspace-directory-name }}/install/rmw_implementation"
name: "Check that rmw_implementation install directory is present"
if: startsWith(matrix.os, 'ubuntu-')
- uses: ./
id: test_mixin
name: "Test single package, with custom mixin"
with:
colcon-defaults: |
{
"build": {
"mixin": ["asan-gcc"]
}
}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ env.DISTRO_REPOS_URL }}
- name: "Check that ament_copyright install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_mixin.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/ament_copyright"
- uses: ./
id: test_repo
name: "Test single package, with custom repository file"
with:
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test.repos"
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
- name: "Check that ament_copyright install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_repo.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/ament_copyright"
- uses: ./
id: test_colcon_defaults
name: "Test single package, with colcon defaults"
with:
colcon-defaults: |
{
"build": {
"build-base": "build-custom"
}
}
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ env.DISTRO_REPOS_URL }}
- name: "Check that ament_copyright install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_colcon_defaults.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/ament_copyright"
- run: test -d "${{ steps.test_colcon_defaults.outputs.ros-workspace-directory-name }}/build-custom"
# The second repo file is ignored, but will get vcs-import'ed anyway.
# This test case just run basic testing on the action logic, making
# sure the for-loop is implemented correctly.
- uses: ./
id: test_multiple_repos
name: "Test single package, with multiple custom repository files"
with:
vcs-repo-file-url: |
.github/workflows/repo_file_for_test.repos
.github/workflows/repo_file_for_test_cpp_package.repos
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
- name: "Check that ament_copyright install directory is present in ${{ env.INSTALL_TYPE }} install space"
run: test -d "${{ steps.test_multiple_repos.outputs.ros-workspace-directory-name }}/${{ env.INSTALL_PATH }}/ament_copyright"
- run: test -d "${{ steps.test_multiple_repos.outputs.ros-workspace-directory-name }}/src/ament_lint"
- run: test -d "${{ steps.test_multiple_repos.outputs.ros-workspace-directory-name }}/src/osrf_testing_tools_cpp"
- uses: ./
id: test_coverage
name: "Test single package, with coverage enabled (Linux only)"
with:
colcon-defaults: |
{
"build": {
"mixin": ["coverage-gcc"]
}
}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
package-name: osrf_testing_tools_cpp
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_cpp_package.repos"
if: runner.os != 'Windows'
- run: find ${{ steps.test_coverage.outputs.ros-workspace-directory-name }}/build -name "*.gcda" | grep -q "."
name: "Check if one or more code coverage files (*.gcda) are present (Linux only)"
if: runner.os != 'Windows'
- uses: ./
id: test_extra_cmake
name: "Test single package, with extra cmake flags"
with:
package-name: ament_cmake_core
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test.repos"
# We use a long unique string here to make sure that if this string
# is found in CMakeCache.txt, it means the additional CMake flag has
# been passed successfully. Non recognized flags are also written by
# cmake into CMakeCache.txt, so this does not need to be a flag that
# really exists in this package.
extra-cmake-args: |
-DADDITIONAL_CMAKE_OPTION_FOR_TEST:STR="9ae391a63628efe6d72ba34a1a1d9dc9"
- run: grep -q 9ae391a63628efe6d72ba34a1a1d9dc9 ./${{ steps.test_extra_cmake.outputs.ros-workspace-directory-name }}/build/ament_cmake_core/CMakeCache.txt
name: "Check that the additional extra flags has been correctly passed"
- uses: ./
id: test_skip_tests
name: "Test single package, skip tests"
with:
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ env.DISTRO_REPOS_URL }}
skip-tests: true
- run: test -d "${{ steps.test_skip_tests.outputs.ros-workspace-directory-name }}/build/ament_copyright"
name: "Check that a build directory exists for ament_copyright"
- run: test ! -f "${{ steps.test_skip_tests.outputs.ros-workspace-directory-name }}/build/ament_copyright/colcon_test.rc"
name: "Check that 'colcon test' wasn't run on ament_copyright"
test_ros2_from_source_docker:
name: "Test ROS 2 from source Docker"
runs-on: ubuntu-latest
needs: pre_condition
strategy:
fail-fast: false
matrix:
ros_distribution:
- foxy
- humble
- rolling
# Define the Docker image(s) associated with each ROS distribution.
# The include syntax allows additional variables to be defined, like
# docker_image in this case. See documentation:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build
#
# Platforms are defined in REP 2000: https://ros.org/reps/rep-2000.html
include:
# Foxy Fitzroy (May 2020 - May 2023)
- docker_image: ubuntu:focal
ros_distribution: foxy
distro_repos_url: https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos
# Humble Hawksbill (May 2022 - May 2027)
- docker_image: ubuntu:jammy
ros_distribution: humble
distro_repos_url: https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos
# Rolling Ridley (see REP 2002: https://www.ros.org/reps/rep-2002.html)
- docker_image: ubuntu:jammy
ros_distribution: rolling
distro_repos_url: https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
container:
image: ${{ matrix.docker_image }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.6.0
with:
node-version: "16.x"
- run: .github/workflows/build-and-test.sh
- uses: ros-tooling/setup-ros@master
- uses: ./
id: test_single_package
name: "Test single package, default options"
with:
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ matrix.distro_repos_url }}
- run: test -d "${{ steps.test_single_package.outputs.ros-workspace-directory-name }}/install/ament_copyright"
name: "Check that ament_copyright install directory is present"
- uses: ./
id: test_multiple_packages
name: "Test multiple package, default options"
with:
package-name: ament_copyright ament_lint
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ matrix.distro_repos_url }}
- run: test -d "${{ steps.test_multiple_packages.outputs.ros-workspace-directory-name }}/install/ament_copyright"
name: "Check that ament_copyright install directory is present"
- run: test -d "${{ steps.test_multiple_packages.outputs.ros-workspace-directory-name }}/install/ament_lint"
name: "Check that ament_lint install directory is present"
- uses: ./
id: test_connext_dependency
name: "Test single package with Connext dependency, default options"
with:
package-name: rmw_implementation
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ matrix.distro_repos_url }}
- run: test -d "${{ steps.test_connext_dependency.outputs.ros-workspace-directory-name }}/install/rmw_implementation"
name: "Check that rmw_implementation install directory is present"
- uses: ./
id: test_mixin
name: "Test single package, with custom mixin"
with:
colcon-defaults: |
{
"build": {
"mixin": ["asan-gcc"]
}
}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ${{ matrix.distro_repos_url }}
- run: test -d "${{ steps.test_mixin.outputs.ros-workspace-directory-name }}/install/ament_copyright"
name: "Check that ament_copyright install directory is present"
- uses: ./
id: test_repo
name: "Test single package, with custom repository file"
with:
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test.repos"
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
- run: test -d "${{ steps.test_repo.outputs.ros-workspace-directory-name }}/install/ament_copyright"
# The second repo file is ignored, but will get vcs-import'ed anyway.
# This test case just run basic testing on the action logic, making
# sure the for-loop is implemented correctly.
- uses: ./
id: test_multiple_repos
name: "Test single package, with multiple custom repository files"
with:
vcs-repo-file-url: |
.github/workflows/repo_file_for_test.repos
.github/workflows/repo_file_for_test_cpp_package.repos
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
- run: test -d "${{ steps.test_multiple_repos.outputs.ros-workspace-directory-name }}/install/ament_copyright"
- run: test -d "${{ steps.test_multiple_repos.outputs.ros-workspace-directory-name }}/src/ament_lint"
- run: test -d "${{ steps.test_multiple_repos.outputs.ros-workspace-directory-name }}/src/osrf_testing_tools_cpp"
- uses: ./
id: test_coverage
name: "Test single package, with coverage enabled (Linux only)"
with:
colcon-defaults: |
{
"build": {
"mixin": ["coverage-gcc"]
}
}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
package-name: osrf_testing_tools_cpp
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_cpp_package.repos"
- run: find ${{ steps.test_coverage.outputs.ros-workspace-directory-name }}/build -name "*.gcda" | grep -q "."
name: "Check if one or more code coverage files (*.gcda) are present (Linux only)"
- uses: ./
id: test_extra_cmake
name: "Test single package, with extra cmake flags"
with:
package-name: ament_cmake_core
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test.repos"
# We use a long unique string here to make sure that if this string
# is found in CMakeCache.txt, it means the additional CMake flag has
# been passed successfully. Non recognized flags are also written by
# cmake into CMakeCache.txt, so this does not need to be a flag that
# really exists in this package.
extra-cmake-args: |
-DADDITIONAL_CMAKE_OPTION_FOR_TEST:STR="9ae391a63628efe6d72ba34a1a1d9dc9"
- run: grep -q 9ae391a63628efe6d72ba34a1a1d9dc9 ./${{ steps.test_extra_cmake.outputs.ros-workspace-directory-name }}/build/ament_cmake_core/CMakeCache.txt
name: "Check that the additional extra flags has been correctly passed"
- uses: ./
id: test_directories_with_same_name_as_repo
name: "Test that directories with the same name as this repository are not removed"
with:
package-name: ament_copyright
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: "${{ github.workspace }}/.github/workflows/repo_file_for_test_dirs_with_same_name_as_repo.repos"
- run: test -d "${{ steps.test_directories_with_same_name_as_repo.outputs.ros-workspace-directory-name }}/src/action-ros-ci/foo"
- run: test -d "${{ steps.test_directories_with_same_name_as_repo.outputs.ros-workspace-directory-name }}/src/foo/action-ros-ci/bar"