Skip to content

Commit b2c1229

Browse files
add: debian build and publish
* add: debian build * fix: install rule * change: del install file on single binary package * fix: AC_INIT generation
1 parent 67388c1 commit b2c1229

9 files changed

Lines changed: 389 additions & 31 deletions

.github/workflows/build-deb.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build and Publish Debian Package
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
env:
10+
DEB_BUILD_OPTIONS: nocheck # or whatever options you need
11+
strategy:
12+
matrix:
13+
distro: [debian-bookworm, debian-bullseye, ubuntu-24.04, ubuntu-22.04]
14+
include:
15+
- distro: debian-bookworm
16+
image: debian:bookworm
17+
os: debian
18+
version: bookworm
19+
- distro: debian-bullseye
20+
image: debian:bullseye
21+
os: debian
22+
version: bullseye
23+
- distro: ubuntu-24.04
24+
image: ubuntu:24.04
25+
os: ubuntu
26+
version: noble
27+
- distro: ubuntu-22.04
28+
image: ubuntu:22.04
29+
os: ubuntu
30+
version: jammy
31+
container:
32+
image: ${{ matrix.image }}
33+
steps:
34+
- name: Setup dependencies
35+
run: |
36+
apt-get update
37+
apt-get install -y build-essential devscripts debhelper autotools-dev autoconf-archive pkg-config fakeroot sed git tar gzip python3-pip python3-venv curl jq libyaml-cpp-dev
38+
39+
curl -1sLf 'https://dl.cloudsmith.io/basic/robertburger/robotkernel/setup.deb.sh' | bash
40+
apt-get update
41+
apt-get install -y robotkernel-service-helper robotkernel-dev service-provider-process-data-inspection-dev
42+
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Mark working directory as safe
47+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
48+
49+
- name: update branch name
50+
run: |
51+
VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
52+
sed "s|PACKAGE_VERSION|$VERSION|" configure.ac.in > configure.ac
53+
env:
54+
GITHUB_REF_NAME: ${{ github.ref_name }}
55+
56+
- name: Build .deb package
57+
run: |
58+
# baue mit dpkg-buildpackage (ohne signieren)
59+
dpkg-buildpackage -us -uc -d
60+
61+
- name: Collect .deb artifact
62+
run: |
63+
mkdir -p artifacts/${{ matrix.os }}/${{ matrix.version }}
64+
mv ../module-posix-timer*.deb artifacts/${{ matrix.os }}/${{ matrix.version }}
65+
66+
- name: Set sanitized image name
67+
id: sanitize
68+
run: |
69+
version=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
70+
echo "sanitized_image=$(echo "$version-$IMAGE" | tr '/:' '--')" >> $GITHUB_OUTPUT
71+
env:
72+
IMAGE: ${{ matrix.image }}
73+
74+
- name: Upload .deb package
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: module-posix-timer-${{ steps.sanitize.outputs.sanitized_image }}.deb
78+
path: artifacts/${{ matrix.os }}/${{ matrix.version }}/*.deb
79+
80+
- name: Upload to Cloudsmith (${{ matrix.os }}/${{ matrix.version }})
81+
env:
82+
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
83+
shell: bash
84+
run: |
85+
VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: //p')
86+
FILENAME="artifacts/${{ matrix.os }}/${{ matrix.version }}/module-posix-timer_${VERSION}_amd64.deb"
87+
88+
python3 -m venv cloudsmith
89+
cd cloudsmith
90+
source bin/activate
91+
92+
python3 -m pip install --upgrade pip
93+
pip3 install cloudsmith-cli
94+
95+
cloudsmith push deb robertburger/robotkernel/${{ matrix.os }}/${{ matrix.version }} ../${FILENAME} \
96+
--republish \
97+
--api-key "$CLOUDSMITH_API_KEY"

conanfile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ class MainProject(ConanFile):
1111
description = "module_posix_timer is used to generate deterministic triggers for other modules."
1212
exports_sources = ["*", "!.gitignore"]
1313
requires = ["robotkernel/[~6]@robotkernel/unstable", "service_provider_process_data_inspection/[~6]@robotkernel/unstable"]
14+
15+
def source(self):
16+
self.run(f"sed 's/AC_INIT(.*/AC_INIT([robotkernel], [{self.version}], [{self.author}])/' configure.ac.in > configure.ac")
17+

configure.ac renamed to configure.ac.in

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ([2.69])
5-
AC_INIT(
6-
[module_posix_timer],
7-
m4_esyscmd_s([cat project.properties | grep VERSION | cut -d'=' -f2 | xargs printf "%s"]),
8-
m4_esyscmd_s([cat project.properties | grep MAINTAINER | cut -d'=' -f2 | xargs printf "%s"]))
5+
AC_INIT([module_posix_timer], [PACKAGE_VERSION], [Robert Burger <robert.burger@dlr.de>])
96
AC_CANONICAL_TARGET
107
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
118
AC_CONFIG_HEADERS([config.h])
@@ -41,24 +38,6 @@ AC_CHECK_FUNCS([strdup])
4138
AC_CHECK_LIB(dl, dlopen)
4239
AC_CHECK_LIB(rt, timer_delete)
4340

44-
# Platform specific setup
45-
# Check for which host we are on and setup a few things
46-
# specifically based on the host
47-
case $target in
48-
*arm* )
49-
AC_DEFINE([ARCH_ARM], [], [Defined if the target CPU is arm])
50-
;;
51-
*amd64* )
52-
AC_DEFINE([ARCH_INTEL], [], [Defined if the target CPU is intel])
53-
;;
54-
*i?86* )
55-
AC_DEFINE([ARCH_INTEL], [], [Defined if the target CPU is intel])
56-
;;
57-
*x86_64* )
58-
AC_DEFINE([ARCH_INTEL], [], [Defined if the target CPU is intel])
59-
;;
60-
esac
61-
6241
AC_CONFIG_FILES([Makefile src/Makefile module_posix_timer.pc])
6342

6443
AC_OUTPUT

0 commit comments

Comments
 (0)