Skip to content

ci: fix arm64 cross-build apt sources using deb822 format #15

ci: fix arm64 cross-build apt sources using deb822 format

ci: fix arm64 cross-build apt sources using deb822 format #15

Workflow file for this run

name: Release
on:
push:
branches:
- dab_add_dockerfile
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v0.2.0)'
required: true
type: string
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
TAG_NAME: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
jobs:
build:
name: Build (${{ matrix.platform }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x86_64
- os: windows-latest
platform: windows-x86_64
- os: macos-latest
platform: macos-aarch64
steps:
- uses: actions/checkout@v4
# --- GStreamer installation (platform-specific) ---
- name: Install GStreamer (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-tools
- name: Install GStreamer (Windows)
if: runner.os == 'Windows'
run: choco install gstreamer gstreamer-devel --yes
- name: Set GStreamer environment (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$gstRoot = "C:\Program Files\gstreamer\1.0\msvc_x86_64"
Add-Content $env:GITHUB_PATH "$gstRoot\bin"
Add-Content $env:GITHUB_ENV "GSTREAMER_1_0_ROOT_MSVC_X86_64=$gstRoot"
Add-Content $env:GITHUB_ENV "LIB=$gstRoot\lib;$env:LIB"
- name: Install pkgconf via vcpkg (Windows)
if: runner.os == 'Windows'
run: |
vcpkg install pkgconf:x64-windows
echo "C:\vcpkg\installed\x64-windows\tools\pkgconf" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Set PKG_CONFIG_PATH (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Add-Content $env:GITHUB_ENV "PKG_CONFIG_PATH=C:\Program Files\gstreamer\1.0\msvc_x86_64\lib\pkgconfig"
- name: Install GStreamer (macOS)
if: runner.os == 'macOS'
run: brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly
# --- Rust toolchain and caching ---
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-release-
${{ runner.os }}-cargo-
# --- Build ---
- name: Build release binaries
run: cargo build --release --workspace
# --- Package ---
- name: Package artifacts (Unix)
if: runner.os != 'Windows'
run: |
mkdir staging
cp target/release/gst-pop staging/
cp target/release/gst-popctl staging/
cd staging
zip ../gst-pop-${{ env.TAG_NAME }}-${{ matrix.platform }}.zip gst-pop gst-popctl
- name: Package artifacts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path staging
Copy-Item target/release/gst-pop.exe staging/
Copy-Item target/release/gst-popctl.exe staging/
Compress-Archive -Path staging/* -DestinationPath gst-pop-${{ env.TAG_NAME }}-${{ matrix.platform }}.zip
# --- Upload for release job ---
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: gst-pop-${{ env.TAG_NAME }}-${{ matrix.platform }}
path: gst-pop-${{ env.TAG_NAME }}-${{ matrix.platform }}.zip
retention-days: 1
deb:
name: Debian package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
dpkg-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-pkg-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-pkg-
- name: Build release binaries
run: cargo build --release --workspace
- name: Get version
id: version
run: echo "version=$(grep -A1 '\[workspace.package\]' Cargo.toml | grep version | sed 's/.*"\(.*\)"/\1/')" >> "$GITHUB_OUTPUT"
- name: Build gst-pop .deb
run: |
PKG=gst-pop
VER=${{ steps.version.outputs.version }}
ARCH=$(dpkg --print-architecture)
DIR="${PKG}_${VER}_${ARCH}"
mkdir -p "$DIR/DEBIAN"
mkdir -p "$DIR/usr/bin"
mkdir -p "$DIR/usr/lib/systemd/user"
# Binary
install -Dm755 target/release/gst-pop "$DIR/usr/bin/gst-pop"
# Symlinks
ln -sf gst-pop "$DIR/usr/bin/gst-popd"
for cmd in launch inspect discover play; do
ln -sf gst-pop "$DIR/usr/bin/gst-pop-${cmd}"
done
# Systemd service
sed 's|@bindir@|/usr/bin|g' data/gst-pop.service.in > "$DIR/usr/lib/systemd/user/gst-pop.service"
# Control file
cat > "$DIR/DEBIAN/control" <<EOF
Package: gst-pop
Version: ${VER}
Section: multimedia
Priority: optional
Architecture: ${ARCH}
Depends: libgstreamer1.0-0 (>= 1.16), gstreamer1.0-plugins-base
Maintainer: Stéphane Cerveau <scerveau@igalia.com>
Homepage: https://github.com/dabrain34/GstPrinceOfParser
Description: GStreamer pipeline management daemon
GStreamer Prince of Parser (gst-pop) is a pipeline management
daemon with WebSocket and DBus interfaces for creating,
controlling, and monitoring GStreamer media pipelines remotely.
EOF
# Remove leading spaces from control file (heredoc indentation)
sed -i 's/^ //' "$DIR/DEBIAN/control"
dpkg-deb --build --root-owner-group "$DIR"
- name: Build gst-popctl .deb
run: |
PKG=gst-popctl
VER=${{ steps.version.outputs.version }}
ARCH=$(dpkg --print-architecture)
DIR="${PKG}_${VER}_${ARCH}"
mkdir -p "$DIR/DEBIAN"
mkdir -p "$DIR/usr/bin"
install -Dm755 target/release/gst-popctl "$DIR/usr/bin/gst-popctl"
cat > "$DIR/DEBIAN/control" <<EOF
Package: gst-popctl
Version: ${VER}
Section: multimedia
Priority: optional
Architecture: ${ARCH}
Depends: gst-pop (= ${VER})
Maintainer: Stéphane Cerveau <scerveau@igalia.com>
Homepage: https://github.com/dabrain34/GstPrinceOfParser
Description: WebSocket control client for gst-pop
Command-line control client for managing a gst-pop
daemon over WebSocket.
EOF
sed -i 's/^ //' "$DIR/DEBIAN/control"
dpkg-deb --build --root-owner-group "$DIR"
- name: Upload .deb artifacts
uses: actions/upload-artifact@v4
with:
name: deb-packages
path: '*.deb'
retention-days: 1
rpm:
name: Fedora RPM (${{ matrix.arch }})
runs-on: ubuntu-latest
container:
image: debian:testing
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
rust_target: x86_64-unknown-linux-gnu
deb_arch: amd64
cross: false
- arch: aarch64
rust_target: aarch64-unknown-linux-gnu
deb_arch: arm64
cross: true
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
dpkg --add-architecture ${{ matrix.deb_arch }}
apt-get update
apt-get install -y \
gcc \
curl \
pkg-config \
rpm \
libgstreamer1.0-dev:${{ matrix.deb_arch }} \
libgstreamer-plugins-base1.0-dev:${{ matrix.deb_arch }}
if [ "${{ matrix.cross }}" = "true" ]; then
apt-get install -y \
gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross
fi
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: debian-cargo-rpm-${{ matrix.arch }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
debian-cargo-rpm-${{ matrix.arch }}-
- name: Build release binaries
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
PKG_CONFIG_PATH_aarch64_unknown_linux_gnu: /usr/lib/aarch64-linux-gnu/pkgconfig
PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu: /
PKG_CONFIG_ALLOW_CROSS: 1
run: cargo build --release --workspace --target ${{ matrix.rust_target }}
- name: Get version
id: version
run: echo "version=$(grep -A1 '\[workspace.package\]' Cargo.toml | grep version | sed 's/.*"\(.*\)"/\1/')" >> "$GITHUB_OUTPUT"
- name: Build RPMs
run: |
VER=${{ steps.version.outputs.version }}
TARGET_DIR=target/${{ matrix.rust_target }}/release
mkdir -p rpmbuild/{SPECS,BUILDROOT,SOURCES}
cp ${TARGET_DIR}/gst-pop rpmbuild/SOURCES/
cp ${TARGET_DIR}/gst-popctl rpmbuild/SOURCES/
sed 's|@bindir@|/usr/bin|g' data/gst-pop.service.in > rpmbuild/SOURCES/gst-pop.service
cat > rpmbuild/SPECS/gst-pop.spec <<SPEC
Name: gst-pop
Version: ${VER}
Release: 1
Summary: GStreamer pipeline management daemon
License: GPL-3.0-only
URL: https://github.com/dabrain34/GstPrinceOfParser
BuildArch: ${{ matrix.arch }}
Requires: gstreamer1 >= 1.16
Requires: gstreamer1-plugins-base
%description
GStreamer Prince of Parser (gst-pop) is a pipeline management
daemon with WebSocket and DBus interfaces for creating,
controlling, and monitoring GStreamer media pipelines remotely.
%install
install -Dm755 %{_sourcedir}/gst-pop %{buildroot}%{_bindir}/gst-pop
ln -sf gst-pop %{buildroot}%{_bindir}/gst-popd
for cmd in launch inspect discover play; do
ln -sf gst-pop %{buildroot}%{_bindir}/gst-pop-\${cmd}
done
install -Dm644 %{_sourcedir}/gst-pop.service %{buildroot}/usr/lib/systemd/user/gst-pop.service
%files
%{_bindir}/gst-pop
%{_bindir}/gst-popd
%{_bindir}/gst-pop-launch
%{_bindir}/gst-pop-inspect
%{_bindir}/gst-pop-discover
%{_bindir}/gst-pop-play
/usr/lib/systemd/user/gst-pop.service
SPEC
sed -i 's/^ //' rpmbuild/SPECS/gst-pop.spec
cat > rpmbuild/SPECS/gst-popctl.spec <<SPEC
Name: gst-popctl
Version: ${VER}
Release: 1
Summary: WebSocket control client for gst-pop
License: GPL-3.0-only
URL: https://github.com/dabrain34/GstPrinceOfParser
BuildArch: ${{ matrix.arch }}
Requires: gst-pop = ${VER}
%description
Interactive command-line client for connecting to a gst-pop
daemon over WebSocket.
%install
install -Dm755 %{_sourcedir}/gst-popctl %{buildroot}%{_bindir}/gst-popctl
%files
%{_bindir}/gst-popctl
SPEC
sed -i 's/^ //' rpmbuild/SPECS/gst-popctl.spec
rpmbuild --define "_topdir $(pwd)/rpmbuild" \
--define "_sourcedir $(pwd)/rpmbuild/SOURCES" \
--target ${{ matrix.arch }}-linux \
-bb rpmbuild/SPECS/gst-pop.spec
rpmbuild --define "_topdir $(pwd)/rpmbuild" \
--define "_sourcedir $(pwd)/rpmbuild/SOURCES" \
--target ${{ matrix.arch }}-linux \
-bb rpmbuild/SPECS/gst-popctl.spec
find rpmbuild/RPMS/ -name '*.rpm' -exec cp {} . \;
- name: Upload RPM artifacts
uses: actions/upload-artifact@v4
with:
name: rpm-packages-${{ matrix.arch }}
path: '*.rpm'
retention-days: 1
docker:
name: Docker multi-arch image
needs: [rpm]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG_NAME }}
- name: Download RPM artifacts
uses: actions/download-artifact@v4
with:
path: docker/rpms
pattern: rpm-packages-*
merge-multiple: true
- name: List RPM artifacts
run: ls -la docker/rpms/
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
id: version
run: echo "version=${TAG_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: docker/
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
GST_POP_VERSION=${{ steps.version.outputs.version }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
${{ github.ref_type == 'tag' && format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max
release:
name: Create Release
needs: [build, deb, rpm, docker]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create source archive
run: |
git archive --format=tar.gz --prefix=gst-pop-${{ env.TAG_NAME }}/ \
-o gst-pop-${{ env.TAG_NAME }}-source.tar.gz HEAD
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List release artifacts
run: ls -la artifacts/ gst-pop-*-source.tar.gz
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG_NAME }}
name: gst-pop ${{ env.TAG_NAME }}
generate_release_notes: true
make_latest: "true"
fail_on_unmatched_files: true
files: |
artifacts/gst-pop-*.zip
artifacts/*.deb
artifacts/*.rpm
gst-pop-*-source.tar.gz