Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(colcon-build): enable cpu resource control #309

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions colcon-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@

## 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" |

Check warning on line 44 in colcon-build/README.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (makeflags)

Check warning on line 44 in colcon-build/README.md

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (MAKEFLAGS)

## Outputs

Expand Down
13 changes: 12 additions & 1 deletion colcon-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
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:

Check warning on line 37 in colcon-build/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (makeflags)
description: Will be exported as MAKEFLAGS environment variable. e.g. "-j 4"

Check warning on line 38 in colcon-build/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (MAKEFLAGS)
default: ""
required: false

runs:
using: composite
Expand Down Expand Up @@ -84,7 +92,10 @@
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 }}"

Check warning on line 95 in colcon-build/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (MAKEFLAGS)

Check warning on line 95 in colcon-build/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (makeflags)
echo "MAKEFLAGS=$MAKEFLAGS" # for debugging

Check warning on line 96 in colcon-build/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (MAKEFLAGS)

Check warning on line 96 in colcon-build/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (MAKEFLAGS)
${{ 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
Expand Down
Loading