From d139a0f11bb7b8b56baed2b530678384c2106aaa Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Wed, 24 Apr 2024 09:00:28 -0700 Subject: [PATCH] Add GitHub CI config (#3) Signed-off-by: Christophe Bedard --- .github/workflows/test.yml | 53 +++++++++++++++++++ .../tracetools_analysis/utils/ros2.py | 10 ++-- 2 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..48f4e7e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,53 @@ +name: Test +on: + pull_request: + push: + branches: + - rolling + schedule: + - cron: "0 5 * * *" +jobs: + build-and-test: + runs-on: ubuntu-latest + container: + image: ubuntu:24.04 + continue-on-error: ${{ matrix.build-type == 'binary' }} + strategy: + matrix: + distro: + - rolling + build-type: + - binary + - source + env: + ROS2_REPOS_FILE_URL: 'https://raw.githubusercontent.com/ros2/ros2/${{ matrix.distro }}/ros2.repos' + steps: + - uses: actions/checkout@v3 + - uses: ros-tooling/setup-ros@master + with: + required-ros-distributions: ${{ matrix.build-type == 'binary' && matrix.distro || '' }} + use-ros2-testing: true + - uses: ros-tooling/action-ros-ci@master + with: + package-name: ros2trace_analysis tracetools_analysis + target-ros2-distro: ${{ matrix.distro }} + vcs-repo-file-url: ${{ matrix.build-type == 'source' && env.ROS2_REPOS_FILE_URL || '' }} + colcon-defaults: | + { + "build": { + "mixin": [ + "coverage-pytest" + ] + }, + "test": { + "mixin": [ + "coverage-pytest" + ], + "executor": "sequential", + "retest-until-pass": 2, + "pytest-args": ["-m", "not xfail"] + } + } + - uses: codecov/codecov-action@v3 + with: + files: ros_ws/coveragepy/.coverage diff --git a/tracetools_analysis/tracetools_analysis/utils/ros2.py b/tracetools_analysis/tracetools_analysis/utils/ros2.py index 0b50301..845b28c 100644 --- a/tracetools_analysis/tracetools_analysis/utils/ros2.py +++ b/tracetools_analysis/tracetools_analysis/utils/ros2.py @@ -122,8 +122,8 @@ class Ros2DataModelUtil(DataModelUtil): # Get their symbol pretty_symbols = {} for obj in callback_objects: - # There could be multiple callback symbols for the same callback object (pointer), e.g., - # if we create and destroy subscriptions dynamically + # There could be multiple callback symbols for the same callback object (pointer), + # e.g., if we create and destroy subscriptions dynamically symbols = callback_symbols.loc[obj, 'symbol'] symbols = symbols if isinstance(symbols, pd.Series) else [symbols] # In that case, just combine the symbols @@ -404,8 +404,8 @@ class Ros2DataModelUtil(DataModelUtil): ) # There could be multiple subscriptions for the same subscription object pointer, e.g., if - # we create and destroy subscriptions dynamically, so this subscription could belong to more - # than one node + # we create and destroy subscriptions dynamically, so this subscription could belong to + # more than one node # In that case, just combine the information node_handles = subscriptions_info.loc[subscription_reference, 'node_handle'] node_handles = node_handles if isinstance(node_handles, pd.Series) else [node_handles] @@ -421,7 +421,7 @@ class Ros2DataModelUtil(DataModelUtil): subscription_info = {'topic': topic_name} # Turn list of dicts into dict of combined values node_handle_info = { - key: ' and '.join(set(str(info[key]) for info in nodes_handle_info)) + key: ' and '.join({str(info[key]) for info in nodes_handle_info}) for key in nodes_handle_info[0] } return {**node_handle_info, **subscription_info}