Skip to content

Commit

Permalink
Test reusable workflow with composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Feb 18, 2024
1 parent f6f71e0 commit 4b16e49
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 59 deletions.
13 changes: 13 additions & 0 deletions .github/actions/set-package-list/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Set package list'
description: 'Set the package_list environment variable'
inputs:
path:
description: 'Path to the packages'
required: true

runs:
using: 'composite'
steps:
- run: |
echo "package_list=$(colcon list --paths ${{ inputs.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ inputs.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_ENV
shell: bash
23 changes: 23 additions & 0 deletions .github/workflows/ci-ros-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: ROS 2 Lint
on:
pull_request:

env:
package-name:
control_toolbox

jobs:
lint_rolling:
uses: ./.github/workflows/reusable-ci-ros-lint.yml
with:
ros_distro: rolling
# lint:
# uses: ./.github/workflows/reusable-ci-ros-lint.yml
# strategy:
# fail-fast: false
# matrix:
# ROS_DISTRO: [iron, humble]
# with:
# ros_distro: ${{ matrix.ROS_DISTRO }}
# # use the release specified in REP-2000
# os_name: ubuntu-22.04
105 changes: 105 additions & 0 deletions .github/workflows/reusable-ci-ros-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Reusable ROS 2 Lint workflow
# Reusable action to simplify dealing with ros-linting
# author: Christoph Froehlich <[email protected]>

on:
workflow_call:
inputs:
ros_distro:
description: 'ROS2 distribution name'
required: true
type: string
os_name:
description: 'On which OS to run the linter'
required: false
default: 'ubuntu-latest'
type: string

env:
# this will be src/{repo-owner}/{repo-name}
path: src/${{ github.repository }}

jobs:
ament_lint:
name: ament_${{ matrix.linter }}
runs-on: ${{ inputs.os_name }}
strategy:
fail-fast: false
matrix:
linter: [copyright]
steps:
- uses: actions/checkout@v4
with:
path: ${{ env.path }}
- uses: ros-tooling/[email protected]
- name: Set package list
uses: ./.github/actions/set-package-list
with:
path: ${{ env.path }}
- uses: ros-tooling/[email protected]
with:
distribution: ${{ inputs.ros_distro }}
linter: ${{ matrix.linter }}
package-name: ${{ env.package_list }}

# ament_lint:
# name: ament_${{ matrix.linter }}
# runs-on: ${{ inputs.os_name }}
# strategy:
# fail-fast: false
# matrix:
# linter: [copyright, lint_cmake]
# steps:
# - uses: actions/checkout@v4
# with:
# path: ${{ env.path }}
# - uses: ros-tooling/[email protected]
# - name: Get list of packages
# # we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time
# run: |
# echo "package_list=$(colcon list --paths ${{ env.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ env.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_ENV
# - uses: ros-tooling/[email protected]
# with:
# distribution: ${{ inputs.ros_distro }}
# linter: ${{ matrix.linter }}
# package-name: ${{ env.package_list }}

# ament_lint_100:
# name: ament_cpplint
# runs-on: ${{ inputs.os_name }}
# steps:
# - uses: actions/checkout@v4
# with:
# path: ${{ env.path }}
# - uses: ros-tooling/[email protected]
# - name: Get list of packages
# # we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time
# run: |
# echo "package_list=$(colcon list --paths ${{ env.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ env.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_ENV
# - uses: ros-tooling/[email protected]
# with:
# distribution: ${{ inputs.ros_distro }}
# linter: cpplint
# arguments: "--linelength=100 --filter=-whitespace/newline"
# package-name: ${{ env.package_list }}

# ament_cppcheck:
# name: ament_cppcheck
# runs-on: ${{ inputs.os_name }}
# env:
# AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS: true
# steps:
# - uses: actions/checkout@v4
# with:
# path: ${{ env.path }}
# - uses: ros-tooling/[email protected]
# - name: Get list of packages
# # we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time
# run: |
# echo "package_list=$(colcon list --paths ${{ env.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ env.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_ENV
# - uses: ros-tooling/[email protected]
# with:
# distribution: ${{ inputs.ros_distro }}
# linter: cppcheck
# arguments: "--language=c++"
# package-name: ${{ env.package_list }}
59 changes: 0 additions & 59 deletions .github/workflows/ros-lint.yml

This file was deleted.

0 comments on commit 4b16e49

Please sign in to comment.