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

342 lines
12 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 upgrade -y
sudo apt-get install codespell
- 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`
dist:
runs-on: ubuntu-22.04
needs: lint
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 upgrade -y
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
- 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 torchaudio --index-url https://download.pytorch.org/whl/cpu
pip3 install matplotlib
- name: Build freedv-gui using PulseAudio
shell: bash
working-directory: ${{github.workspace}}
run: |
. ./rade-venv/bin/activate
./build_linux.sh
- name: Build AppImage
shell: bash
working-directory: ${{github.workspace}}/appimage
run: |
./make-appimage.sh
- name: Calculate AppImage filename
shell: bash
id: appimage-filename
working-directory: ${{github.workspace}}
run: |
export FREEDV_VERSION=`cat build_linux/freedv-version.txt`
echo "APPIMAGE_FILENAME=FreeDV-${FREEDV_VERSION}-x86_64.AppImage" >> "$GITHUB_OUTPUT"
- 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
test-appimage-fedora:
runs-on: ubuntu-24.04
needs: [build, dist]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{needs.dist.outputs.APPIMAGE_FILENAME}}
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
- name: Sanity check RADE
shell: bash
working-directory: ${{github.workspace}}
run: |
chmod +x ${{needs.dist.outputs.APPIMAGE_FILENAME}}
echo "FREEDV_BINARY=./${{needs.dist.outputs.APPIMAGE_FILENAME}} --appimage-extract-and-run" > tmp.env
sudo podman exec --env-file ./tmp.env fedora-test /workspace/appimage/container-test.sh | tee tmp.log
grep "Got 1 sync changes" tmp.log
test-appimage-ubuntu:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
needs: [build, dist]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{needs.dist.outputs.APPIMAGE_FILENAME}}
path: ${{github.workspace}}
- name: Install rtkit for RT threading
shell: bash
run: |
sudo apt-get update
sudo apt-get upgrade -y
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' }}
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' }}
run: |
sudo apt-get install sox xvfb pulseaudio pulseaudio-utils metacity
systemctl --user --now enable pulseaudio.service pulseaudio.socket
- name: Sanity check RADE
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.os == 'ubuntu-22.04' }}
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
chmod +x ${{needs.dist.outputs.APPIMAGE_FILENAME}}
FREEDV_BINARY=./${{needs.dist.outputs.APPIMAGE_FILENAME}} ./test/test_zeros.sh txrx RADEV1 | tee tmp.log
grep "Got 1 sync changes" tmp.log
- name: Sanity check RADE
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.os == 'ubuntu-24.04' }}
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
chmod +x ${{needs.dist.outputs.APPIMAGE_FILENAME}}
FREEDV_BINARY=./${{needs.dist.outputs.APPIMAGE_FILENAME}} ./test/test_zeros.sh txrx RADEV1 | tee tmp.log
grep "Got 1 sync changes" tmp.log
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04]
sanitizer: [WITH_ASAN=0, WITH_RTSAN=1, WITH_ASAN=1]
native-audio: [USE_NATIVE_AUDIO=0, USE_NATIVE_AUDIO=1]
exclude:
- os: ubuntu-22.04
sanitizer: WITH_RTSAN=1
- os: ubuntu-22.04
sanitizer: WITH_ASAN=1
- os: ubuntu-24.04
sanitizer: WITH_RTSAN=1
native-audio: USE_NATIVE_AUDIO=0
- os: ubuntu-24.04
sanitizer: WITH_ASAN=1
native-audio: USE_NATIVE_AUDIO=0
runs-on: ${{ matrix.os }}
needs: lint
steps:
- uses: actions/checkout@v4
- name: Install LLVM/Clang >=20.0 (Required for RTSan)
if: ${{ matrix.sanitizer == 'WITH_RTSAN=1' }}
uses: MorganCaron/latest-clang-action@master
- name: Install rtkit for RT threading
shell: bash
run: |
sudo apt-get update
sudo apt-get upgrade -y
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
- name: Install version-specific packages
if: ${{ matrix.os == 'ubuntu-22.04' }}
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' }}
shell: bash
run: |
sudo apt-get install libwxgtk3.2-dev pipewire pipewire-pulse wireplumber
- name: Create Python venv
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
working-directory: ${{github.workspace}}
run: |
python3.11 -m venv rade-venv
- name: Create Python venv
if: ${{ matrix.os == 'ubuntu-24.04' }}
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 torchaudio --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_RTSAN=1' }}
run: |
. ./rade-venv/bin/activate
UT_ENABLE=1 CC=clang CXX=clang++ ${{matrix.native-audio}} ${{matrix.sanitizer}} ./build_linux.sh
- name: Build freedv-gui
shell: bash
working-directory: ${{github.workspace}}
if: ${{ matrix.sanitizer != 'WITH_RTSAN=1' }}
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.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
ln -s ${{github.workspace}}/build_linux/rade_src/model19_check3 model19_check3
. ../rade-venv/bin/activate
ASAN_OPTIONS=suppressions=${{github.workspace}}/test/asan_suppressions.txt LSAN_OPTIONS=suppressions=${{github.workspace}}/test/lsan_suppressions.txt PYTHONPATH=${{github.workspace}}/build_linux/rade_src:$PYTHONPATH ctest -V --repeat until-pass:2
- name: Execute unit tests
shell: bash
if: ${{ matrix.os == 'ubuntu-24.04' && 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
ln -s ${{github.workspace}}/build_linux/rade_src/model19_check3 model19_check3
. ../rade-venv/bin/activate
ASAN_OPTIONS=suppressions=${{github.workspace}}/test/asan_suppressions.txt LSAN_OPTIONS=suppressions=${{github.workspace}}/test/lsan_suppressions.txt PYTHONPATH=${{github.workspace}}/build_linux/rade_src:$PYTHONPATH ctest -V --repeat until-pass:2