diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bbb1a88d..d88722c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -411,6 +411,17 @@ jobs: - 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" + - uses: ./ + id: test_no_symlink_install + name: "Test single package, with no --symlink-install" + with: + package-name: ament_copyright + target-ros2-distro: ${{ matrix.ros_distribution }} + vcs-repo-file-url: ${{ env.DISTRO_REPOS_URL }} + no-symlink-install: true + - run: test ! -f "${{ steps.test_no_symlink_install.outputs.ros-workspace-directory-name }}/install/ament_copyright/lib/python3.*/site-packages/ament-copyright.egg-link" + name: "Check that an .egg-link file in the install dir does not exist for ament_copyright" + test_ros2_from_source_docker: name: "Test ROS 2 from source Docker" runs-on: ubuntu-latest diff --git a/README.md b/README.md index 24d6d871..c91fba2d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ This action builds and tests a [ROS](http://wiki.ros.org/) or [ROS 2](https://do 1. [Build a ROS 1 workspace](#Build-a-ROS-1-workspace) 1. [Skip tests](#Skip-tests) 1. [Use a `colcon` `defaults.yaml` file](#Use-a-colcon-defaultsyaml-file) + 1. [Do not use `--symlink-install` when building](#Do-not-use---symlink-install-when-building) 1. [Enable Address Sanitizer to automatically report memory issues](#Enable-Address-Sanitizer-to-automatically-report-memory-issues) 1. [Generate and process code coverage data](#Generate-and-process-code-coverage-data) 1. [Store `colcon` logs as build artifacts](#Store-colcon-logs-as-build-artifacts) @@ -210,6 +211,23 @@ steps: } ``` +### Do not use `--symlink-install` when building + +By default, [`--symlink-install` is used with `colcon build`](https://colcon.readthedocs.io/en/released/reference/verb/build.html). +To avoid this, set the `no-symlink-install` input to `true`. + +```yaml +steps: + - uses: ros-tooling/setup-ros@v0.7 + with: + required-ros-distributions: humble + - uses: ros-tooling/action-ros-ci@v0.3 + with: + package-name: my_package + target-ros2-distro: humble + no-symlink-install: true +``` + ### Enable Address Sanitizer to automatically report memory issues [ASan][addresssanitizer] is an open-source tool developed to automatically report diff --git a/action.yml b/action.yml index 55d48ee7..1f4cdadf 100644 --- a/action.yml +++ b/action.yml @@ -83,6 +83,12 @@ inputs: Skip rosdep install. Set to 'true'. required: false + no-symlink-install: + default: "" + description: | + Do not use '--symlink-install' with 'colcon build'. + Set to 'true'. + required: false rosdep-check: default: "" description: | diff --git a/dist/index.js b/dist/index.js index f5f1beca..c9d1cd5c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11411,6 +11411,7 @@ function run_throw() { const workspace = process.env.GITHUB_WORKSPACE; const colconDefaults = core.getInput("colcon-defaults"); const colconMixinRepo = core.getInput("colcon-mixin-repository"); + const noSymlinkInstall = core.getInput("no-symlink-install") === "true"; const extraCmakeArgsInput = core.getInput("extra-cmake-args"); const extraCmakeArgs = extraCmakeArgsInput ? ["--cmake-args", extraCmakeArgsInput] @@ -11665,12 +11666,14 @@ done`; let colconBuildCmd = [ `colcon`, `build`, - `--symlink-install`, ...buildPackageSelection, ...colconExtraArgs, ...extraCmakeArgs, `--event-handlers=console_cohesion+`, ]; + if (!noSymlinkInstall) { + colconBuildCmd = [...colconBuildCmd, `--symlink-install`]; + } if (useMergeInstall) { colconBuildCmd = [...colconBuildCmd, `--merge-install`]; } diff --git a/src/action-ros-ci.ts b/src/action-ros-ci.ts index 117da82c..aa9d696e 100644 --- a/src/action-ros-ci.ts +++ b/src/action-ros-ci.ts @@ -360,6 +360,7 @@ async function run_throw(): Promise { const colconDefaults = core.getInput("colcon-defaults"); const colconMixinRepo = core.getInput("colcon-mixin-repository"); + const noSymlinkInstall = core.getInput("no-symlink-install") === "true"; const extraCmakeArgsInput = core.getInput("extra-cmake-args"); const extraCmakeArgs = extraCmakeArgsInput @@ -722,12 +723,14 @@ done`; let colconBuildCmd = [ `colcon`, `build`, - `--symlink-install`, ...buildPackageSelection, ...colconExtraArgs, ...extraCmakeArgs, `--event-handlers=console_cohesion+`, ]; + if (!noSymlinkInstall) { + colconBuildCmd = [...colconBuildCmd, `--symlink-install`]; + } if (useMergeInstall) { colconBuildCmd = [...colconBuildCmd, `--merge-install`]; }