Skip to content

Commit 6aa061e

Browse files
committed
add: github action and debian build files
1 parent 6f32c5b commit 6aa061e

9 files changed

Lines changed: 315 additions & 0 deletions

File tree

.github/workflows/build-deb.yaml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: Build and Publish Debian Package
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
create_release:
8+
if: startsWith(github.ref, 'refs/tags/')
9+
runs-on: ubuntu-latest
10+
outputs:
11+
upload_url: ${{ steps.create_release.outputs.upload_url }}
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- id: create_release
16+
uses: actions/create-release@v1
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
tag_name: ${{ github.ref_name }}
21+
release_name: Release ${{ github.ref_name }}
22+
body: Automated release for tag ${{ github.ref_name }}
23+
draft: false
24+
prerelease: false
25+
26+
build-deb:
27+
runs-on: ubuntu-latest
28+
env:
29+
DEB_BUILD_OPTIONS: "compress=gzip nocheck"
30+
PKGNAME: "module-sock-raw"
31+
strategy:
32+
matrix:
33+
distro: [debian-12, debian-11, ubuntu-24.04, ubuntu-22.04]
34+
include:
35+
- distro: debian-12
36+
image: debian:12
37+
os: debian
38+
version: bookworm
39+
- distro: debian-11
40+
image: debian:11
41+
os: debian
42+
version: bullseye
43+
- distro: ubuntu-24.04
44+
image: ubuntu:24.04
45+
os: ubuntu
46+
version: noble
47+
- distro: ubuntu-22.04
48+
image: ubuntu:22.04
49+
os: ubuntu
50+
version: jammy
51+
container:
52+
image: ${{ matrix.image }}
53+
54+
steps:
55+
- name: Install build dependencies
56+
shell: bash
57+
run: |
58+
apt-get update
59+
apt-get install -y build-essential devscripts debhelper autoconf-archive autotools-dev pkg-config sed git tar gzip curl jq libyaml-cpp-dev rsync
60+
61+
curl -fsSL https://deb.burger-system.de/setup.sh | bash > /dev/null
62+
apt-get update
63+
apt-get install -y robotkernel-service-helper robotkernel-dev service-provider-process-data-inspection-dev
64+
65+
- name: Checkout source
66+
uses: actions/checkout@v4
67+
with:
68+
fetch-depth: 0
69+
70+
- name: Mark working directory as safe
71+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
72+
73+
- name: update branch name and version
74+
run: |
75+
VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
76+
sed "s|PACKAGE_VERSION|$VERSION|" configure.ac.in > configure.ac
77+
78+
- name: Build .deb package
79+
shell: bash
80+
run: |
81+
# baue mit dpkg-buildpackage (ohne signieren)
82+
export DEBEMAIL="robert.burger@dlr.de"
83+
export DEBFULLNAME="Robert Burger"
84+
CODENAME=$(lsb_release -sc)
85+
VERSION=$(dpkg-parsechangelog --show-field Version)
86+
PRE_VERSION="pre${GITHUB_RUN_NUMBER}"
87+
88+
# Check if version already contains codename suffix
89+
if [[ "$VERSION" == *"~${CODENAME}"* || "$VERSION" == *"+${CODENAME}"* ]]; then
90+
echo "Version already contains codename suffix, skipping dch."
91+
else
92+
if [[ ! $GITHUB_REF =~ ^refs/tags/ ]]; then
93+
# Not a tag, so add ~pre<x>
94+
FULL_VERSION="${VERSION}~${PRE_VERSION}-1~${CODENAME}-pre"
95+
dch -b --newversion "${FULL_VERSION}" --distribution "${CODENAME}-pre" "Pre-release for ${CODENAME}-pre"
96+
else
97+
FULL_VERSION="${VERSION}-1~${CODENAME}"
98+
dch --newversion "${FULL_VERSION}" --distribution "${CODENAME}" "Pre-release for ${CODENAME}"
99+
fi
100+
fi
101+
102+
dpkg-buildpackage -us -uc -sa
103+
104+
- name: Debug artifact files
105+
run: |
106+
ls -l ../
107+
108+
- name: Set sanitized image name
109+
id: sanitize
110+
run: |
111+
version=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
112+
echo "sanitized_image=$(echo "${version}" | tr '/:' '--')" >> $GITHUB_OUTPUT
113+
114+
- name: Upload to APT repository
115+
env:
116+
DEPLOY_TOKEN: ${{ secrets.BS_UPLOAD_KEY }}
117+
shell: bash
118+
run: |
119+
DISTRO="${{ matrix.distro }}"
120+
SANITIZED_IMAGE="${{ steps.sanitize.outputs.sanitized_image }}"
121+
122+
if [[ "$DISTRO" == "ubuntu-24.04" || "$DISTRO" == "ubuntu-22.04" ]]; then
123+
OLD_EXT=".ddeb"
124+
NEW_EXT=".deb"
125+
126+
OLD_FILE="${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64${OLD_EXT}"
127+
NEW_FILE="${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64${NEW_EXT}"
128+
CHANGES_FILE="${PKGNAME}_${SANITIZED_IMAGE}_amd64.changes"
129+
130+
mv "../$OLD_FILE" "../$NEW_FILE"
131+
sed -i "s/${OLD_FILE}/${NEW_FILE}/g" "../$CHANGES_FILE"
132+
fi
133+
134+
DBG_FILE="../${PKGNAME}-dbgsym_${SANITIZED_IMAGE}_amd64.deb"
135+
DEB_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.deb"
136+
CHANGES_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.changes"
137+
BUILDINFO_FILE="../${PKGNAME}_${SANITIZED_IMAGE}_amd64.buildinfo"
138+
DSC_FILE="../${PKGNAME}_${SANITIZED_IMAGE}.dsc"
139+
TAR_FILE="../${PKGNAME}_${SANITIZED_IMAGE}.tar.gz"
140+
141+
for f in "$DEB_FILE" "$DBG_FILE" "$CHANGES_FILE" "$BUILDINFO_FILE" "$DSC_FILE" "$TAR_FILE"; do
142+
[[ -f "$f" ]] || { echo "Missing file: $f"; exit 1; }
143+
done
144+
145+
curl -X POST https://deb.burger-system.de/upload \
146+
-H "Authorization: Bearer $DEPLOY_TOKEN" \
147+
-F "deb=@$DEB_FILE" \
148+
-F "dbgsym=@$DBG_FILE" \
149+
-F "changes=@$CHANGES_FILE" \
150+
-F "buildinfo=@$BUILDINFO_FILE" \
151+
-F "dsc=@$DSC_FILE" \
152+
-F "source=@$TAR_FILE"
153+
154+
- name: Collect .deb artifact
155+
run: |
156+
mkdir -p artifacts/
157+
rsync -av --exclude=${PKGNAME} ../ artifacts/
158+
159+
- name: Upload .deb package artifact
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: ${{ env.PKGNAME }}-artifacts-${{ steps.sanitize.outputs.sanitized_image }}
163+
path: artifacts/
164+
165+
# Fetch the release upload URL dynamically on tag builds
166+
- name: Upload all artifacts to Release
167+
if: startsWith(github.ref, 'refs/tags/')
168+
env:
169+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170+
GITHUB_REF_NAME: ${{ github.ref_name }}
171+
run: |
172+
release_json=$(curl -sSL \
173+
-H "Authorization: token $GITHUB_TOKEN" \
174+
-H "Accept: application/vnd.github.v3+json" \
175+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${GITHUB_REF_NAME}")
176+
177+
upload_url=$(echo "$release_json" | jq -r '.upload_url' | sed -e "s/{?name,label}//")
178+
echo "Release upload URL: $upload_url"
179+
180+
if [ -d "./artifacts" ]; then
181+
for file in ./artifacts/*; do
182+
filename=$(basename "$file")
183+
echo "Uploading $file as $filename"
184+
curl --fail -X POST \
185+
-H "Authorization: token $GITHUB_TOKEN" \
186+
-H "Content-Type: application/octet-stream" \
187+
--data-binary @"$file" \
188+
"$upload_url?name=$filename"
189+
done
190+
else
191+
echo "Artifacts directory not found, skipping upload."
192+
fi

debian/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The Debian Package robotkernel-module-sock-raw
2+
----------------------------
3+
4+
Comments regarding the Package
5+
6+
-- Robert Burger <robert.burger@dlr.de> Thu, 01 Apr 2021 13:35:27 +0200

debian/README.Debian

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
robotkernel-module-sock-raw for Debian
2+
----------------------------------------
3+
4+
<possible notes regarding this package - if none, delete this file>
5+
6+
-- Robert Burger <robert.burger@dlr.de> Thu, 01 Apr 2021 13:35:27 +0200

debian/README.source

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
robotkernel-module-sock-raw for Debian
2+
----------------------------------------
3+
4+
<this file describes information about the source package, see Debian policy
5+
manual section 4.14. You WILL either need to modify or delete this file>
6+
7+
8+
9+
-- Robert Burger <robert.burger@dlr.de> Thu, 01 Apr 2021 13:35:27 +0200
10+

debian/changelog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module-sock-raw (6.0.0) unstable; urgency=low
2+
3+
* fix: build against robotkernel 6
4+
5+
-- Robert Burger <robert.burger@dlr.de> Mon, 26 Jan 2026 10:33:35 +0100
6+
7+
module-sock-raw () unstable; urgency=low
8+
9+
* fix: build against robotkernel 6
10+
* fix: remove osal include
11+
* add: initial import
12+
13+
-- Robert Burger <robert.burger@dlr.de> Mon, 26 Jan 2026 10:33:35 +0100
14+

debian/control

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Source: module-sock-raw
2+
Section: embedded
3+
Priority: optional
4+
Maintainer: Robert Burger <robert.burger@dlr.de>
5+
Build-Depends: debhelper-compat (= 13), robotkernel-dev (>=6), service-provider-process-data-inspection-dev (>=6)
6+
Standards-Version: 4.5.1
7+
Homepage: https://www.burger-system.de/robotkernel/module_sock_raw
8+
Vcs-Browser: https://github.com/robotkernel-hal/module_sock_raw.git
9+
Vcs-Git: https://github.com/robotkernel-hal/module_sock_raw.git
10+
Rules-Requires-Root: no
11+
12+
Package: module-sock-raw
13+
Architecture: any
14+
Multi-Arch: same
15+
Depends: robotkernel ${misc:Depends}
16+
Description: Robotkernel module to generate deterministic triggers for other modules.
17+
It supports three different modes.
18+
nanosleep: In this mode the **module_sock_raw** main thread just does a nanosleep until the period time has been elapsed. If the nanosleep call was interrupted by some signal it will sleep until the calculated period end time has been reached. This mode is easy and efficient as well. The **module_sock_raw*** thread should run at a very high priority to ensure, that it will be waken up when it's necessary.
19+
sock_raw: This mode creates a timer with timer_create. It configures the timer and connects it to the given signal number from the configuration string.
20+
busywait: In busywait the timer threads does active wait on the cpu and consumes all cpu time. This can cause higher power consumption and higher temperature (But on a PREEMPT-RT system that should not matter).

debian/copyright

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: robotkernel-module-sock-raw
3+
Upstream-Contact: <preferred name and address to reach the upstream project>
4+
Source: <url://example.com>
5+
6+
Files: *
7+
Copyright: <years> <put author's name and email here>
8+
<years> <likewise for another author>
9+
License: GPL-3.0+
10+
11+
Files: debian/*
12+
Copyright: 2021 Robert Burger <robert.burger@dlr.de>
13+
License: GPL-3.0+
14+
15+
License: GPL-3.0+
16+
This program is free software: you can redistribute it and/or modify
17+
it under the terms of the GNU General Public License as published by
18+
the Free Software Foundation, either version 3 of the License, or
19+
(at your option) any later version.
20+
.
21+
This package is distributed in the hope that it will be useful,
22+
but WITHOUT ANY WARRANTY; without even the implied warranty of
23+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24+
GNU General Public License for more details.
25+
.
26+
You should have received a copy of the GNU General Public License
27+
along with this program. If not, see <https://www.gnu.org/licenses/>.
28+
.
29+
On Debian systems, the complete text of the GNU General
30+
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
31+
32+
# Please also look if there are files or directories which have a
33+
# different copyright/license attached and list them here.
34+
# Please avoid picking licenses with terms that are more restrictive than the
35+
# packaged work, as it may make Debian's contributions unacceptable upstream.
36+
#
37+
# If you need, there are some extra license texts available in two places:
38+
# /usr/share/debhelper/dh_make/licenses/
39+
# /usr/share/common-licenses/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
README.Debian
2+
README.source
3+
README

debian/rules

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/make -f
2+
# See debhelper(7) (uncomment to enable)
3+
# output every command that modifies files on the build system.
4+
# export DH_VERBOSE = 1
5+
6+
# see FEATURE AREAS in dpkg-buildflags(1)
7+
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
8+
9+
# see ENVIRONMENT in dpkg-buildflags(1)
10+
# package maintainers to append CFLAGS
11+
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
12+
# package maintainers to append LDFLAGS
13+
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
14+
15+
%:
16+
dh $@
17+
18+
override_dh_builddeb:
19+
dh_builddeb -- -Zgzip
20+
21+
# dh_make generated override targets
22+
# This is example for Cmake (See https://bugs.debian.org/641051 )
23+
#override_dh_auto_configure:
24+
# dh_auto_configure -- \
25+
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

0 commit comments

Comments
 (0)