-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for --ament-cmake-args option #41
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
b4e138a
ac214c9
ace0b3b
a1cc1a7
ba70e6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,10 @@ name: Lint, Build & Test | |
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| - master | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
@@ -15,53 +15,57 @@ jobs: | |
| name: Lint Code Base | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y black libxml2-utils | ||
| - name: Lint package.xml | ||
| run: | | ||
| xmllint --noout --schema http://download.ros.org/schema/package_format3.xsd $(find . -name 'package.xml') | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Lint Python code with black | ||
| run: | | ||
| echo "Linting Python code..." | ||
| black --check . --diff | ||
| - name: Setup | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y black clang-format cppcheck libxml2-utils | ||
|
|
||
| # Uncomment once tests have been added | ||
| # build-and-test: | ||
| # needs: Linting | ||
| # strategy: | ||
| # matrix: | ||
| # setup: | ||
| # - rosdistro: jazzy | ||
| # os: ubuntu-24.04 | ||
| # - rosdistro: rolling | ||
| # os: ubuntu-latest | ||
| # runs-on: ${{ matrix.setup.os }} | ||
| # container: | ||
| # image: ros:${{ matrix.setup.rosdistro }}-ros-base | ||
| # steps: | ||
| # - name: install build tools | ||
| # run: | | ||
| # sudo apt-get update | ||
| # sudo apt-get install -y ros-dev-tools | ||
| # - uses: actions/checkout@v4 | ||
| # with: | ||
| # path: src/repo | ||
| # - name: rosdep | ||
| # run: | | ||
| # rosdep update --rosdistro ${{ matrix.setup.rosdistro }} --include-eol-distros | ||
| # rosdep install -y --from-paths src --ignore-src --rosdistro ${{ matrix.setup.rosdistro }} | ||
| # - name: build | ||
| # run: | | ||
| # source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash | ||
| # colcon build | ||
| # - name: test | ||
| # run: | | ||
| # source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash | ||
| # colcon test | ||
| # colcon test-result --verbose | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
|
|
||
| - name: Install and Run pre-commit | ||
| uses: pre-commit/[email protected] | ||
| with: | ||
| extra_args: --all-files | ||
|
|
||
| build-and-test: | ||
| needs: Linting | ||
| strategy: | ||
| matrix: | ||
| setup: | ||
| - rosdistro: jazzy | ||
| os: ubuntu-24.04 | ||
| - rosdistro: rolling | ||
| os: ubuntu-latest | ||
| runs-on: ${{ matrix.setup.os }} | ||
| container: | ||
| image: ros:${{ matrix.setup.rosdistro }}-ros-base | ||
| steps: | ||
| - name: install build tools | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y ros-dev-tools | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| repository: tu-darmstadt-ros-pkg/hector_ros2_utils | ||
| path: src/hector_ros2_utils | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| path: src/repo | ||
| - name: rosdep | ||
| run: | | ||
| rosdep update --rosdistro ${{ matrix.setup.rosdistro }} --include-eol-distros | ||
| rosdep install -y --from-paths src --ignore-src --rosdistro ${{ matrix.setup.rosdistro }} | ||
| - name: build | ||
| run: | | ||
| source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash | ||
| colcon build | ||
| - name: test | ||
| run: | | ||
| source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash | ||
| colcon test | ||
| colcon test-result --verbose | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,88 @@ | ||
| # To use: | ||
| # | ||
| # pre-commit run -a | ||
| # | ||
| # Or: | ||
| # | ||
| # pre-commit install # (runs every time you commit in git) | ||
| # | ||
| # To update this file: | ||
| # | ||
| # pre-commit autoupdate | ||
| # | ||
| # See https://github.com/pre-commit/pre-commit | ||
|
|
||
| repos: | ||
| - repo: https://github.com/psf/black | ||
| rev: 24.2.0 | ||
| # Standard hooks | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: black | ||
| name: Black | ||
| language_version: python3 | ||
| - id: check-added-large-files | ||
| - id: check-docstring-first | ||
| - id: check-merge-conflict | ||
| - id: check-symlinks | ||
| - id: check-xml | ||
| - id: check-yaml | ||
| args: ["--allow-multiple-documents"] | ||
| - id: end-of-file-fixer | ||
| - id: mixed-line-ending | ||
| - id: trailing-whitespace | ||
| exclude_types: [rst] | ||
|
|
||
| # CPP Checks | ||
| - repo: https://github.com/pre-commit/mirrors-clang-format | ||
| rev: v20.1.4 | ||
| hooks: | ||
| - id: clang-format | ||
| name: Clang Format | ||
| args: [--style=file] | ||
| files: \.(cpp|hpp|h|c|cc)$ | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: cppcheck | ||
| name: Cppcheck | ||
| entry: bash -c "cppcheck --force --quiet --inline-suppr --error-exitcode=1 --language=c++ $(find . -type d -name 'cmake-build-*' -prune -false -o -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.c' -o -name '*.cc')" | ||
| language: system | ||
| files: \.(cpp|cc|hpp|h)$ | ||
| pass_filenames: false | ||
|
Comment on lines
+33
to
+48
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no and probably never will be any CPP in this repo. |
||
|
|
||
| # Python hooks | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.12.7 | ||
| hooks: | ||
| - id: ruff-check | ||
| args: [ --fix ] | ||
| - id: ruff-format | ||
|
|
||
| # CMake Formatting | ||
| - repo: https://github.com/cheshirekow/cmake-format-precommit | ||
| rev: v0.6.13 | ||
| hooks: | ||
| - id: cmake-format | ||
| - id: cmake-lint | ||
|
|
||
| # Package XML | ||
| - repo: https://github.com/Joschi3/package_xml_validation.git | ||
| rev: v1.2.3 | ||
| hooks: | ||
| - id: format-package-xml | ||
| name: Validate and Format package.xml | ||
|
|
||
| # Spellcheck | ||
| - repo: https://github.com/crate-ci/typos | ||
| rev: v1.34.0 | ||
| hooks: | ||
| - id: typos | ||
|
|
||
| - repo: https://github.com/python-jsonschema/check-jsonschema | ||
| rev: 0.33.2 | ||
| hooks: | ||
| - id: check-github-workflows | ||
| args: ["--verbose"] | ||
| - id: check-github-actions | ||
| args: ["--verbose"] | ||
| - id: check-gitlab-ci | ||
| args: ["--verbose"] | ||
| - id: check-compose-spec | ||
| args: ["--verbose"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ def build_packages( | |
| build_base: str = "build", | ||
| install_base: str = "install", | ||
| cmake_clean_cache: bool = False, | ||
| ament_cmake_args: list[str] = None, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically, your default value is violating the type annotation. |
||
| ) -> int: | ||
| os.chdir(workspace_root) | ||
| packages = packages or [] | ||
|
|
@@ -53,6 +54,10 @@ def build_packages( | |
| arguments += ["--cmake-args"] + list( | ||
| map(lambda x: f"' {shlex.quote(x)}'", cmake_arguments) | ||
| ) | ||
| if ament_cmake_args: | ||
| arguments += ["--ament-cmake-args"] + list( | ||
| map(lambda x: f"{"-D" + x}", ament_cmake_args) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There may be other arguments than |
||
| ) | ||
| if mixin and len(mixin) > 0: | ||
| arguments += ["--mixin"] + mixin | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you running the pre-commit hooks in the CI?
That would mask any formatting issues that were committed.