package: create debian package with prebuilds
The generated variants include raspi and non-raspi platforms.
This commit is contained in:
38
.github/ci/Dockerfile
vendored
Normal file
38
.github/ci/Dockerfile
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
ARG DOCKER_ARCH
|
||||
ARG DEBIAN_VERSION
|
||||
FROM ${DOCKER_ARCH}debian:${DEBIAN_VERSION} as build_env
|
||||
|
||||
# Default packages
|
||||
RUN apt-get -y update && apt-get -y install gnupg2 build-essential xxd cmake ccache git-core pkg-config \
|
||||
libavformat-dev libavutil-dev libavcodec-dev libssl-dev v4l-utils
|
||||
RUN apt-get -y install debhelper
|
||||
|
||||
# Add RPI packages
|
||||
ARG DEBIAN_VERSION
|
||||
ARG BUILD_TYPE="generic"
|
||||
RUN [ "$BUILD_TYPE" != "raspi" ] || \
|
||||
( \
|
||||
echo "deb http://archive.raspberrypi.org/debian/ $DEBIAN_VERSION main" > /etc/apt/sources.list.d/raspi.list && \
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E && \
|
||||
apt-get -y update && \
|
||||
apt-get -y install libcamera-dev liblivemedia-dev \
|
||||
)
|
||||
|
||||
FROM build_env as build
|
||||
ADD / /src
|
||||
WORKDIR /src
|
||||
RUN git clean -ffdx
|
||||
RUN git submodule update --init --recursive --recommend-shallow
|
||||
RUN git submodule foreach --recursive git clean -ffdx
|
||||
|
||||
FROM build as deb_make
|
||||
ARG GIT_VERSION
|
||||
ARG BUILD_TYPE="generic"
|
||||
ENV DEB_BUILD_PROFILES="$BUILD_TYPE"
|
||||
|
||||
RUN apt-get build-dep -y $PWD
|
||||
RUN . /etc/os-release && \
|
||||
export RELEASE_SUFFIX="$VERSION_CODENAME" && \
|
||||
dpkg-buildpackage -us -uc -b
|
||||
|
||||
RUN mkdir -p /deb && mv ../*.deb /deb/
|
27
.github/ci/build-env
vendored
Executable file
27
.github/ci/build-env
vendored
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -gt 2 ]]; then
|
||||
echo "usage: $0 <buster|bullseye> <amd64|arm32v7|arm64v8>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker_image="camera_streamer_build_env"
|
||||
|
||||
debian_version="bullseye"
|
||||
[[ -n "$1" ]] && debian_version="$1" && docker_image="${docker_image}_${1}"
|
||||
|
||||
docker_arch=""
|
||||
[[ -n "$2" ]] && docker_arch="$2/" && docker_image="${docker_image}_${2}"
|
||||
|
||||
PWD=$(pwd)
|
||||
ROOT=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../.." &> /dev/null && pwd)
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
docker build -t "$docker_image" \
|
||||
--build-arg "DOCKER_ARCH=$docker_arch" \
|
||||
--build-arg "DEBIAN_VERSION=$debian_version" \
|
||||
--build-arg BUILD_TYPE \
|
||||
--target build_env - < .github/ci/Dockerfile
|
||||
|
||||
exec docker run --rm -it -u "$UID" -v "$ROOT:$ROOT" -w "$ROOT" "$docker_image"
|
26
.github/workflows/build.yaml
vendored
26
.github/workflows/build.yaml
vendored
@ -1,26 +0,0 @@
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
debian_version: [buster, bullseye]
|
||||
docker_arch: [amd64, arm32v7, arm64v8]
|
||||
build_type: ["non-rpi", "rpi"]
|
||||
exclude:
|
||||
- docker_arch: amd64
|
||||
build_type: rpi
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Build Dockerfile
|
||||
run: docker build --build-arg DOCKER_ARCH --build-arg DEBIAN_VERSION --build-arg BUILD_TYPE .
|
||||
env:
|
||||
DEBIAN_VERSION: ${{ matrix.debian_version }}
|
||||
DOCKER_ARCH: ${{ matrix.docker_arch }}/
|
||||
BUILD_TYPE: ${{ matrix.build_type }}
|
61
.github/workflows/build_release.yaml
vendored
Normal file
61
.github/workflows/build_release.yaml
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
matrix:
|
||||
debian_version: [bullseye]
|
||||
docker_arch: [amd64, arm32v7, arm64v8]
|
||||
build_type: [generic, raspi]
|
||||
exclude:
|
||||
- docker_arch: amd64
|
||||
build_type: raspi
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Set GIT_VERSION
|
||||
shell: bash
|
||||
run: |
|
||||
majorVer=$(cat VERSION)
|
||||
lastVer=$(git tag --sort version:refname --list "v$majorVer.*" | tail -n1)
|
||||
if [[ -n "$lastVer" ]]; then
|
||||
newVer=(${lastVer//./ })
|
||||
newVer[-1]="$((${newVer[-1]}+1))"
|
||||
nextVer="${newVer[*]}"
|
||||
nextVer="${nextVer// /.}"
|
||||
else
|
||||
nextVer="$majorVer.0"
|
||||
fi
|
||||
echo "MajorVer=$majorVer LastVer=$lastVer NextVer=$nextVer"
|
||||
echo "GIT_VERSION=$nextVer" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Build Dockerfile
|
||||
run: docker build --target deb_make --tag deb_make --file .github/ci/Dockerfile --build-arg GIT_VERSION --build-arg DOCKER_ARCH --build-arg DEBIAN_VERSION --build-arg BUILD_TYPE .
|
||||
env:
|
||||
DEBIAN_VERSION: ${{ matrix.debian_version }}
|
||||
DOCKER_ARCH: ${{ matrix.docker_arch }}/
|
||||
BUILD_TYPE: ${{ matrix.build_type }}
|
||||
- name: Create container
|
||||
run: docker create --name deb_make deb_make
|
||||
- name: Copy files
|
||||
run: 'docker cp deb_make:/deb/. deb/'
|
||||
- name: 'Release debian files'
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ env.GIT_VERSION }}
|
||||
artifacts: "deb/*.deb"
|
||||
allowUpdates: true
|
||||
omitBodyDuringUpdate: true
|
||||
omitNameDuringUpdate: true
|
||||
updateOnlyUnreleased: true
|
||||
prerelease: true
|
||||
generateReleaseNotes: true
|
||||
bodyFile: RELEASE.md
|
44
.github/workflows/build_test.yaml
vendored
Normal file
44
.github/workflows/build_test.yaml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '.github/workflows/build_test.yaml'
|
||||
- 'RELEASE.md'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
debian_version: [buster, bullseye]
|
||||
docker_arch: [amd64, arm32v7, arm64v8]
|
||||
build_type: [generic, raspi]
|
||||
exclude:
|
||||
- docker_arch: amd64
|
||||
build_type: raspi
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Set GIT_VERSION
|
||||
run: echo "GIT_VERSION=$(git describe --tags)" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Build Dockerfile
|
||||
run: docker build --target deb_make --tag deb_make --file .github/ci/Dockerfile --build-arg GIT_VERSION --build-arg DOCKER_ARCH --build-arg DEBIAN_VERSION --build-arg BUILD_TYPE .
|
||||
env:
|
||||
DEBIAN_VERSION: ${{ matrix.debian_version }}
|
||||
DOCKER_ARCH: ${{ matrix.docker_arch }}/
|
||||
BUILD_TYPE: ${{ matrix.build_type }}
|
||||
- name: Create container
|
||||
run: docker create --name deb_make deb_make
|
||||
- name: Copy files
|
||||
run: docker cp deb_make:/deb/. deb/
|
||||
- name: 'Upload debian files'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.debian_version }}-${{ matrix.docker_arch }}-${{ matrix.build_type }}.zip
|
||||
path: deb/
|
||||
retention-days: 14
|
Reference in New Issue
Block a user