Skip to content

Commit e56bf89

Browse files
authored
Initial commit
0 parents  commit e56bf89

37 files changed

Lines changed: 5008 additions & 0 deletions
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Workflow to sync local repository with latest version of DUA template.
2+
#
3+
# Roberto Masocco <r.masocco@dotxautomation.com>
4+
#
5+
# March 9, 2026
6+
7+
# Copyright 2026 dotX Automation s.r.l.
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License");
10+
# you may not use this file except in compliance with the License.
11+
# You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS,
17+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
# See the License for the specific language governing permissions and
19+
# limitations under the License.
20+
21+
name: Sync DUA template
22+
23+
on:
24+
# Run every day at 00:01
25+
schedule:
26+
- cron: "1 0 * * *"
27+
28+
# Run when base branch is updated
29+
push:
30+
branches:
31+
- master
32+
33+
# Run when manually triggered
34+
workflow_dispatch:
35+
36+
env:
37+
BASE_BRANCH: master
38+
HEAD_BRANCH: chore/sync-dua-template
39+
GIT_AUTHOR_NAME: ${{ github.repository_owner }}
40+
GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com
41+
REPO_TEMPLATE: dotX-Automation/dua-template
42+
THIS_REPO: ${{ github.repository }}
43+
44+
jobs:
45+
sync-dua-template:
46+
# Do not run on the template repository itself
47+
if: github.repository != 'dotX-Automation/dua-template'
48+
49+
name: Sync DUA template
50+
runs-on: ubuntu-latest
51+
continue-on-error: false
52+
53+
steps:
54+
# Configure Git to reduce warnings
55+
- name: Configure Git to reduce warnings
56+
run: git config --global init.defaultBranch master
57+
58+
# Clone the template repository (we need the full history of this)
59+
- name: Check out template repository
60+
uses: actions/checkout@v6
61+
with:
62+
repository: ${{ env.REPO_TEMPLATE }}
63+
ref: 'master'
64+
token: ${{ github.token }}
65+
path: ${{ env.REPO_TEMPLATE }}
66+
fetch-depth: 0
67+
68+
# Clone the target repository
69+
- name: Check out ${{ github.repository }}
70+
uses: actions/checkout@v6
71+
with:
72+
repository: ${{ github.repository }}
73+
ref: ${{ env.BASE_BRANCH }}
74+
token: ${{ github.token }}
75+
path: ${{ github.repository }}
76+
77+
# Checkout a branch
78+
- name: Create branch in ${{ env.THIS_REPO }}
79+
run: |
80+
git -C "${THIS_REPO}" fetch origin "${HEAD_BRANCH}" || true
81+
git -C "${THIS_REPO}" branch -a
82+
git -C "${THIS_REPO}" checkout -B "${HEAD_BRANCH}" \
83+
"remotes/origin/${HEAD_BRANCH}" || \
84+
git -C "${THIS_REPO}" checkout -b "${HEAD_BRANCH}"
85+
86+
# Parse template contents and synchronize changes
87+
- name: Parse template contents and synchronize changes
88+
run: |
89+
_files="$(find ${REPO_TEMPLATE} \
90+
! -path "*/.git/*" \
91+
! -path "*/.github/workflows/*" \
92+
! -path "*/.vscode/*" \
93+
! -name ".gitignore" \
94+
! -name "LICENSE" \
95+
! -name "README.md" \
96+
-type f \
97+
-print)"
98+
_deleted_files="$(git -C ${REPO_TEMPLATE} log \
99+
--diff-filter=D \
100+
--name-only \
101+
--pretty=format: | grep -v '^$')"
102+
for _deleted_file in ${_deleted_files}; do
103+
_file_path="${THIS_REPO}/${_deleted_file#${REPO_TEMPLATE}/}"
104+
if [[ -f "${_file_path}" ]]; then
105+
echo "INFO: Deleting ${_file_path}"
106+
rm -f "${_file_path}"
107+
fi
108+
done
109+
for _file in ${_files}; do
110+
_src="${_file}"
111+
_dst="${THIS_REPO}/${_file#${REPO_TEMPLATE}/}"
112+
_dst="${_dst%/*}/"
113+
mkdir -p "${_dst}"
114+
echo "INFO: Copying '${_src}' to '${_dst}'"
115+
cp "${_src}" "${_dst}"
116+
done
117+
git -C "${THIS_REPO}" diff
118+
119+
# Commit changes, push, and create a pull request
120+
- name: Push changes and create a pull request
121+
env:
122+
GH_TOKEN: ${{ github.token }}
123+
run: |
124+
if [[ -n $(git -C "${THIS_REPO}" status --porcelain) ]]; then
125+
git -C ${THIS_REPO} config user.name "${GIT_AUTHOR_NAME}"
126+
git -C ${THIS_REPO} config user.email "${GIT_AUTHOR_EMAIL}"
127+
git -C ${THIS_REPO} add .
128+
git -C ${THIS_REPO} commit -m "chore: sync to dua-template@${{ github.sha }}"
129+
if [[ -n $(git -C ${THIS_REPO} branch -r --list "origin/${HEAD_BRANCH}") ]]; then
130+
git -C ${THIS_REPO} push
131+
echo "INFO: Pushed changes to branch ${HEAD_BRANCH}"
132+
else
133+
git -C ${THIS_REPO} push -u origin "${HEAD_BRANCH}"
134+
pushd ${THIS_REPO}
135+
gh pr create \
136+
--base "${BASE_BRANCH}" \
137+
--head "${HEAD_BRANCH}" \
138+
--title "Sync to dua-template@${{ github.sha }}" \
139+
--body "Sync to dua-template@${{ github.sha }}."
140+
popd
141+
echo "INFO: Created new pull request from ${HEAD_BRANCH} to ${BASE_BRANCH}"
142+
fi
143+
else
144+
echo "INFO: No changes to commit"
145+
fi

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ROS 2 workspace folders
2+
build/*
3+
install/*
4+
log/*
5+
6+
# Python build products
7+
__pycache__/
8+
*.py[cod]
9+
10+
# Uncomment the following to avoid pushing personal configurations
11+
# .vscode/
12+

.vscode/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# IntelliSense database files
2+
*.vc.db*

.vscode/c_cpp_properties.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"browse": {
6+
"databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db",
7+
"limitSymbolsToIncludedHeaders": false
8+
},
9+
"includePath": [
10+
"${default}",
11+
"${workspaceFolder}/**",
12+
"/opt/ros/jazzy/include/**",
13+
"${workspaceFolder}/install/**",
14+
"/opt/ros/dua-utils/install/**",
15+
// Add subdirectories of install here to include interfaces,
16+
// headers, plugin base headers and everything else you need
17+
"/usr/local/**",
18+
"/usr/local/include"
19+
],
20+
"defines": [],
21+
"compilerPath": "/usr/bin/g++",
22+
"cStandard": "c99",
23+
"cppStandard": "c++17",
24+
"intelliSenseMode": "linux-gcc-x64"
25+
}
26+
],
27+
"version": 4
28+
}

.vscode/launch.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
// Example launch of a python file
5+
{
6+
"name": "Python: Current File",
7+
"type": "python",
8+
"request": "launch",
9+
"program": "${file}",
10+
"console": "integratedTerminal",
11+
}
12+
]
13+
}

.vscode/settings.json

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
{
2+
"editor.tabSize": 2,
3+
"editor.rulers": [
4+
100
5+
],
6+
"files.associations": {
7+
"*.repos": "yaml",
8+
"*.world": "xml",
9+
"*.xacro": "xml",
10+
"*.h": "cpp",
11+
"functional": "cpp",
12+
"cctype": "cpp",
13+
"cfcntl": "cpp",
14+
"clocale": "cpp",
15+
"cmath": "cpp",
16+
"csched": "cpp",
17+
"csignal": "cpp",
18+
"cstdbool": "cpp",
19+
"cstddef": "cpp",
20+
"cstdint": "cpp",
21+
"cstdio": "cpp",
22+
"cstdlib": "cpp",
23+
"cstring": "cpp",
24+
"ctime": "cpp",
25+
"cunistd": "cpp",
26+
"cwchar": "cpp",
27+
"cwctype": "cpp",
28+
"cstdarg": "cpp",
29+
"*.ipp": "cpp",
30+
"any": "cpp",
31+
"array": "cpp",
32+
"atomic": "cpp",
33+
"hash_map": "cpp",
34+
"hash_set": "cpp",
35+
"strstream": "cpp",
36+
"bit": "cpp",
37+
"*.tcc": "cpp",
38+
"bitset": "cpp",
39+
"chrono": "cpp",
40+
"cinttypes": "cpp",
41+
"codecvt": "cpp",
42+
"complex": "cpp",
43+
"condition_variable": "cpp",
44+
"deque": "cpp",
45+
"forward_list": "cpp",
46+
"list": "cpp",
47+
"map": "cpp",
48+
"set": "cpp",
49+
"unordered_map": "cpp",
50+
"unordered_set": "cpp",
51+
"vector": "cpp",
52+
"exception": "cpp",
53+
"algorithm": "cpp",
54+
"iterator": "cpp",
55+
"memory": "cpp",
56+
"memory_resource": "cpp",
57+
"numeric": "cpp",
58+
"optional": "cpp",
59+
"random": "cpp",
60+
"ratio": "cpp",
61+
"regex": "cpp",
62+
"string": "cpp",
63+
"string_view": "cpp",
64+
"system_error": "cpp",
65+
"tuple": "cpp",
66+
"type_traits": "cpp",
67+
"utility": "cpp",
68+
"fstream": "cpp",
69+
"future": "cpp",
70+
"initializer_list": "cpp",
71+
"iomanip": "cpp",
72+
"iosfwd": "cpp",
73+
"iostream": "cpp",
74+
"istream": "cpp",
75+
"limits": "cpp",
76+
"mutex": "cpp",
77+
"new": "cpp",
78+
"ostream": "cpp",
79+
"scoped_allocator": "cpp",
80+
"shared_mutex": "cpp",
81+
"sstream": "cpp",
82+
"stdexcept": "cpp",
83+
"streambuf": "cpp",
84+
"thread": "cpp",
85+
"cfenv": "cpp",
86+
"typeindex": "cpp",
87+
"typeinfo": "cpp",
88+
"valarray": "cpp",
89+
"variant": "cpp",
90+
"*.idl": "cpp",
91+
"*.cpp": "cpp",
92+
"*.hpp": "cpp"
93+
},
94+
// Use Pylance as language server
95+
"python.languageServer": "Pylance",
96+
"python.analysis.extraPaths": [
97+
"/opt/dua-venv/lib/python3.12/site-packages/",
98+
"/opt/ros/jazzy/lib/python3.12/site-packages/",
99+
"/opt/ros/jazzy/local/lib/python3.12/dist-packages/",
100+
"/opt/ros/dua-utils/install/lib/python3.12/site-packages/",
101+
"/opt/ros/dua-utils/install/local/lib/python3.12/dist-packages/"
102+
// Add your own paths here!
103+
],
104+
// Autocomplete from ros python packages
105+
"python.autoComplete.extraPaths": [
106+
"/opt/dua-venv/lib/python3.12/site-packages/",
107+
"/opt/ros/jazzy/lib/python3.12/site-packages/",
108+
"/opt/ros/jazzy/local/lib/python3.12/dist-packages/",
109+
"/opt/ros/dua-utils/install/lib/python3.12/site-packages/",
110+
"/opt/ros/dua-utils/install/local/lib/python3.12/dist-packages/"
111+
// Add your own paths here!
112+
],
113+
// Environment file lets vscode find python files within workspace
114+
"python.envFile": "${workspaceFolder}/.env",
115+
// Use autopep8 for Python formatting
116+
"[python]": {
117+
"editor.defaultFormatter": "ms-python.autopep8"
118+
},
119+
"C_Cpp.default.intelliSenseMode": "linux-gcc-x64",
120+
"C_Cpp.formatting": "disabled",
121+
"uncrustify.configPath.linux": "/opt/ros/jazzy/lib/python3.12/site-packages/ament_uncrustify/configuration/ament_code_style_0_78.cfg",
122+
"[cpp]": {
123+
"editor.defaultFormatter": "zachflower.uncrustify"
124+
},
125+
"search.exclude": {
126+
"**/node_modules": true,
127+
"**/bower_components": true,
128+
"**/*.code-search": true,
129+
"**/build": true,
130+
"**/install": true,
131+
"**/log": true
132+
},
133+
"shellcheck.enable": true,
134+
"shellcheck.enableQuickFix": true,
135+
"shellcheck.run": "onType",
136+
"shellcheck.executablePath": "/usr/bin/shellcheck",
137+
"shellcheck.exclude": [
138+
"1091"
139+
],
140+
"shellcheck.customArgs": [],
141+
"shellcheck.ignorePatterns": {
142+
"**/*.xonshrc": true,
143+
"**/*.xsh": true,
144+
"**/*.zsh": true,
145+
"**/*.zshrc": true,
146+
"**/zshrc": true,
147+
"**/*.zprofile": true,
148+
"**/zprofile": true,
149+
"**/*.zlogin": true,
150+
"**/zlogin": true,
151+
"**/*.zlogout": true,
152+
"**/zlogout": true,
153+
"**/*.zshenv": true,
154+
"**/zshenv": true,
155+
"**/*.zsh-theme": true
156+
},
157+
"ros.distro": "jazzy"
158+
}

0 commit comments

Comments
 (0)