From ac6cdcd115ab1d3a1b2c2645864e9d96cf046d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 20 Aug 2024 11:04:47 +0300 Subject: [PATCH 1/2] feat(colcon-build): enable cpu resource control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- colcon-build/README.md | 2 ++ colcon-build/action.yaml | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/colcon-build/README.md b/colcon-build/README.md index 18ef9b65..7b5d5985 100644 --- a/colcon-build/README.md +++ b/colcon-build/README.md @@ -40,6 +40,8 @@ jobs: | include-eol-distros | false | If true, adds `--include-eol-distros` to `rosdep update`. | | cache-key-element | false | This value is added to the github actions cache key. | | nice-command | false | This command is prepended to the `colcon build` to avoid draining resources. | +| colcon-parallel-workers-flag | false | Will be appended to the colcon build command to limit number of packages built in parallel. e.g. "--parallel-workers 3" | +| makeflags | false | Will be exported as MAKEFLAGS environment variable for colcon build step. e.g. "-j 4" | ## Outputs diff --git a/colcon-build/action.yaml b/colcon-build/action.yaml index f84db3e6..26fbb4be 100644 --- a/colcon-build/action.yaml +++ b/colcon-build/action.yaml @@ -30,6 +30,14 @@ inputs: description: See `man nice` for details required: false default: nice -n 19 + colcon-parallel-workers-flag: + description: Will be appended to the colcon build command to limit number of packages built in parallel. e.g. "--parallel-workers 3" + default: "" + required: false + makeflags: + description: Will be exported as MAKEFLAGS environment variable. e.g. "-j 4" + default: "" + required: false runs: using: composite @@ -84,7 +92,10 @@ runs: cat /etc/nsswitch.conf sed -e 's#hosts:\(.*\)dns\(.*\)#hosts:\1\2#g' -i.bak /etc/nsswitch.conf cat /etc/nsswitch.conf - ${{ inputs.nice-command }} colcon build --event-handlers console_cohesion+ \ + MAKEFLAGS="${{ inputs.makeflags }}" + echo "MAKEFLAGS=$MAKEFLAGS" # for debugging + ${{ inputs.nice-command }} colcon build ${{ inputs.colcon-parallel-workers-flag }} \ + --event-handlers console_cohesion+ \ --packages-above-and-dependencies ${{ inputs.target-packages }} \ --cmake-args -DCMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \ --mixin coverage-gcc coverage-pytest compile-commands From 951b54794a927a18a15294a54bd08c77f07e9de3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 08:08:39 +0000 Subject: [PATCH 2/2] style(pre-commit): autofix --- colcon-build/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/colcon-build/README.md b/colcon-build/README.md index 7b5d5985..78c78ee6 100644 --- a/colcon-build/README.md +++ b/colcon-build/README.md @@ -30,16 +30,16 @@ jobs: ## Inputs -| Name | Required | Description | -| ------------------- | -------- | ---------------------------------------------------------------------------- | -| rosdistro | true | ROS distro. | -| target-packages | true | The target packages to build. | -| build-depends-repos | false | The `.repos` file that includes build dependencies. | -| cmake-build-type | false | The value for `CMAKE_BUILD_TYPE`. | -| token | false | The token for build dependencies. | -| include-eol-distros | false | If true, adds `--include-eol-distros` to `rosdep update`. | -| cache-key-element | false | This value is added to the github actions cache key. | -| nice-command | false | This command is prepended to the `colcon build` to avoid draining resources. | +| Name | Required | Description | +| ---------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | +| rosdistro | true | ROS distro. | +| target-packages | true | The target packages to build. | +| build-depends-repos | false | The `.repos` file that includes build dependencies. | +| cmake-build-type | false | The value for `CMAKE_BUILD_TYPE`. | +| token | false | The token for build dependencies. | +| include-eol-distros | false | If true, adds `--include-eol-distros` to `rosdep update`. | +| cache-key-element | false | This value is added to the github actions cache key. | +| nice-command | false | This command is prepended to the `colcon build` to avoid draining resources. | | colcon-parallel-workers-flag | false | Will be appended to the colcon build command to limit number of packages built in parallel. e.g. "--parallel-workers 3" | | makeflags | false | Will be exported as MAKEFLAGS environment variable for colcon build step. e.g. "-j 4" |