-
Notifications
You must be signed in to change notification settings - Fork 21
Optimize local DX and CI pipeline #239
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
028c567
feat(dx): add test.sh convenience script with presets
bburda 53f3767
perf(build): make clang-tidy opt-in locally, mandatory in CI
bburda 70176f6
chore: fix copyright attribution to bburda
bburda 8e56f5a
feat(build): auto-detect ccache for faster incremental rebuilds
bburda d557fd0
perf(build): add precompiled headers for gateway package
bburda d04f7a1
perf(ci): add ccache with GitHub Actions cache
bburda f654fcc
feat(dx): add incremental clang-tidy as pre-push hook
bburda 112f30d
feat(devcontainer): add ccache with PCH-compatible sloppiness config
bburda 53f85b1
refactor(cmake): centralize ENABLE_CLANG_TIDY into ROS2MedkitLinting.…
bburda 136a016
perf(ci): add ccache to coverage job
bburda 09017a5
perf(ci): split Jazzy into parallel lint and test jobs
bburda 1e2042f
docs: update README with test.sh, pre-push hook, and new CI structure
bburda 5a5747b
docs: use pre-commit for pre-push hook instead of manual cp
bburda dfe9742
fix(cmake): add include_guard(GLOBAL) to Linting and Ccache modules
bburda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,6 @@ jobs: | |
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - ros_distro: jazzy | ||
| os_image: ubuntu:noble | ||
| - ros_distro: humble | ||
| os_image: ubuntu:jammy | ||
| - ros_distro: rolling | ||
|
|
@@ -41,6 +39,17 @@ jobs: | |
| with: | ||
| required-ros-distributions: ${{ matrix.ros_distro }} | ||
|
|
||
| - name: Install ccache | ||
| run: apt-get install -y ccache | ||
|
|
||
| - name: Cache ccache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /root/.cache/ccache | ||
| key: ccache-${{ matrix.ros_distro }}-${{ github.sha }} | ||
| restore-keys: | | ||
| ccache-${{ matrix.ros_distro }}- | ||
|
|
||
| - name: Install cpp-httplib from source (Humble) | ||
| if: matrix.ros_distro == 'humble' | ||
| run: | | ||
|
|
@@ -58,13 +67,9 @@ jobs: | |
| run: | | ||
| apt-get update | ||
| apt-get install -y ros-${{ matrix.ros_distro }}-test-msgs | ||
| # Linter tools only needed on Jazzy (clang versions differ across Ubuntu releases) | ||
| if [ "${{ matrix.ros_distro }}" = "jazzy" ]; then | ||
| apt-get install -y clang-format clang-tidy | ||
| fi | ||
| source /opt/ros/${{ matrix.ros_distro }}/setup.bash | ||
| rosdep update | ||
| # On Humble, skip the libcpp-httplib-dev rosdep key — the apt version (0.10.3) | ||
| # On Humble, skip the libcpp-httplib-dev rosdep key - the apt version (0.10.3) | ||
| # is too old; cpp-httplib v0.14.3 is built from source in an earlier step. | ||
| if [ "${{ matrix.ros_distro }}" = "humble" ]; then | ||
| rosdep install --from-paths src --ignore-src -r -y --skip-keys="libcpp-httplib-dev" | ||
|
|
@@ -73,25 +78,207 @@ jobs: | |
| fi | ||
|
|
||
| - name: Build packages | ||
| env: | ||
| CCACHE_DIR: /root/.cache/ccache | ||
| CCACHE_MAXSIZE: 500M | ||
| CCACHE_SLOPPINESS: pch_defines,time_macros | ||
| run: | | ||
| source /opt/ros/${{ matrix.ros_distro }}/setup.bash | ||
| colcon build --symlink-install \ | ||
| --cmake-args -DCMAKE_BUILD_TYPE=Release \ | ||
| --event-handlers console_direct+ | ||
| ccache -s | ||
|
|
||
| - name: Run linters (clang-format, clang-tidy, etc.) | ||
| if: matrix.ros_distro == 'jazzy' | ||
| - name: Run unit and integration tests | ||
| timeout-minutes: 15 | ||
| run: | | ||
| source /opt/ros/${{ matrix.ros_distro }}/setup.bash | ||
| source install/setup.bash | ||
| colcon test --return-code-on-test-failure \ | ||
| --ctest-args -LE linter \ | ||
| --event-handlers console_direct+ | ||
|
|
||
| - name: Show test results | ||
| if: always() | ||
| run: colcon test-result --verbose | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-${{ matrix.ros_distro }} | ||
| path: | | ||
| log/ | ||
| build/*/test_results/ | ||
|
|
||
| jazzy-build: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ubuntu:noble | ||
| timeout-minutes: 30 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| steps: | ||
| - name: Install Git | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y git | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up ROS 2 Jazzy | ||
| uses: ros-tooling/[email protected] | ||
| with: | ||
| required-ros-distributions: jazzy | ||
|
|
||
| - name: Install ccache | ||
| run: apt-get install -y ccache | ||
|
|
||
| - name: Cache ccache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /root/.cache/ccache | ||
| key: ccache-jazzy-${{ github.sha }} | ||
| restore-keys: | | ||
| ccache-jazzy- | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y ros-jazzy-test-msgs clang-format clang-tidy | ||
| source /opt/ros/jazzy/setup.bash | ||
| rosdep update | ||
| rosdep install --from-paths src --ignore-src -y | ||
|
|
||
| - name: Build packages | ||
| env: | ||
| CCACHE_DIR: /root/.cache/ccache | ||
| CCACHE_MAXSIZE: 500M | ||
| CCACHE_SLOPPINESS: pch_defines,time_macros | ||
| run: | | ||
| source /opt/ros/jazzy/setup.bash | ||
| colcon build --symlink-install \ | ||
| --cmake-args -DCMAKE_BUILD_TYPE=Release -DENABLE_CLANG_TIDY=ON \ | ||
| --event-handlers console_direct+ | ||
| ccache -s | ||
|
|
||
| - name: Package build artifacts | ||
| run: tar cf /tmp/jazzy-build.tar build/ install/ | ||
|
|
||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: jazzy-build | ||
| path: /tmp/jazzy-build.tar | ||
| retention-days: 1 | ||
|
|
||
| jazzy-lint: | ||
| needs: jazzy-build | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ubuntu:noble | ||
| timeout-minutes: 30 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| steps: | ||
| - name: Install Git | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y git | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up ROS 2 Jazzy | ||
| uses: ros-tooling/[email protected] | ||
| with: | ||
| required-ros-distributions: jazzy | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y clang-format clang-tidy | ||
| source /opt/ros/jazzy/setup.bash | ||
| rosdep update | ||
| rosdep install --from-paths src --ignore-src -y | ||
|
|
||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: jazzy-build | ||
|
|
||
| - name: Extract build artifacts | ||
| run: tar xf jazzy-build.tar && rm jazzy-build.tar | ||
|
|
||
| - name: Run linters | ||
| run: | | ||
| source /opt/ros/jazzy/setup.bash | ||
| source install/setup.bash | ||
| colcon test --return-code-on-test-failure \ | ||
| --ctest-args -L linter \ | ||
| --event-handlers console_direct+ | ||
|
|
||
| - name: Show test results | ||
| if: always() | ||
| run: colcon test-result --verbose | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-jazzy-lint | ||
| path: | | ||
| log/ | ||
| build/*/test_results/ | ||
|
|
||
| jazzy-test: | ||
| needs: jazzy-build | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ubuntu:noble | ||
| timeout-minutes: 15 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| steps: | ||
| - name: Install Git | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y git | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up ROS 2 Jazzy | ||
| uses: ros-tooling/[email protected] | ||
| with: | ||
| required-ros-distributions: jazzy | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y ros-jazzy-test-msgs | ||
| source /opt/ros/jazzy/setup.bash | ||
| rosdep update | ||
| rosdep install --from-paths src --ignore-src -y | ||
|
|
||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: jazzy-build | ||
|
|
||
| - name: Extract build artifacts | ||
| run: tar xf jazzy-build.tar && rm jazzy-build.tar | ||
|
|
||
| - name: Run unit and integration tests | ||
| timeout-minutes: 15 | ||
| run: | | ||
| source /opt/ros/${{ matrix.ros_distro }}/setup.bash | ||
| source /opt/ros/jazzy/setup.bash | ||
| source install/setup.bash | ||
| colcon test --return-code-on-test-failure \ | ||
| --ctest-args -LE linter \ | ||
|
|
@@ -105,7 +292,7 @@ jobs: | |
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-${{ matrix.ros_distro }} | ||
| name: test-results-jazzy-test | ||
| path: | | ||
| log/ | ||
| build/*/test_results/ | ||
|
|
@@ -133,6 +320,17 @@ jobs: | |
| with: | ||
| required-ros-distributions: jazzy | ||
|
|
||
| - name: Install ccache | ||
| run: apt-get install -y ccache | ||
|
|
||
| - name: Cache ccache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /root/.cache/ccache | ||
| key: ccache-coverage-${{ github.sha }} | ||
| restore-keys: | | ||
| ccache-coverage- | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| apt-get update | ||
|
|
@@ -142,11 +340,16 @@ jobs: | |
| rosdep install --from-paths src --ignore-src -r -y | ||
|
|
||
| - name: Build packages with coverage | ||
| env: | ||
| CCACHE_DIR: /root/.cache/ccache | ||
| CCACHE_MAXSIZE: 500M | ||
| CCACHE_SLOPPINESS: pch_defines,time_macros | ||
| run: | | ||
| source /opt/ros/jazzy/setup.bash | ||
| colcon build --symlink-install \ | ||
| --cmake-args -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON \ | ||
| --event-handlers console_direct+ | ||
| ccache -s | ||
|
|
||
| - name: Run unit and integration tests for coverage | ||
| run: | | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.