From bd16c65967d07732310678a6ea9244e1d723f1e8 Mon Sep 17 00:00:00 2001 From: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Date: Thu, 1 Sep 2022 15:32:11 +0900 Subject: [PATCH] ci(clang-tidy): support target files input (#178) * refactor: change order of parameters Signed-off-by: Kenji Miyake * ci(clang-tidy): support target files input Signed-off-by: Kenji Miyake * fix Signed-off-by: Kenji Miyake Signed-off-by: Kenji Miyake --- clang-tidy/README.md | 5 +++-- clang-tidy/action.yaml | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/clang-tidy/README.md b/clang-tidy/README.md index 640374a9..9dad1fc2 100644 --- a/clang-tidy/README.md +++ b/clang-tidy/README.md @@ -26,8 +26,8 @@ jobs: uses: autowarefoundation/autoware-github-actions/clang-tidy@v1 with: rosdistro: galactic - target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy + target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} build-depends-repos: build_depends.repos ``` @@ -36,8 +36,9 @@ jobs: | Name | Required | Description | | --------------------- | -------- | --------------------------------------------------- | | rosdistro | true | The ROS distro. | -| target-packages | true | The target packages to analyze by Clang-Tidy. | | clang-tidy-config-url | true | The URL to `.clang-tidy`. | +| target-packages | true | The target packages to analyze by Clang-Tidy. | +| target-files | false | The target files. | | build-depends-repos | false | The `.repos` file that includes build dependencies. | | token | false | The token for build dependencies and `.clang-tidy`. | diff --git a/clang-tidy/action.yaml b/clang-tidy/action.yaml index cd78404b..903da901 100644 --- a/clang-tidy/action.yaml +++ b/clang-tidy/action.yaml @@ -5,12 +5,15 @@ inputs: rosdistro: description: "" required: true - target-packages: + clang-tidy-config-url: description: "" required: true - clang-tidy-config-url: + target-packages: description: "" required: true + target-files: + description: "" + required: false build-depends-repos: description: "" required: false @@ -22,9 +25,10 @@ inputs: runs: using: composite steps: - - name: Show target files + - name: Show targets run: | echo "target packages: ${{ inputs.target-packages }}" + echo "target files: ${{ inputs.target-files }}" shell: bash - name: Install curl @@ -93,8 +97,13 @@ runs: - name: Get target files id: get-target-files run: | - package_path=$(colcon list --paths-only --packages-select ${{ inputs.target-packages }}) - target_files=$(find $package_path -name "*.cpp" -or -name "*.hpp") + if [ "${{ inputs.target-files }}" != "" ]; then + target_files="${{ inputs.target-files }}" + else + package_path=$(colcon list --paths-only --packages-select ${{ inputs.target-packages }}) + target_files=$(find $package_path -name "*.cpp" -or -name "*.hpp") + fi + echo ::set-output name=target-files::$target_files shell: bash