freedv-gui/.github/workflows/cmake-linux.yml

496 lines
18 KiB
YAML

name: Build FreeDV (Linux)
on:
push:
branches-ignore:
- 'dr-render-manual'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install required packages
shell: bash
run: |
sudo apt-get update
sudo apt-get install codespell libpulse-dev libspeexdsp-dev libsamplerate0-dev sox git portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev xvfb pipewire pulseaudio-utils pipewire-pulse wireplumber metacity at-spi2-core libebur128-dev libwxgtk3.2-dev pipewire pipewire-pulse wireplumber python3-numpy python3-numpy-dev python3-dev
- name: Spellcheck codebase
shell: bash
run: codespell --ignore-words-list=numer,caf,radae,rade,inout,nin,ontop,parm,tthe,ue `find src -name '*.c*' -o -name '*.h' | grep -v 3rdparty`
- name: Install LLVM/Clang >=20.0 (Required for clang-tidy)
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22
sudo apt-get install clang-tidy
- name: Generate compile_commands.json
run: |
mkdir build_linux
cd build_linux
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
# Partially build so we have all required .h and .c/.cpp files
make -j$(nproc) build_mimalloc build_rade build_codec2 build_rade_integ
- name: Run clang-tidy on codebase
working-directory: ${{github.workspace}}/build_linux
run: |
run-clang-tidy-22 -p .
build-appimage:
needs: lint
env:
FREEDV_LINUX_CODE_SIGNING_KEY_ID: ${{ secrets.FREEDV_LINUX_CODE_SIGNING_KEY_ID }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04-arm, ubuntu-22.04]
target: [all, freedv-ka9q, freedv-flex]
exclude:
- os: ubuntu-22.04
target: freedv-flex # Only supported on aarch64
runs-on: ${{ matrix.os }}
outputs:
APPIMAGE_FILENAME: ${{ steps.appimage-filename.outputs.APPIMAGE_FILENAME }}
steps:
- uses: actions/checkout@v4
- name: Install required packages
shell: bash
run: |
sudo apt-get update
sudo apt-get install libpulse-dev sox git libasound2-dev libao-dev libgsm1-dev xvfb pipewire pulseaudio-utils pipewire-pulse wireplumber metacity at-spi2-core libdbus-1-dev libgtk-3-dev python3.11-full python3.11-dev python3.11-venv libebur128-dev
- name: Install Python required modules
shell: bash
working-directory: ${{github.workspace}}
run: |
python3.11 -m venv rade-venv
. ./rade-venv/bin/activate
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
pip3 install matplotlib
- name: Set up Docker Buildx
if: ${{ matrix.target == 'freedv-flex' }}
uses: docker/setup-buildx-action@v3
- name: Build freedv-gui using PulseAudio
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.target == 'all' }}
run: |
. ./rade-venv/bin/activate
./build_linux.sh
- name: Build target
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.target != 'all' }}
run: |
. ./rade-venv/bin/activate
mkdir build_linux
cd build_linux
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_NATIVE_AUDIO=1 ..
make -j$(nproc) ${{ matrix.target }}
- name: Initialize GPG keys
if: ${{ env.FREEDV_LINUX_CODE_SIGNING_KEY != '' }}
env:
FREEDV_LINUX_CODE_SIGNING_KEY: ${{ secrets.FREEDV_LINUX_CODE_SIGNING_KEY }}
FREEDV_LINUX_CODE_SIGNING_PUBLIC_KEY: ${{ secrets.FREEDV_LINUX_CODE_SIGNING_PUBLIC_KEY }}
run: |
cat <<EOF >tmp_private.pem
${{ env.FREEDV_LINUX_CODE_SIGNING_KEY }}
EOF
cat <<EOF >tmp_public.pem
${{ env.FREEDV_LINUX_CODE_SIGNING_PUBLIC_KEY }}
EOF
gpg --import tmp_public.pem
gpg --import tmp_private.pem
- name: Build AppImage (unsigned)
if: ${{ env.FREEDV_LINUX_CODE_SIGNING_KEY == '' }}
shell: bash
working-directory: ${{github.workspace}}/appimage
run: |
./make-appimage.sh ${{ matrix.target }}
- name: Build AppImage (signed)
if: ${{ env.FREEDV_LINUX_CODE_SIGNING_KEY != '' }}
shell: bash
working-directory: ${{github.workspace}}/appimage
run: |
LDAI_SIGN=1 LDAI_SIGN_KEY="${{ env.FREEDV_LINUX_CODE_SIGNING_KEY_ID }}" ./make-appimage.sh ${{ matrix.target }}
- name: Calculate AppImage filename
shell: bash
id: appimage-filename
working-directory: ${{github.workspace}}/appimage
run: |
echo "APPIMAGE_FILENAME=$(echo -n FreeDV*.AppImage)" >> "$GITHUB_OUTPUT"
- name: Generate waveform file
shell: bash
working-directory: ${{github.workspace}}/src/integrations/flex
if: ${{ matrix.target == 'freedv-flex' }}
run: |
cp ${{github.workspace}}/appimage/${{ steps.appimage-filename.outputs.APPIMAGE_FILENAME }} FreeDV-FlexRadio.AppImage
./FreeDV-FlexRadio.AppImage --appimage-extract
ls -lR squashfs-root
docker buildx build --output type=oci,compression=gzip,dest=freedv-waveform.tar.gz --tag=freedv-waveform .
- name: Upload AppImage
uses: actions/upload-artifact@v4
with:
name: ${{ steps.appimage-filename.outputs.APPIMAGE_FILENAME }}
path: ${{github.workspace}}/appimage/${{ steps.appimage-filename.outputs.APPIMAGE_FILENAME }}
compression-level: 0
- name: Upload waveform file
uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'freedv-flex' }}
with:
name: freedv-waveform.tar.gz
path: ${{github.workspace}}/src/integrations/flex/freedv-waveform.tar.gz
test-appimage-fedora:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04-arm, ubuntu-24.04]
runs-on: ${{ matrix.os }}
needs: [build-appimage]
steps:
- uses: actions/checkout@v4
- name: Save correct architecture
id: save-arch
run: |
echo "APPIMAGE_ARCH=$(uname -m)" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: FreeDV-2*-${{ steps.save-arch.outputs.APPIMAGE_ARCH }}.AppImage
path: ${{github.workspace}}
- name: Start Fedora container
shell: bash
run: |
sudo podman run -d --name fedora-test --systemd=always --privileged -v ${{github.workspace}}:/workspace docker.io/jrei/systemd-fedora:42
- name: Install rtkit for RT threading
shell: bash
run: |
sudo podman exec fedora-test sudo dnf -y update
sudo podman exec fedora-test sudo dnf -y install dbus dbus-x11 dbus-tools rtkit dbus-devel polkit
sudo podman exec fedora-test sudo sed -i 's/no/yes/g' /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy
- name: Install required packages for audio/display
shell: bash
run: |
sudo podman exec fedora-test sudo dnf -y install sox xorg-x11-server-Xvfb pipewire pipewire-pulseaudio pulseaudio-libs-devel pulseaudio-utils wireplumber metacity python3-matplotlib python3-torch sox git
- name: Sanity check RADE
shell: bash
working-directory: ${{github.workspace}}
run: |
chmod +x *.AppImage
echo "FREEDV_BINARY=./$(echo -n *.AppImage) --appimage-extract-and-run" > tmp.env
sudo podman exec --env-file ./tmp.env fedora-test /workspace/appimage/container-test.sh | tee tmp.log
grep "PASS" tmp.log
test-appimage-ubuntu:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-22.04-arm, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
needs: [build-appimage]
steps:
- uses: actions/checkout@v4
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
- name: Save correct architecture
id: save-arch
run: |
echo "APPIMAGE_ARCH=$(uname -m)" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: FreeDV-2*-${{ steps.save-arch.outputs.APPIMAGE_ARCH }}.AppImage
path: ${{github.workspace}}
- name: Install rtkit for RT threading
shell: bash
run: |
sudo apt-get update
sudo apt-get install dbus-x11 rtkit libdbus-1-dev polkitd
sudo sed -i 's/no/yes/g' /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy
sudo systemctl restart polkit
- name: Install required packages for audio/display
shell: bash
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm' }}
run: |
sudo apt-get install sox xvfb pipewire pulseaudio-utils pipewire-pulse wireplumber metacity
- name: Install required packages for audio/display
shell: bash
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-22.04-arm' }}
run: |
sudo apt-get install sox xvfb pulseaudio pulseaudio-utils metacity
systemctl --user --now enable pulseaudio.service pulseaudio.socket
- name: Create Python venv
shell: bash
working-directory: ${{github.workspace}}
run: |
python3 -m venv rade-venv
- name: Install Python required modules
shell: bash
working-directory: ${{github.workspace}}
run: |
. ./rade-venv/bin/activate
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
pip3 install matplotlib
- name: Sanity check RADE
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-22.04-arm' }}
run: |
sudo systemctl enable rtkit-daemon
sudo systemctl start rtkit-daemon
Xvfb :99 -screen 0 1024x768x16 &
sleep 5
export DISPLAY=:99.0
export XDG_RUNTIME_DIR=/run/user/$(id -u)
mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
eval "$(dbus-launch --sh-syntax --exit-with-x11)"
metacity --sm-disable --replace &
sleep 5
. ./rade-venv/bin/activate
chmod +x *.AppImage
FREEDV_BINARY=./$(echo -n *.AppImage) ./test/test_rade_loss.sh 2>&1 | tee tmp.log
grep "PASS" tmp.log
- name: Sanity check RADE
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm' }}
run: |
sudo systemctl enable rtkit-daemon
sudo systemctl start rtkit-daemon
Xvfb :99 -screen 0 1024x768x16 &
sleep 5
export DISPLAY=:99.0
export XDG_RUNTIME_DIR=/run/user/$(id -u)
mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
eval "$(dbus-launch --sh-syntax --exit-with-x11)"
pipewire &
pipewire-pulse &
wireplumber &
metacity --sm-disable --replace &
sleep 5
. ./rade-venv/bin/activate
chmod +x *.AppImage
FREEDV_BINARY=./$(echo -n *.AppImage) ./test/test_rade_loss.sh 2>&1 | tee tmp.log
grep "PASS" tmp.log
test-application:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-24.04-arm, ubuntu-22.04-arm]
sanitizer: [WITH_ASAN=0, WITH_RTSAN=1, WITH_ASAN=1, WITH_TSAN=1, WITH_UBSAN=1]
native-audio: [USE_NATIVE_AUDIO=0, USE_NATIVE_AUDIO=1]
exclude:
- sanitizer: WITH_RTSAN=1
native-audio: USE_NATIVE_AUDIO=0
- sanitizer: WITH_TSAN=1
native-audio: USE_NATIVE_AUDIO=0
- sanitizer: WITH_ASAN=1
native-audio: USE_NATIVE_AUDIO=0
- sanitizer: WITH_UBSAN=1
native-audio: USE_NATIVE_AUDIO=0
- os: ubuntu-22.04
sanitizer: WITH_RTSAN=1
- os: ubuntu-22.04
sanitizer: WITH_TSAN=1
- os: ubuntu-22.04
sanitizer: WITH_ASAN=1
- os: ubuntu-22.04
sanitizer: WITH_UBSAN=1
- os: ubuntu-22.04-arm
sanitizer: WITH_RTSAN=1
- os: ubuntu-22.04-arm
sanitizer: WITH_TSAN=1
- os: ubuntu-22.04-arm
sanitizer: WITH_ASAN=1
- os: ubuntu-22.04-arm
sanitizer: WITH_UBSAN=1
runs-on: ${{ matrix.os }}
needs: lint
steps:
- uses: actions/checkout@v4
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
- name: Install LLVM/Clang >=20.0 (Required for sanitizers)
if: ${{ matrix.sanitizer != 'WITH_ASAN=0' }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22
- name: Install rtkit for RT threading
shell: bash
run: |
sudo apt-get update
sudo apt-get install dbus-x11 rtkit libdbus-1-dev polkitd
sudo sed -i 's/no/yes/g' /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy
sudo systemctl restart polkit
- name: Install common packages
shell: bash
run: |
sudo apt-get install libpulse-dev libspeexdsp-dev libsamplerate0-dev sox git portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev xvfb pipewire pulseaudio-utils pipewire-pulse wireplumber metacity at-spi2-core libebur128-dev
- name: Install version-specific packages
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-22.04-arm' }}
shell: bash
run: |
sudo apt-get install libwxgtk3.0-gtk3-dev pulseaudio python3.11-full python3.11-dev python3.11-venv
systemctl --user --now enable pulseaudio.service pulseaudio.socket
- name: Install version-specific packages
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm' }}
shell: bash
run: |
sudo apt-get install libwxgtk3.2-dev pipewire pipewire-pulse wireplumber
- name: Create Python venv
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-22.04-arm' }}
shell: bash
working-directory: ${{github.workspace}}
run: |
python3.11 -m venv rade-venv
- name: Create Python venv
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm' }}
shell: bash
working-directory: ${{github.workspace}}
run: |
python3 -m venv rade-venv
- name: Install Python required modules
shell: bash
working-directory: ${{github.workspace}}
run: |
. ./rade-venv/bin/activate
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
pip3 install matplotlib
- name: Build freedv-gui
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.sanitizer != 'WITH_ASAN=0' }}
run: |
. ./rade-venv/bin/activate
UT_ENABLE=1 CC=clang-22 CXX=clang++-22 ${{matrix.native-audio}} ${{matrix.sanitizer}} ./build_linux.sh
- name: Build freedv-gui
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.sanitizer == 'WITH_ASAN=0' }}
run: |
. ./rade-venv/bin/activate
UT_ENABLE=1 ${{matrix.native-audio}} ${{matrix.sanitizer}} ./build_linux.sh
- name: Execute unit tests
shell: bash
if: ${{ (matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-22.04-arm') && matrix.native-audio == 'USE_NATIVE_AUDIO=1' }}
working-directory: ${{github.workspace}}/build_linux
run: |
sudo systemctl enable rtkit-daemon
sudo systemctl start rtkit-daemon
Xvfb :99 -screen 0 1024x768x16 &
sleep 5
export DISPLAY=:99.0
export XDG_RUNTIME_DIR=/run/user/$(id -u)
mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
eval "$(dbus-launch --sh-syntax --exit-with-x11)"
metacity --sm-disable --replace &
sleep 5
if [[ "${{ matrix.sanitizer }}" == "WITH_ASAN=0" ]]; then
export MAX_EXECUTION_TIMES=2
else
export MAX_EXECUTION_TIMES=1
fi
ln -s ${{github.workspace}}/build_linux/rade_src/model19_check3 model19_check3
. ../rade-venv/bin/activate
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1:suppressions=${{github.workspace}}/test/ubsan_suppressions.txt ASAN_OPTIONS=suppressions=${{github.workspace}}/test/asan_suppressions.txt LSAN_OPTIONS=suppressions=${{github.workspace}}/test/lsan_suppressions.txt TSAN_OPTIONS=ignore_noninstrumented_modules=1 PYTHONPATH=${{github.workspace}}/build_linux/rade_src:$PYTHONPATH ctest -V --repeat until-pass:$MAX_EXECUTION_TIMES
- name: Execute unit tests
shell: bash
if: ${{ (matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm') && matrix.native-audio == 'USE_NATIVE_AUDIO=1' }}
working-directory: ${{github.workspace}}/build_linux
run: |
sudo systemctl enable rtkit-daemon
sudo systemctl start rtkit-daemon
Xvfb :99 -screen 0 1024x768x16 &
sleep 5
export DISPLAY=:99.0
export XDG_RUNTIME_DIR=/run/user/$(id -u)
mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
eval "$(dbus-launch --sh-syntax --exit-with-x11)"
pipewire &
pipewire-pulse &
wireplumber &
metacity --sm-disable --replace &
sleep 5
if [[ "${{ matrix.sanitizer }}" == "WITH_ASAN=0" ]]; then
export MAX_EXECUTION_TIMES=2
else
export MAX_EXECUTION_TIMES=1
fi
ln -s ${{github.workspace}}/build_linux/rade_src/model19_check3 model19_check3
. ../rade-venv/bin/activate
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1:suppressions=${{github.workspace}}/test/ubsan_suppressions.txt ASAN_OPTIONS=suppressions=${{github.workspace}}/test/asan_suppressions.txt LSAN_OPTIONS=suppressions=${{github.workspace}}/test/lsan_suppressions.txt TSAN_OPTIONS=ignore_noninstrumented_modules=1 PYTHONPATH=${{github.workspace}}/build_linux/rade_src:$PYTHONPATH ctest -V --repeat until-pass:$MAX_EXECUTION_TIMES