From 88a282614d4408e3b49c9668bc149450d63bdbda Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Wed, 5 Feb 2025 23:14:58 +0100 Subject: [PATCH] [GHA] Add Debian `build` CI workflow. --- .../docker/debian/bookworm/amd64/Dockerfile | 89 ++++++++++++++++++ .../docker/debian/bookworm/arm32v7/Dockerfile | 90 +++++++++++++++++++ .../docker/debian/bookworm/arm64v8/Dockerfile | 90 +++++++++++++++++++ .../docker/debian/bullseye/amd64/Dockerfile | 90 +++++++++++++++++++ .../docker/debian/bullseye/arm32v7/Dockerfile | 90 +++++++++++++++++++ .../docker/debian/bullseye/arm64v8/Dockerfile | 90 +++++++++++++++++++ .github/workflows/build.yml | 52 +++++++++++ configure.ac | 4 +- 8 files changed, 593 insertions(+), 2 deletions(-) create mode 100644 .github/docker/debian/bookworm/amd64/Dockerfile create mode 100644 .github/docker/debian/bookworm/arm32v7/Dockerfile create mode 100644 .github/docker/debian/bookworm/arm64v8/Dockerfile create mode 100644 .github/docker/debian/bullseye/amd64/Dockerfile create mode 100644 .github/docker/debian/bullseye/arm32v7/Dockerfile create mode 100644 .github/docker/debian/bullseye/arm64v8/Dockerfile create mode 100644 .github/workflows/build.yml diff --git a/.github/docker/debian/bookworm/amd64/Dockerfile b/.github/docker/debian/bookworm/amd64/Dockerfile new file mode 100644 index 00000000..5fdb16fe --- /dev/null +++ b/.github/docker/debian/bookworm/amd64/Dockerfile @@ -0,0 +1,89 @@ +ARG BUILDER_IMAGE=debian:bookworm-20240513 + +FROM ${BUILDER_IMAGE} AS builder +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +ARG CODENAME=bookworm +ARG ARCH=amd64 + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data + +LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -q update \ + && apt-get -y -q install \ + apt-transport-https \ + autoconf \ + automake \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + docbook-xsl \ + dos2unix \ + doxygen \ + dpkg-dev \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ + && echo "export ARCH=${ARCH}" | tee -a ~/.env \ + && chmod +x ~/.env + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} + +RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" \ + | tee -a ~/.env + +RUN apt-get -q update \ + && mk-build-deps \ + --install \ + --remove debian/control \ + --tool "apt-get -y --no-install-recommends" \ + && apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" + +RUN . ~/.env \ + && dch \ + --controlmaint \ + --distribution "${CODENAME}" \ + --force-bad-version \ + --force-distribution \ + --newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + "Nightly build, ${GIT_SHA}" \ + && debuild \ + --no-tgz-check \ + --build=binary \ + --unsigned-source \ + --unsigned-changes \ + && mkdir OUT \ + && mv -v ../*.{deb,changes} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bookworm/arm32v7/Dockerfile b/.github/docker/debian/bookworm/arm32v7/Dockerfile new file mode 100644 index 00000000..d3669eb3 --- /dev/null +++ b/.github/docker/debian/bookworm/arm32v7/Dockerfile @@ -0,0 +1,90 @@ +ARG BUILDER_IMAGE=arm32v7/debian:bookworm-20240513 + +FROM --platform=linux/arm/v7 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +ARG CODENAME=bookworm +ARG ARCH=arm32 + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data + +LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -q update \ + && apt-get -y -q install \ + apt-transport-https \ + autoconf \ + automake \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + docbook-xsl \ + dos2unix \ + doxygen \ + dpkg-dev \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ + && echo "export ARCH=${ARCH}" | tee -a ~/.env \ + && chmod +x ~/.env + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} + +RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" \ + | tee -a ~/.env + +RUN apt-get -q update \ + && mk-build-deps \ + --install \ + --remove debian/control \ + --tool "apt-get -y --no-install-recommends" \ + && apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" + +RUN . ~/.env \ + && dch \ + --controlmaint \ + --distribution "${CODENAME}" \ + --force-bad-version \ + --force-distribution \ + --newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + "Nightly build, ${GIT_SHA}" \ + && debuild \ + --no-tgz-check \ + --build=binary \ + --unsigned-source \ + --unsigned-changes \ + && mkdir OUT \ + && mv -v ../*.{deb,changes} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bookworm/arm64v8/Dockerfile b/.github/docker/debian/bookworm/arm64v8/Dockerfile new file mode 100644 index 00000000..35f97001 --- /dev/null +++ b/.github/docker/debian/bookworm/arm64v8/Dockerfile @@ -0,0 +1,90 @@ +ARG BUILDER_IMAGE=arm64v8/debian:bookworm-20240513 + +FROM --platform=linux/arm64 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +ARG CODENAME=bookworm +ARG ARCH=arm64 + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data + +LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -q update \ + && apt-get -y -q install \ + apt-transport-https \ + autoconf \ + automake \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + docbook-xsl \ + dos2unix \ + doxygen \ + dpkg-dev \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ + && echo "export ARCH=${ARCH}" | tee -a ~/.env \ + && chmod +x ~/.env + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} + +RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" \ + | tee -a ~/.env + +RUN apt-get -q update \ + && mk-build-deps \ + --install \ + --remove debian/control \ + --tool "apt-get -y --no-install-recommends" \ + && apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" + +RUN . ~/.env \ + && dch \ + --controlmaint \ + --distribution "${CODENAME}" \ + --force-bad-version \ + --force-distribution \ + --newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + "Nightly build, ${GIT_SHA}" \ + && debuild \ + --no-tgz-check \ + --build=binary \ + --unsigned-source \ + --unsigned-changes \ + && mkdir OUT \ + && mv -v ../*.{deb,changes} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/amd64/Dockerfile b/.github/docker/debian/bullseye/amd64/Dockerfile new file mode 100644 index 00000000..249cda40 --- /dev/null +++ b/.github/docker/debian/bullseye/amd64/Dockerfile @@ -0,0 +1,90 @@ +ARG BUILDER_IMAGE=debian:bullseye-20240513 + +FROM ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +ARG CODENAME=bullseye +ARG ARCH=amd64 + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data + +LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -q update \ + && apt-get -y -q install \ + apt-transport-https \ + autoconf \ + automake \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + docbook-xsl \ + dos2unix \ + doxygen \ + dpkg-dev \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ + && echo "export ARCH=${ARCH}" | tee -a ~/.env \ + && chmod +x ~/.env + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} + +RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" \ + | tee -a ~/.env + +RUN apt-get -q update \ + && mk-build-deps \ + --install \ + --remove debian/control \ + --tool "apt-get -y --no-install-recommends" \ + && apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" + +RUN . ~/.env \ + && dch \ + --controlmaint \ + --distribution "${CODENAME}" \ + --force-bad-version \ + --force-distribution \ + --newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + "Nightly build, ${GIT_SHA}" \ + && debuild \ + --no-tgz-check \ + --build=binary \ + --unsigned-source \ + --unsigned-changes \ + && mkdir OUT \ + && mv -v ../*.{deb,changes} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/arm32v7/Dockerfile b/.github/docker/debian/bullseye/arm32v7/Dockerfile new file mode 100644 index 00000000..5f3fe71f --- /dev/null +++ b/.github/docker/debian/bullseye/arm32v7/Dockerfile @@ -0,0 +1,90 @@ +ARG BUILDER_IMAGE=arm32v7/debian:bullseye-20240513 + +FROM --platform=linux/arm/v7 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +ARG CODENAME=bullseye +ARG ARCH=arm32 + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data + +LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -q update \ + && apt-get -y -q install \ + apt-transport-https \ + autoconf \ + automake \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + docbook-xsl \ + dos2unix \ + doxygen \ + dpkg-dev \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ + && echo "export ARCH=${ARCH}" | tee -a ~/.env \ + && chmod +x ~/.env + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} + +RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" \ + | tee -a ~/.env + +RUN apt-get -q update \ + && mk-build-deps \ + --install \ + --remove debian/control \ + --tool "apt-get -y --no-install-recommends" \ + && apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" + +RUN . ~/.env \ + && dch \ + --controlmaint \ + --distribution "${CODENAME}" \ + --force-bad-version \ + --force-distribution \ + --newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + "Nightly build, ${GIT_SHA}" \ + && debuild \ + --no-tgz-check \ + --build=binary \ + --unsigned-source \ + --unsigned-changes \ + && mkdir OUT \ + && mv -v ../*.{deb,changes} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/arm64v8/Dockerfile b/.github/docker/debian/bullseye/arm64v8/Dockerfile new file mode 100644 index 00000000..110984a5 --- /dev/null +++ b/.github/docker/debian/bullseye/arm64v8/Dockerfile @@ -0,0 +1,90 @@ +ARG BUILDER_IMAGE=arm64v8/debian:bullseye-20240513 + +FROM --platform=linux/arm64 ${BUILDER_IMAGE} AS builder + +ARG MAINTAINER_NAME="Andrey Volk" +ARG MAINTAINER_EMAIL="andrey@signalwire.com" + +ARG CODENAME=bullseye +ARG ARCH=arm64 + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG DATA_DIR=/data + +LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -q update \ + && apt-get -y -q install \ + apt-transport-https \ + autoconf \ + automake \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + docbook-xsl \ + dos2unix \ + doxygen \ + dpkg-dev \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ + && echo "export ARCH=${ARCH}" | tee -a ~/.env \ + && chmod +x ~/.env + +RUN git config --global --add safe.directory '*' \ + && git config --global user.name "${MAINTAINER_NAME}" \ + && git config --global user.email "${MAINTAINER_EMAIL}" + +# Bootstrap and Build +COPY . ${DATA_DIR} +WORKDIR ${DATA_DIR} + +RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" \ + | tee -a ~/.env + +RUN apt-get -q update \ + && mk-build-deps \ + --install \ + --remove debian/control \ + --tool "apt-get -y --no-install-recommends" \ + && apt-get -y -f install + +ENV DEB_BUILD_OPTIONS="parallel=1" + +RUN . ~/.env \ + && dch \ + --controlmaint \ + --distribution "${CODENAME}" \ + --force-bad-version \ + --force-distribution \ + --newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ + "Nightly build, ${GIT_SHA}" \ + && debuild \ + --no-tgz-check \ + --build=binary \ + --unsigned-source \ + --unsigned-changes \ + && mkdir OUT \ + && mv -v ../*.{deb,changes} OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f2092e32 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,52 @@ +name: Build + +on: + pull_request: + push: + branches: + - master + paths: + - "**" + workflow_dispatch: + +concurrency: + group: ${{ github.head_ref || github.ref }} + +jobs: + deb: + name: 'DEB' + permissions: + id-token: write + contents: read + uses: signalwire/actions-template/.github/workflows/cicd-docker-build-and-distribute.yml@main + strategy: + # max-parallel: 1 + fail-fast: false + matrix: + os: + - debian + version: + - bookworm + - bullseye + platform: + - name: amd64 + runner: ubuntu-latest + - name: arm32v7 + runner: ubuntu-24.04-arm + - name: arm64v8 + runner: ubuntu-24.04-arm + with: + RUNNER: ${{ matrix.platform.runner }} + ARTIFACTS_PATTERN: '.*\.(deb)$' + DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/Dockerfile + MAINTAINER: 'Andrey Volk ' + META_FILE_PATH_PREFIX: /var/www/spandsp/public/unstable/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }} + PLATFORM: ${{ matrix.platform.name }} + TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-public-unstable-artifact + UPLOAD_BUILD_ARTIFACTS: false + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} + HOSTNAME: ${{ secrets.HOSTNAME }} + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} diff --git a/configure.ac b/configure.ac index 96fd0226..fa872453 100644 --- a/configure.ac +++ b/configure.ac @@ -269,8 +269,8 @@ if test "${build}" = "${host}" then case "${host}" in x86_64-*) - # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set - AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='${exec_prefix}/lib64') + # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set, Debian has special layout also consider this. + AX_CHECK_REAL_FILE([${prefix}/lib/x86_64-linux-gnu], [libdir='${exec_prefix}/lib/x86_64-linux-gnu'], [AX_CHECK_REAL_FILE([${prefix}/lib64], [libdir='${exec_prefix}/lib64'])]) AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"])) # The very oldest AMD 64 bit chips support SSE2, SSE and MMX enable_sse2="yes"