Skip to content

Commit 5a0cf7c

Browse files
committed
workflows/test: add gnutls and mbedtls test
Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
1 parent dab4f3a commit 5a0cf7c

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

.github/workflows/test.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,160 @@ jobs:
607607
run: exit 1
608608
runs-on: ubuntu-22.04
609609

610+
gnutls:
611+
name: "With GnuTLS"
612+
needs: build
613+
steps:
614+
- name: Checkout repository
615+
uses: actions/checkout@v4
616+
- name: Install GnuTLS and Download Test File
617+
run: |
618+
set -euxo pipefail
619+
sudo apt-get update
620+
sudo apt-get install -y nasm pkg-config jq gnutls-bin libgnutls28-dev
621+
curl -s -L -O https://github.com/ossrs/ffmpeg-webrtc/releases/download/pre-release/bbb-4mbps-baseline-opus.mp4
622+
- name: Build FFmpeg
623+
run: |
624+
set -euxo pipefail
625+
626+
# Build FFmpeg with WebRTC support using GnuTLS
627+
./configure --enable-muxer=whip --enable-gnutls
628+
make -j$(nproc)
629+
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip
630+
- name: Start SRS Docker container
631+
run: |
632+
set -euxo pipefail
633+
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}')
634+
docker run --rm -d -p 1935:1935 -p 1985:1985 -p 8080:8080 \
635+
--env CANDIDATE=$ip -p 8000:8000/udp \
636+
ossrs/srs:5 ./objs/srs -c conf/rtc2rtmp.conf
637+
- name: Streaming with FFmpeg
638+
run: |
639+
set -euxo pipefail
640+
nohup ./ffmpeg -t 30 -re -i bbb-4mbps-baseline-opus.mp4 -c copy \
641+
-f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream" \
642+
1>ffstdout.log 2>ffstderr.log &
643+
- name: Check SRS Streaming
644+
id: streaming
645+
run: |
646+
set -euxo pipefail
647+
648+
# Check streams in SRS.
649+
for ((i=0; i<10; i++)); do
650+
STREAM=$(curl -s http://localhost:1985/api/v1/streams/ | jq -r '.streams[].name')
651+
if [[ "$STREAM" == "livestream" ]]; then
652+
echo 'Test OK';
653+
echo "has_stream=true" >> $GITHUB_OUTPUT
654+
break;
655+
fi
656+
sleep 3
657+
done
658+
659+
if [[ "$STREAM" != "livestream" ]]; then
660+
echo "Stream not found: $STREAM"
661+
echo "has_stream=false" >> $GITHUB_OUTPUT
662+
fi
663+
- name: Stop FFmpeg normally
664+
run: |
665+
pkill -SIGINT ffmpeg && sleep 3 ||
666+
echo "FFmpeg process not found or already stopped."
667+
- name: Show FFmpeg Stdout Log
668+
run: cat ffstdout.log
669+
- name: Show FFmpeg Stderr Log
670+
run: cat ffstderr.log
671+
- name: Check FFmpeg Exit Log
672+
run: |
673+
set -euxo pipefail
674+
cat ffstderr.log |grep 'Exiting normally' && exit 0
675+
echo "Exiting normally not found in ffstderr.log" && exit 1
676+
- name: Check Stream Existence
677+
if: ${{ steps.streaming.outputs.has_stream == 'false' }}
678+
run: exit 1
679+
runs-on: ubuntu-22.04
680+
681+
mbedtls:
682+
name: "With mbedTLS"
683+
needs: build
684+
steps:
685+
- name: Checkout repository
686+
uses: actions/checkout@v4
687+
- name: Build mbedTLS
688+
run: |
689+
set -euxo pipefail
690+
sudo apt-get update
691+
sudo apt-get install -y nasm pkg-config jq cmake
692+
curl -s -L https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.2/mbedtls-3.6.2.tar.bz2 | tar xj
693+
cd mbedtls-3.6.2
694+
mkdir build && cd build
695+
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.release/mbedtls \
696+
-DUSE_SHARED_MBEDTLS_LIBRARY=On ..
697+
make -j$(nproc) && make install
698+
- name: Download Test File
699+
run: |
700+
set -euxo pipefail
701+
curl -s -L -O https://github.com/ossrs/ffmpeg-webrtc/releases/download/pre-release/bbb-4mbps-baseline-opus.mp4
702+
- name: Build FFmpeg
703+
run: |
704+
set -euxo pipefail
705+
706+
# Build FFmpeg with WebRTC support using mbedTLS
707+
PKG_CONFIG_PATH="$HOME/.release/mbedtls/lib/pkgconfig" \
708+
./configure --enable-muxer=whip --enable-mbedtls \
709+
--extra-cflags="-I$HOME/.release/mbedtls/include" \
710+
--extra-ldflags="-L$HOME/.release/mbedtls/lib -Wl,-rpath,$HOME/.release/mbedtls/lib"
711+
make -j$(nproc)
712+
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip
713+
- name: Start SRS Docker container
714+
run: |
715+
set -euxo pipefail
716+
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}')
717+
docker run --rm -d -p 1935:1935 -p 1985:1985 -p 8080:8080 \
718+
--env CANDIDATE=$ip -p 8000:8000/udp \
719+
ossrs/srs:5 ./objs/srs -c conf/rtc2rtmp.conf
720+
- name: Streaming with FFmpeg
721+
run: |
722+
set -euxo pipefail
723+
nohup ./ffmpeg -t 30 -re -i bbb-4mbps-baseline-opus.mp4 -c copy \
724+
-f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream" \
725+
1>ffstdout.log 2>ffstderr.log &
726+
- name: Check SRS Streaming
727+
id: streaming
728+
run: |
729+
set -euxo pipefail
730+
731+
# Check streams in SRS.
732+
for ((i=0; i<10; i++)); do
733+
STREAM=$(curl -s http://localhost:1985/api/v1/streams/ | jq -r '.streams[].name')
734+
if [[ "$STREAM" == "livestream" ]]; then
735+
echo 'Test OK';
736+
echo "has_stream=true" >> $GITHUB_OUTPUT
737+
break;
738+
fi
739+
sleep 3
740+
done
741+
742+
if [[ "$STREAM" != "livestream" ]]; then
743+
echo "Stream not found: $STREAM"
744+
echo "has_stream=false" >> $GITHUB_OUTPUT
745+
fi
746+
- name: Stop FFmpeg normally
747+
run: |
748+
pkill -SIGINT ffmpeg && sleep 3 ||
749+
echo "FFmpeg process not found or already stopped."
750+
- name: Show FFmpeg Stdout Log
751+
run: cat ffstdout.log
752+
- name: Show FFmpeg Stderr Log
753+
run: cat ffstderr.log
754+
- name: Check FFmpeg Exit Log
755+
run: |
756+
set -euxo pipefail
757+
cat ffstderr.log |grep 'Exiting normally' && exit 0
758+
echo "Exiting normally not found in ffstderr.log" && exit 1
759+
- name: Check Stream Existence
760+
if: ${{ steps.streaming.outputs.has_stream == 'false' }}
761+
run: exit 1
762+
runs-on: ubuntu-22.04
763+
610764
generate-patch:
611765
name: "Generate Patch"
612766
if: ${{ github.event_name == 'pull_request' }}
@@ -685,6 +839,8 @@ jobs:
685839
- openssl-1-1-1
686840
- openssl-3-0
687841
- openssl-latest
842+
- gnutls
843+
- mbedtls
688844
- generate-patch
689845
steps:
690846
- run: echo 'All done'

0 commit comments

Comments
 (0)