forked from wibotic/wibotic-ros-can-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from husarion/0.1.0-20241004
ROS 2 support fo Wibotic Wireless Charger
- Loading branch information
Showing
53 changed files
with
1,844 additions
and
756 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Language: Cpp | ||
BasedOnStyle: Google | ||
|
||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
BraceWrapping: | ||
AfterClass: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterStruct: true | ||
BreakBeforeBraces: Custom | ||
ColumnLimit: 100 | ||
ConstructorInitializerIndentWidth: 0 | ||
ContinuationIndentWidth: 2 | ||
DerivePointerAlignment: false | ||
PointerAlignment: Middle | ||
ReflowComments: true | ||
IncludeBlocks: Preserve | ||
AlignOperands: true | ||
PenaltyBreakAssignment: 21 | ||
PenaltyBreakBeforeFirstCallParameter: 1 |
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
### Description | ||
|
||
- | ||
|
||
### Requirements | ||
|
||
- [ ] Code style guidelines followed | ||
- [ ] Documentation updated | ||
|
||
### Tests 🧪 | ||
|
||
- [ ] Robot | ||
- [ ] Container | ||
- [ ] Simulation |
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
name: Pre-Commit | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
pre-commit: | ||
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master | ||
with: | ||
ros_distro: humble |
This file contains 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: Validate PR head branch | ||
on: | ||
pull_request: | ||
branches: | ||
- ros2 | ||
|
||
jobs: | ||
check-head-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check allowed branches | ||
run: | | ||
pattern="^[0-9]+\.[0-9]+\.[0-9]+-[0-9]{8}$" # This regex matches the X.X.X-YYYYMMDD pattern | ||
if [[ "${{ github.head_ref }}" == *"hotfix"* ]]; then | ||
echo "PR from a branch containing 'hotfix' is allowed." | ||
exit 0 | ||
elif [[ "${{ github.head_ref }}" =~ $pattern ]]; then | ||
echo "PR from a branch matching X.X.X-YYYYMMDD pattern is allowed." | ||
exit 0 | ||
else | ||
echo "PRs must come from branches containing 'hotfix' phrase or matching X.X.X-YYYYMMDD pattern." | ||
exit 1 | ||
fi |
This file contains 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
name: Run unit tests | ||
|
||
on: | ||
workflow_dispatch: | ||
# TODO: ENABLE WHEN READY | ||
# pull_request: | ||
# branches: | ||
# - ros2-devel | ||
|
||
jobs: | ||
test: | ||
name: Run unit tests | ||
runs-on: self-hosted | ||
env: | ||
HUSARION_ROS_BUILD_TYPE: hardware | ||
ROS_DISTRO: humble | ||
TEST_RESULT_FILENAME: last_run_results.txt | ||
COVERAGE_RESULT_FILENAME: coverage_results.log | ||
steps: | ||
- name: Prepare filesystem | ||
working-directory: ${{ runner.temp }} | ||
run: | | ||
touch ${{ env.TEST_RESULT_FILENAME }} | ||
touch ${{ env.COVERAGE_RESULT_FILENAME }} | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
path: ros2_ws/src/wibotic_ros | ||
|
||
- name: Resolve dependencies | ||
working-directory: ros2_ws | ||
run: | | ||
sudo apt update | ||
rosdep update --rosdistro $ROS_DISTRO | ||
rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y | ||
- name: Build | ||
working-directory: ros2_ws | ||
run: | | ||
source /opt/ros/$ROS_DISTRO/setup.bash | ||
if [ -f install/setup.bash ]; then source install/setup.bash; fi | ||
colcon build --symlink-install --parallel-workers $(nproc) --packages-up-to panther --cmake-args -DCMAKE_CXX_FLAGS='-fprofile-arcs -ftest-coverage' | ||
- name: Test | ||
working-directory: ros2_ws | ||
run: | | ||
source install/setup.bash | ||
colcon test --packages-up-to panther --retest-until-pass 10 --event-handlers console_cohesion+ --return-code-on-test-failure | ||
echo "result=$?" >> ${{ runner.temp }}/${{ env.TEST_RESULT_FILENAME }} | ||
colcon lcov-result --packages-up-to panther --verbose >> ${{ runner.temp }}/${{ env.COVERAGE_RESULT_FILENAME }} | ||
lines_cov=$(cat ${{ runner.temp }}/${{ env.COVERAGE_RESULT_FILENAME }} | grep -E 'lines' | head -1) | ||
functions_cov=$(cat ${{ runner.temp }}/${{ env.COVERAGE_RESULT_FILENAME }} | grep -E 'functions' | head -1) | ||
branches_cov=$(cat ${{ runner.temp }}/${{ env.COVERAGE_RESULT_FILENAME }} | grep -E 'branches' | head -1) | ||
echo "lines_cov=$lines_cov">> ${{ runner.temp }}/${{ env.TEST_RESULT_FILENAME }} | ||
echo "functions_cov=$functions_cov" >> ${{ runner.temp }}/${{ env.TEST_RESULT_FILENAME }} | ||
echo "branches_cov=$branches_cov" >> ${{ runner.temp }}/${{ env.TEST_RESULT_FILENAME }} | ||
- name: Collect unit tests output | ||
working-directory: ${{ runner.temp }} | ||
id: unit-tests-output | ||
run: cat ${{ env.TEST_RESULT_FILENAME }} >> "$GITHUB_OUTPUT" | ||
|
||
- name: Validate tests result | ||
uses: nick-fields/assert-action@v1 | ||
with: | ||
expected: 0 | ||
actual: ${{ steps.unit-tests-output.outputs.result }} | ||
|
||
- name: Comment PR | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: | | ||
**Test coverage of modified packages:** | ||
${{ steps.unit-tests-output.outputs.lines_cov }} | ||
${{ steps.unit-tests-output.outputs.functions_cov }} | ||
${{ steps.unit-tests-output.outputs.branches_cov }} |
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains 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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
# mesh files has to be taken into account | ||
args: ["--maxkb=3000"] | ||
- id: check-ast | ||
- id: check-json | ||
# vscode .json files do not follow the standard JSON format | ||
exclude: ^.vscode/ | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: destroyed-symlinks | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: fix-byte-order-marker | ||
- id: name-tests-test | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
args: ["--profile", "black"] | ||
|
||
- repo: https://github.com/cheshirekow/cmake-format-precommit | ||
rev: v0.6.13 | ||
hooks: | ||
- id: cmake-format | ||
|
||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v18.1.8 | ||
hooks: | ||
- id: clang-format | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.3.0 | ||
hooks: | ||
- id: codespell | ||
name: codespell | ||
description: Checks for common misspellings in text files. | ||
entry: codespell | ||
args: | ||
[ | ||
"--ignore-words-list", | ||
"ned" # north, east, down (NED) | ||
] | ||
exclude_types: [rst, svg] | ||
language: python | ||
types: [text] | ||
|
||
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | ||
rev: 0.2.3 | ||
hooks: | ||
- id: yamlfmt | ||
files: ^.github|./\.yaml | ||
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100'] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
args: ["--line-length=99"] | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 | ||
args: | ||
["--ignore=E501,W503"] # ignore too long line and line break before binary operator, | ||
# black checks it | ||
|
||
- repo: local | ||
hooks: | ||
- id: ament_copyright | ||
name: ament_copyright | ||
description: Check if copyright notice is available in all files. | ||
stages: [commit] | ||
entry: ament_copyright | ||
language: system | ||
|
||
# Docs - RestructuredText hooks | ||
- repo: https://github.com/PyCQA/doc8 | ||
rev: v1.1.1 | ||
hooks: | ||
- id: doc8 | ||
args: ["--max-line-length=100", "--ignore=D001"] | ||
exclude: ^.*\/CHANGELOG\.rst/.*$ | ||
|
||
- repo: https://github.com/tier4/pre-commit-hooks-ros | ||
rev: v0.10.0 | ||
hooks: | ||
- id: prettier-package-xml | ||
- id: sort-package-xml |
Oops, something went wrong.