diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4049bb949..9916c22b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: with: colcon-mixin-name: asan colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml - package-name: ament_copyright + package-name: ament_copyright ament_lint - uses: actions/upload-artifact@master with: name: colcon-logs diff --git a/action.yml b/action.yml index f194b561f..43ce693c5 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,10 @@ inputs: description: 'Mixin repository containing the mixin specified in colcon-mixin-name' required: false package-name: - description: 'Name of the package under test, as expected by colcon' + description: | + Name of the package(s) under test, as expected by colcon. + Passing multiple package names is allowed. + Package names can be separated by any whitespace character. required: true runs: using: 'node12' diff --git a/dist/index.js b/dist/index.js index 1cfbc68e3..278166e90 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4783,7 +4783,8 @@ function run() { const workspace = process.env.GITHUB_WORKSPACE; const colconMixinName = core.getInput("colcon-mixin-name"); const colconMixinRepo = core.getInput("colcon-mixin-repository"); - const packageName = core.getInput("package-name"); + const packageName = core.getInput("package-name", { required: true }); + const packageNameList = packageName.split(RegExp('\\s')); const ros2WorkspaceDir = path.join(workspace, "ros2_ws"); // rosdep on Windows does not reliably work on Windows, see // ros-infrastructure/rosdep#610 for instance. So, we do not run it. @@ -4830,7 +4831,7 @@ EOF` // avoid having rosdep installing unrequired dependencies. yield exec.exec("bash", [ "-c", - `diff --new-line-format="" --unchanged-line-format="" <(colcon list -p) <(colcon list --packages-up-to ${packageName} -p) | xargs rm -rf` + `diff --new-line-format="" --unchanged-line-format="" <(colcon list -p) <(colcon list --packages-up-to ${packageNameList.join(' ')} -p) | xargs rm -rf` ], options); // For "latest" builds, rosdep often misses some keys, adding "|| true", to // ignore those failures, as it is often non-critical. @@ -4864,10 +4865,9 @@ EOF` "build", "--event-handlers", "console_cohesion+", - "--packages-up-to", - packageName, - "--symlink-install" - ].concat(extra_options), options); + "--symlink-install", + "--packages-up-to" + ].concat(packageNameList).concat(extra_options), options); yield exec.exec("colcon", [ "test", "--event-handlers", @@ -4875,13 +4875,12 @@ EOF` "--pytest-args", "'--cov=.'", "'--cov-report=xml'", - "--packages-select", - packageName, - "--return-code-on-test-failure" - ].concat(extra_options), options); + "--return-code-on-test-failure", + "--packages-select" + ].concat(packageNameList).concat(extra_options), options); // ignoreReturnCode is set to true to avoid having a lack of coverage // data fail the build. - yield exec.exec("colcon", ["lcov-result", "--packages-select", packageName], { ignoreReturnCode: true }); + yield exec.exec("colcon", ["lcov-result", "--packages-select"].concat(packageNameList), { ignoreReturnCode: true }); } catch (error) { core.setFailed(error.message); diff --git a/src/action-ros2-ci.ts b/src/action-ros2-ci.ts index 3286ae436..198f62efe 100644 --- a/src/action-ros2-ci.ts +++ b/src/action-ros2-ci.ts @@ -11,7 +11,8 @@ async function run() { const colconMixinName = core.getInput("colcon-mixin-name"); const colconMixinRepo = core.getInput("colcon-mixin-repository"); - const packageName = core.getInput("package-name"); + const packageName = core.getInput("package-name", { required: true }); + const packageNameList = packageName.split(RegExp("\\s")); const ros2WorkspaceDir = path.join(workspace, "ros2_ws"); // rosdep on Windows does not reliably work on Windows, see @@ -74,7 +75,9 @@ EOF` "bash", [ "-c", - `diff --new-line-format="" --unchanged-line-format="" <(colcon list -p) <(colcon list --packages-up-to ${packageName} -p) | xargs rm -rf` + `diff --new-line-format="" --unchanged-line-format="" <(colcon list -p) <(colcon list --packages-up-to ${packageNameList.join( + " " + )} -p) | xargs rm -rf` ], options ); @@ -121,10 +124,11 @@ EOF` "build", "--event-handlers", "console_cohesion+", - "--packages-up-to", - packageName, - "--symlink-install" - ].concat(extra_options), + "--symlink-install", + "--packages-up-to" + ] + .concat(packageNameList) + .concat(extra_options), options ); await exec.exec( @@ -136,10 +140,11 @@ EOF` "--pytest-args", "'--cov=.'", "'--cov-report=xml'", - "--packages-select", - packageName, - "--return-code-on-test-failure" - ].concat(extra_options), + "--return-code-on-test-failure", + "--packages-select" + ] + .concat(packageNameList) + .concat(extra_options), options ); @@ -147,7 +152,7 @@ EOF` // data fail the build. await exec.exec( "colcon", - ["lcov-result", "--packages-select", packageName], + ["lcov-result", "--packages-select"].concat(packageNameList), { ignoreReturnCode: true } ); } catch (error) {