Skip to content

Commit

Permalink
Merge branch 'baresip:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
njeisecke authored Nov 15, 2024
2 parents ef2b8e9 + 7117ae4 commit 18a601f
Show file tree
Hide file tree
Showing 673 changed files with 45,248 additions and 24,197 deletions.
8 changes: 8 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
If:
PathMatch: [include/.*\.h]
CompileFlags:
Add: [-Wall, -DHAVE_INTTYPES_H, -include re.h, -include rem.h]
Remove: [-xobjective-c++-header]
---
Diagnostics:
Suppress: "-Wgnu-zero-variadic-macro-arguments"
132 changes: 132 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main
- stable

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
compiler: [gcc, clang, gcc-14]
os: [ubuntu-22.04, ubuntu-24.04, macos-latest]
exclude:
- os: macos-latest
compiler: gcc
- os: macos-latest
compiler: gcc-14
- os: ubuntu-22.04
compiler: gcc-14
env:
CC: ${{ matrix.compiler }}
MACOSX_DEPLOYMENT_TARGET: "10.12"

steps:
- uses: actions/checkout@v4

- name: openssl path macos
if: ${{ runner.os == 'macOS' }}
run: |
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl)" >> $GITHUB_ENV
- name: fix flaky azure mirrors
if: ${{ runner.os == 'Linux' }}
run: |
sudo sed -i 's/azure\./de\./' /etc/apt/sources.list
- name: Fix Ubuntu 22.04
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt-get update
sudo apt-get remove libunwind-14 -y
sudo apt-get install libunwind-dev libaom-dev libsdl2-dev -y
- name: install packages
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update && sudo apt-get install -y \
libasound2-dev \
libavcodec-dev \
libavdevice-dev \
libavformat-dev \
libcodec2-dev \
libfdk-aac-dev \
libglib2.0-dev \
libgstreamer1.0-dev \
libgtk-3-dev \
libjack-jackd2-dev \
libmosquitto-dev \
libmpg123-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libopus-dev \
libpulse-dev \
libsndfile1-dev \
libspandsp-dev \
libssl-dev \
libvpx-dev \
libx11-dev \
libwebrtc-audio-processing-dev
- name: install aac
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt-get update && sudo apt-get install -y libfdk-aac-dev
- name: install pipewire
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt-get update && sudo apt-get install -y libpipewire-0.3-dev
- name: install packages
if: ${{ runner.os == 'macOS' }}
run: |
brew install codec2 \
aom \
fdk-aac \
ffmpeg \
jack \
mpg123 \
spandsp \
sdl2 \
glib-utils \
pkg-config
- uses: sreimers/pr-dependency-action@v1
with:
name: re
repo: https://github.com/baresip/re
secret: ${{ secrets.GITHUB_TOKEN }}

- name: make re
run: |
cmake -S re -B re/build
cmake --build re/build -j
mv re ../.
- name: ldconfig
if: ${{ runner.os == 'Linux' }}
run: sudo ldconfig

- name: make baresip linux
if: ${{ runner.os == 'Linux' }}
run: |
cmake -B build -DCMAKE_C_FLAGS="-Werror" && cmake --build build -j
- name: make baresip macOS
if: ${{ runner.os == 'macOS' }}
run: |
cmake -B build -DCMAKE_C_FLAGS="-Werror" && cmake --build build -j
- name: baresip static
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
rm -Rf build
cmake -B build -DSTATIC=1 -DCMAKE_C_FLAGS="-Werror" && cmake --build build -j
61 changes: 61 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Coverage

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: fix flaky azure mirrors
if: ${{ runner.os == 'Linux' }}
run: |
sudo sed -i 's/azure\./de\./' /etc/apt/sources.list
- name: install packages
run: |
sudo apt-get update && sudo apt-get install -y libssl-dev
- uses: sreimers/pr-dependency-action@v1
with:
name: re
repo: https://github.com/baresip/re
secret: ${{ secrets.GITHUB_TOKEN }}

- name: make re
run: |
cmake -S re -B re/build
cmake --build re/build -j
mv re ../.
- name: ldconfig
run: sudo ldconfig

- name: make baresip selftest
run: cmake -B build -DSTATIC=1 -DCMAKE_C_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="--coverage" -DMODULES="g711;ausine;fakevideo;auconv;auresamp;dtls_srtp;srtp;aufile" && cmake --build build -j

- name: selftest
run: ./build/test/selftest

- name: gcov
run: |
gcov build/**/*.o
- name: install gcovr
run: |
pip install gcovr==5.0
- name: coverage check
run: |
min_cov="52.5"
cov=$(~/.local/bin/gcovr -r . -f src -s | grep lines | awk '{ print $2 }' | sed 's/%//')
echo "Coverage: ${cov}% (min $min_cov%)"
exit $(echo "$cov < $min_cov" | bc -l)
159 changes: 159 additions & 0 deletions .github/workflows/fedora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Build re and baresip almost the same way like they would be built in Fedora. This helps to avoid
# e.g. rpath issues, requires however the usage of rpmbuild(1) to use the same compiler flags and
# options like Fedora does. Just running 'RPM_BUILD_ROOT=<top-dir> /usr/lib/rpm/check-rpaths' on
# own builds without the Fedora-specific options effectively leads to garbage results. See also:
# https://github.com/baresip/baresip/issues/2849 and https://github.com/baresip/baresip/pull/2850
name: Fedora

