From 7828677a04bc270f0d0d55e8c7bd459c011df8c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Damstedt=20Rasmussen?= <contact@bearware.dk>
Date: Sun, 3 Nov 2024 20:12:35 +0100
Subject: [PATCH] Ubuntu 24 GitHub workflow

---
 .github/workflows/ubuntu24.yml | 178 +++++++++++++++++++++++++++++++++
 1 file changed, 178 insertions(+)
 create mode 100644 .github/workflows/ubuntu24.yml

diff --git a/.github/workflows/ubuntu24.yml b/.github/workflows/ubuntu24.yml
new file mode 100644
index 000000000..26d8658bc
--- /dev/null
+++ b/.github/workflows/ubuntu24.yml
@@ -0,0 +1,178 @@
+name: Ubuntu 24
+
+on: [push]
+
+env:
+  # TeamTalk unit test environment variables
+  INPUTDEVICEID: 1978
+  OUTPUTDEVICEID: 1978
+  VIDEODEVICEID: None
+  VERBOSE: 0
+  GITHUBSKIP: 1
+
+jobs:
+  build:
+    runs-on: ubuntu-24.04
+
+    steps:
+    - uses: actions/checkout@v4
+
+    - uses: actions/setup-java@v3
+      with:
+        distribution: 'temurin'
+        java-version: '21'
+
+    - name: Refresh Ubuntu-repo
+      run: sudo apt update
+
+    - name: Update packages
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      # Ensure FFmpeg doesn't detect additional dependencies
+      run: |
+        sudo apt remove libmagickcore-dev libmagickwand-dev libbz2-dev liblzma-dev
+        sudo apt autoremove
+        sudo apt install valgrind
+        sudo make -C Build depend-ubuntu24
+        dpkg -l
+
+    - name: Print env
+      run: printenv | sort
+
+    - name: Init TeamTalk Library submodules
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        git submodule update --init Library/TeamTalkLib/test/testdata
+
+    - name: Install TeamTalk Library Dependencies
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: sudo make -C Build depend-ubuntu24
+
+    - name: Build TeamTalk Library and Apps
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      shell: bash
+      run: |
+        source env.sh
+        make CMAKE_EXTRA="-DFEATURE_WEBRTC=OFF -DBUILD_TEAMTALK_LIBRARY_UNITTEST_CATCH2=ON -DBUILD_TEAMTALK_LIBRARY_UNITTEST_CATCH2_PERF=OFF -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install" -C Build ubuntu24
+        echo TEAMTALK_INSTALLDIR=${{runner.workspace}}/install>> $GITHUB_ENV
+
+    - name: Java Server API Test (non-encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5/Library/TeamTalkJNI
+      # Execute tests defined by the CMake configuration.
+      # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
+      run: |
+        export ENCRYPTED=0 WEBRTC=0
+        make runjunitsrv
+
+    - name: Java Server API Test (encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5/Library/TeamTalkJNI
+      run: |
+        export ENCRYPTED=1 WEBRTC=0
+        make runjunitsrv
+
+    - name: Start TeamTalk Standard Server
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        cp Library/TeamTalkLib/test/tt5srv.xml_template Server/tt5srv.xml
+        Server/tt5srv -d -c Server/tt5srv.xml
+
+    - name: Start TeamTalk Pro Server (encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        cp -f Library/TeamTalkLib/test/tt5prosrv.xml_template Server/tt5prosrv.xml
+        cp Library/TeamTalkLib/test/ttservercert.pem Server/
+        cp Library/TeamTalkLib/test/ttserverkey.pem Server/
+        cp Library/TeamTalkLib/test/ca.cer Server/
+        Server/tt5prosrv -d -wd Server/
+
+    - name: Run PyTest
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        source env.sh
+        pytest-3 Library/TeamTalkPy/test/teamtalk_test.py
+
+    - name: Run Python client
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        source env.sh
+        make -C Client/ttserverlogpy
+
+    - name: Catch unit-test
+      working-directory: ${{runner.workspace}}/TeamTalk5/Library/TeamTalkLib/test
+      run: valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ./catchtt --durations yes
+
+    - name: Stop TeamTalk Pro Server
+      run: killall tt5prosrv
+
+    - name: Java Unit-test (non-encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5/Library/TeamTalkJNI
+      run: |
+        export ENCRYPTED=0 WEBRTC=0
+        make runjunit
+
+    - name: Stop TeamTalk Standard Server
+      run: killall tt5srv
+
+    - name: Start TeamTalk Pro Server (non-encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        cp -f Library/TeamTalkLib/test/tt5srv.xml_template Server/tt5srv.xml
+        Server/tt5prosrv -d -c Server/tt5srv.xml
+
+    - name: Java Unit-test with shared audio devices (non-encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5/Library/TeamTalkJNI
+      run: |
+        export ENCRYPTED=0 WEBRTC=0
+        export INPUTDEVICEID=4026
+        export OUTPUTDEVICEID=4026
+        make runjunitpro
+
+    - name: Stop TeamTalk Pro Server (non-encrypted)
+      run: killall tt5prosrv
+
+    - name: Start TeamTalk Pro Server (encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        cp -f Library/TeamTalkLib/test/tt5prosrv.xml_template Server/tt5prosrv.xml
+        cp Library/TeamTalkLib/test/ttservercert.pem Server/
+        cp Library/TeamTalkLib/test/ttserverkey.pem Server/
+        Server/tt5prosrv -d -wd Server/
+
+    - name: Java Unit-test with virtual audio device (encrypted)
+      working-directory: ${{runner.workspace}}/TeamTalk5/Library/TeamTalkJNI
+      run: |
+        export ENCRYPTED=1 WEBRTC=0
+        export INPUTDEVICEID=1978
+        export OUTPUTDEVICEID=1978
+        make runjunitpro
+
+    - name: Stop TeamTalk Pro Server (encrypted)
+      run: killall tt5prosrv
+
+    - name: Run CMake Install Target
+      working-directory: ${{runner.workspace}}/TeamTalk5/Build/build-ubuntu24
+      run: cmake --build . --target install
+
+    - name: Upload TeamTalk Artifacts
+      uses: actions/upload-artifact@v3
+      with:
+        name: teamtalksdk-ubuntu24
+        path: ${{runner.workspace}}/install
+
+    - name: Make Ubuntu 24 Portable Archive
+      working-directory: ${{runner.workspace}}/TeamTalk5
+      run: |
+        source env.sh
+        cd Setup/Portable
+        make ubuntu24 ubuntu24pro
+
+    - name: Upload TeamTalk Portable artifact
+      uses: actions/upload-artifact@v3
+      with:
+        name: teamtalk-ubuntu24
+        path: ${{runner.workspace}}/TeamTalk5/Setup/Portable/teamtalk-*
+
+    - name: Upload TeamTalk Pro artifact
+      uses: actions/upload-artifact@v3
+      with:
+        name: teamtalkpro-ubuntu24
+        path: ${{runner.workspace}}/TeamTalk5/Setup/Portable/teamtalkpro-*