-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
836d3ec
commit a883dae
Showing
20 changed files
with
1,065 additions
and
0 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,18 @@ | ||
--- | ||
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json | ||
language: en-US | ||
early_access: false | ||
reviews: | ||
profile: chill | ||
request_changes_workflow: false | ||
high_level_summary: true | ||
poem: false | ||
review_status: true | ||
collapse_walkthrough: false | ||
auto_review: | ||
enabled: true | ||
drafts: false | ||
base_branches: | ||
- ros2-devel | ||
chat: | ||
auto_reply: true |
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,8 @@ | ||
.devcontainer/ | ||
.github/ | ||
.git/ | ||
.vscode/ | ||
.dockerignore | ||
.gitignore | ||
Dockerfile.* | ||
README.md |
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,105 @@ | ||
--- | ||
name: Release repository | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_candidate: | ||
description: Branch name of the release candidate. | ||
required: true | ||
version: | ||
description: New version (used for tag). | ||
required: true | ||
release_name: | ||
description: Name of the release to be created. Version in the first place is recommended (e.g. | ||
`2.0.0-alpha`). | ||
required: true | ||
automatic_mode: | ||
type: boolean | ||
default: false | ||
description: Automatically merge PR and create release. | ||
prerelease: | ||
type: boolean | ||
default: false | ||
description: Mark the release as a prerelease. | ||
|
||
jobs: | ||
release: | ||
name: Release repository | ||
runs-on: ubuntu-22.04 | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
MAIN_BRANCH: ros2 | ||
DEVEL_BRANCH: ros2-devel | ||
steps: | ||
- name: Checkout to main branch | ||
if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH }} | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.MAIN_BRANCH }} | ||
fetch-depth: 0 | ||
|
||
- name: Get git diff between main and release candidate | ||
id: git_diff | ||
run: | | ||
git fetch origin ${{ github.event.inputs.release_candidate }}:${{ github.event.inputs.release_candidate }} | ||
DIFF=$(git diff --name-only ${{ github.event.inputs.release_candidate }}) # Change to "master.." to diff against last common commit | ||
if [ -z "$DIFF" ]; then | ||
echo "DIFF=false" >> $GITHUB_ENV | ||
else | ||
echo "DIFF=true" >> $GITHUB_ENV | ||
fi | ||
- name: Create PR to main branch | ||
if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && env.DIFF == 'true' }} | ||
run: | | ||
gh pr create \ | ||
--base ${{ env.MAIN_BRANCH }} \ | ||
--head ${{ github.event.inputs.release_candidate }} \ | ||
--title "Release ${{ github.event.inputs.version}} to ${{ env.MAIN_BRANCH }}" \ | ||
--body "This PR incorporates release updates." | ||
- name: Merge PR to main branch | ||
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && github.event.inputs.release_candidate | ||
!= env.MAIN_BRANCH && env.DIFF == 'true' }} | ||
run: | | ||
gh pr merge ${{ github.event.inputs.release_candidate }} \ | ||
--merge --delete-branch | ||
- name: Delete branch | ||
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && github.event.inputs.release_candidate | ||
!= env.MAIN_BRANCH && env.DIFF == 'false' }} | ||
run: | | ||
git push origin --delete ${{ github.event.inputs.release_candidate }} | ||
- name: Create prerelease | ||
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) | ||
== true}} | ||
run: | | ||
gh release create ${{ github.event.inputs.version }} \ | ||
--target ${{ env.MAIN_BRANCH }} \ | ||
--title ${{ github.event.inputs.release_name }} \ | ||
--generate-notes \ | ||
--prerelease | ||
- name: Create release | ||
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) | ||
== false}} | ||
run: | | ||
gh release create ${{ github.event.inputs.version }} \ | ||
--target ${{ env.MAIN_BRANCH }} \ | ||
--title ${{ github.event.inputs.release_name }} \ | ||
--generate-notes | ||
- name: Checkout to devel branch | ||
if: ${{ env.DEVEL_BRANCH != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) == true }} | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.DEVEL_BRANCH }} | ||
fetch-depth: 0 | ||
|
||
- name: Update devel branch | ||
if: ${{ env.DEVEL_BRANCH != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) == true }} | ||
run: | | ||
git pull origin ${{ env.MAIN_BRANCH }} | ||
git push origin ${{ env.DEVEL_BRANCH }} |
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,77 @@ | ||
--- | ||
name: Build/Publish ROS Docker Image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
panther_codebase_version: | ||
description: Version of the panther_ros to be used in the docker image (branch/tag/commit). | ||
required: true | ||
type: string | ||
default: ros2-devel | ||
build_type: | ||
description: Is it a "development" or a "stable" release? | ||
required: true | ||
default: development | ||
type: choice | ||
options: | ||
- development | ||
- stable | ||
target_distro: | ||
description: In case of "stable" release specify the ROS distro of the existing docker image (eg. | ||
humble) | ||
type: string | ||
default: humble | ||
target_release: | ||
description: In case of "stable" release specify the version of the existing docker image (eg. | ||
1.0.12) | ||
type: string | ||
default: 0.0.0 | ||
target_date: | ||
description: In case of "stable" release specify the date of the existing docker image in format | ||
YYYYMMDD (eg. 20220124) | ||
type: string | ||
default: '20131206' | ||
feature_branch_tag_suffix: | ||
description: In case of "development" release from a feature branch specify the custom tag suffix | ||
for the docker image | ||
type: string | ||
default: '' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- dockerfile: Dockerfile.hardware | ||
platforms: linux/arm64 | ||
ros_distro: humble | ||
- dockerfile: Dockerfile.simulation | ||
repo_name: panther-gazebo | ||
platforms: linux/amd64 | ||
ros_distro: humble | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build Docker Image | ||
uses: husarion-ci/[email protected] | ||
with: | ||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} | ||
main_branch_name: ros2 | ||
dockerfile: ${{ matrix.dockerfile }} | ||
repo_name: ${{ matrix.repo_name }} | ||
branch_name: ${{ inputs.panther_codebase_version }} | ||
build_type: ${{ inputs.build_type }} | ||
ros_distro: ${{ matrix.ros_distro }} | ||
platforms: ${{ matrix.platforms }} | ||
# variables important only for stable release | ||
target_distro: ${{ inputs.target_distro }} | ||
target_release: ${{ inputs.target_release }} | ||
target_date: ${{ inputs.target_date }} | ||
# variables important only for development release | ||
feature_branch_tag_suffix: ${{ inputs.feature_branch_tag_suffix }} |
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,38 @@ | ||
--- | ||
name: Update tags in compose files | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch_name: | ||
description: Target branch for the update. | ||
required: true | ||
image_tag: | ||
description: Docker image tag to be replaced with. | ||
required: true | ||
|
||
jobs: | ||
release: | ||
name: Release repository | ||
runs-on: ubuntu-22.04 | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.branch_name }} | ||
|
||
- name: Update docker image tag | ||
uses: mikefarah/[email protected] | ||
with: | ||
cmd: | | ||
yq -i '.services.panther_ros.image = "husarion/panther:${{ github.event.inputs.image_tag }}" | (... | select(tag == "!!merge")) tag = ""' demo/compose.minimal-setup.yaml | ||
yq -i '.services.panther_gazebo.image = "husarion/panther-gazebo:${{ github.event.inputs.image_tag }}" | (... | select(tag == "!!merge")) tag = ""' demo/compose.simulation.yaml | ||
- name: Commit changes to target branch | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
message: Update docker image tag | ||
author_name: action-bot | ||
author_email: [email protected] |
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,28 @@ | ||
# Docker project generated files to ignore | ||
# if you want to ignore files created by your editor/tools, | ||
# please consider a global .gitignore https://help.github.com/articles/ignoring-files | ||
.vagrant* | ||
bin | ||
docker/docker | ||
.*.swp | ||
a.out | ||
*.orig | ||
build_src | ||
.flymake* | ||
.idea | ||
.DS_Store | ||
docs/_build | ||
docs/_static | ||
docs/_templates | ||
.gopath/ | ||
.dotcloud | ||
*.test | ||
bundles/ | ||
.hg/ | ||
.git/ | ||
vendor/pkg/ | ||
pyenv | ||
Vagrantfile | ||
|
||
.vscode | ||
__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,37 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-xml | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-json | ||
- id: name-tests-test | ||
files: ^.*\/test\/.*$ | ||
args: [--pytest-test-first] | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
entry: codespell | ||
|
||
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | ||
rev: 0.2.3 | ||
hooks: | ||
- id: yamlfmt | ||
files: ^(?!.*compose).*$ | ||
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100'] | ||
|
||
# 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/.*$ |
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,44 @@ | ||
ARG ROS_DISTRO=humble | ||
|
||
FROM husarnet/ros:${ROS_DISTRO}-ros-core | ||
|
||
ARG BRANCH_NAME=ros2-devel | ||
ARG BUILD_TEST=OFF | ||
|
||
ENV HUSARION_ROS_BUILD_TYPE=hardware | ||
|
||
STOPSIGNAL SIGINT | ||
|
||
WORKDIR /ros2_ws | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
ros-dev-tools && \ | ||
# Setup workspace | ||
git clone -b ${BRANCH_NAME} https://github.com/husarion/panther_ros.git src/panther_ros && \ | ||
vcs import src < src/panther_ros/husarion_ugv/${HUSARION_ROS_BUILD_TYPE}_deps.repos && \ | ||
cp -r src/ros2_controllers/diff_drive_controller src && \ | ||
cp -r src/ros2_controllers/imu_sensor_broadcaster src && \ | ||
rm -rf src/ros2_controllers && \ | ||
# Install dependencies | ||
rosdep init && \ | ||
rosdep update --rosdistro $ROS_DISTRO && \ | ||
rosdep install --from-paths src -y -i && \ | ||
# Build | ||
source /opt/ros/$ROS_DISTRO/setup.bash && \ | ||
colcon build --symlink-install --packages-up-to husarion_ugv --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=$BUILD_TEST && \ | ||
# Get version | ||
echo $(cat /ros2_ws/src/panther_ros/husarion_ugv/package.xml | grep '<version>' | sed -r 's/.*<version>([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') >> /version.txt && \ | ||
# Size optimalization | ||
export SUDO_FORCE_REMOVE=yes && \ | ||
apt-get remove -y \ | ||
ros-dev-tools && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY update_config_directory.sh /usr/local/sbin/update_config_directory | ||
COPY setup_environment.sh /usr/local/sbin/setup_environment | ||
|
||
# Setup envs from eeprom | ||
RUN sed -i "/# <additional-user-commands>/i set -e -a && source setup_environment" /*_entrypoint.sh |
Oops, something went wrong.