on:
push:
branches:
- main
pull_request:
branches:
- main
- stable

jobs:
dependency:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: sreimers/pr-dependency-action@v1
with:
name: re
repo: https://github.com/baresip/re
secret: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v4
with:
name: re-fedora
path: re
retention-days: 1

build:
needs: dependency
runs-on: ubuntu-latest
container: fedora

steps:
- uses: actions/checkout@v4
with:
path: placeholder-0-build

- name: "Install build-time requirements"
run: |
# List of build-time requirements can be generated from Fedora's baresip.spec file like this:
#
# curl https://src.fedoraproject.org/rpms/baresip/raw/rawhide/f/baresip.spec 2> /dev/null | \
# gawk 'sub(/^BuildRequires:\s*/, "") { \
# if ($0 !~ /(cmake3|openssl[13]|libre-devel|devtoolset|desktop-file-utils|svg)/) { \
# gsub(/^%{_bindir}/, "/usr/bin"); print " \047" $0 "\047 \\" }}' | \
# sort -u | head -c -3
#
# Note: The rpm-build package is preinstalled in the Fedora build system by default, but not
# in Docker containers, thus it explicitly needs to be mentioned (and installed) here.
# The zlib-devel package is needed by re and thus not part of the Fedora baresip.spec.
dnf -y update && \
dnf -y install rpm-build zlib-devel \
'alsa-lib-devel' \
'cmake' \
'codec2-devel' \
'fdk-aac-free-devel' \
'gcc' \
'gcc-c++' \
'lame-devel' \
'libaom-devel' \
'libpng-devel' \
'libsndfile-devel' \
'libv4l-devel' \
'libvpx-devel' \
'libX11-devel' \
'libXext-devel' \
'mosquitto-devel' \
'mpg123-devel' \
'openssl-devel' \
'opus-devel' \
'pkgconfig(gio-unix-2.0)' \
'pkgconfig(glib-2.0)' \
'pkgconfig(glib-2.0) >= 2.32' \
'pkgconfig(gstreamer-1.0)' \
'pkgconfig(gtk+-3.0) >= 3.0' \
'pkgconfig(jack)' \
'pkgconfig(libpipewire-0.3)' \
'pkgconfig(libpulse)' \
'pkgconfig(vpx) >= 1.3.0' \
'portaudio-devel' \
'python3-devel' \
'SDL2-devel' \
'spandsp-devel' \
'speex-devel' \
'speexdsp-devel' \
'twolame-devel' \
'/usr/bin/gdbus-codegen'
- uses: actions/download-artifact@v4
with:
name: re-fedora
path: re/placeholder-0-build

- name: "Write placeholder RPM spec file"
# Use same placeholder RPM spec file until re and baresip need different %build commands
run: |
cat > placeholder.spec <<EOF
Summary: Placeholder
Name: placeholder
Version: 0
Release: 0
License: Placeholder
%description
Placeholder
%build
%cmake
%cmake_build
%install
%cmake_install
%files
/*
%changelog
* $(date +'%a %b %d %Y') Placeholder
- Placeholder
EOF
- name: "Write RPM macros configuration for re"
run: echo "%_builddir ${PWD}/re" > "${HOME}/.rpmmacros"

- name: "RPM %build re"
run: rpmbuild -bc --short-circuit placeholder.spec

- name: "RPM %install re"
# Runs 'RPM_BUILD_ROOT=<top-dir> /usr/lib/rpm/check-rpaths' at the end of %install
run: rpmbuild -bi --short-circuit placeholder.spec

- name: "Relocate re from RPM %{buildroot} to /"
run: |
cp -avT "${PWD}/re/placeholder-0-build/BUILDROOT/" / # Intermediate builddir since RPM 4.20
# isn't available externally, see https://github.com/rpm-software-management/rpm/issues/3147
rm -rf re # Baresip must not pick up this directory (or wrong rpaths are written to binaries)
- name: "Run ldconfig"
run: ldconfig

- name: "Add selftest to placeholder RPM spec file"
run: |
cat >> placeholder.spec <<EOF
%check
cd %{__cmake_builddir}
./test/selftest -d ../test/data/ -v
EOF
- name: "Write RPM macros configuration for baresip"
run: echo "%_builddir ${PWD}" > "${HOME}/.rpmmacros"

- name: "RPM %build baresip"
run: rpmbuild -bc --short-circuit placeholder.spec

- name: "RPM %install baresip"
# Runs 'RPM_BUILD_ROOT=<top-dir> /usr/lib/rpm/check-rpaths' at the end of %install
run: rpmbuild -bi --short-circuit placeholder.spec
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: lint

on: [push, pull_request]

jobs:
lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: ccheck
run: |
test/ccheck.py -e baresipbus.*
- name: CMakeLint
run: |
pip install cmakelint
find . -name "CMakeLists.txt" -exec ~/.local/bin/cmakelint {} +
find . -name "*.cmake" -exec ~/.local/bin/cmakelint {} +
- name: pylint
run: |
sudo apt-get update && sudo apt-get install -qy pylint
pylint tools/fritzbox2baresip
Loading

0 comments on commit 18a601f

Please sign in to comment.