Skip to content

Commit 856f3f4

Browse files
committed
Adding sample checks
1 parent 9e057c2 commit 856f3f4

File tree

1 file changed

+91
-21
lines changed

1 file changed

+91
-21
lines changed

.github/workflows/samples.yml

Lines changed: 91 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
args: -f sample.mp4
2222
- name: kvs_gstreamer_file_uploader_sample
2323
args: sample.mp4 0 audio-video
24-
# - name: kvs_gstreamer_multistream_sample
25-
# args: ""
24+
- name: kvs_gstreamer_multistream_sample
25+
args: rtsp-urls.txt
2626
- name: kvs_gstreamer_sample
2727
args: sample.mp4
2828
- name: kvssink_gstreamer_sample
@@ -92,17 +92,14 @@ jobs:
9292
9393
- name: Build samples (Windows)
9494
if: runner.os == 'Windows'
95-
shell: cmd
9695
run: |
97-
@echo on
98-
set PATH=%PATH%;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\a\amazon-kinesis-video-streams-producer-c\amazon-kinesis-video-streams-producer-c\open-source\lib;D:\a\amazon-kinesis-video-streams-producer-c\amazon-kinesis-video-streams-producer-c\open-source\bin
96+
$env:Path += ';C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\producer\open-source\local\lib;D:\producer\open-source\local\bin'
97+
mkdir D:\producer
98+
Move-Item -Path "D:\a\amazon-kinesis-video-streams-producer-sdk-cpp\amazon-kinesis-video-streams-producer-sdk-cpp\*" -Destination "D:\producer"
99+
cd D:\producer
99100
git config --system core.longpaths true
100-
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
101-
mkdir build
102-
cd build
103-
cmake -G "NMake Makefiles" -DBUILD_GSTREAMER_PLUGIN=ON -DPKG_CONFIG_EXECUTABLE="D:\\gstreamer\\1.0\\msvc_x86_64\\bin\\pkg-config.exe" ..
104-
nmake
105-
mkdir "%KVS_DEBUG_DUMP_DATA_FILE_DIR%"
101+
dir
102+
.github\build_windows.bat
106103
107104
- name: Configure AWS Credentials
108105
uses: aws-actions/configure-aws-credentials@v4
@@ -112,8 +109,75 @@ jobs:
112109
aws-region: ${{ secrets.AWS_REGION }}
113110
role-duration-seconds: 10800
114111

112+
- name: Run multistream sample (Linux & Mac)
113+
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.sample.name == 'kvs_gstreamer_multistream_sample'
114+
working-directory: ./build/debug_output
115+
run: |
116+
set -x
117+
if [[ "$RUNNER_OS" == "Linux" ]]; then
118+
sudo apt-get install -y docker.io
119+
else
120+
brew install --cask docker
121+
open -a Docker
122+
123+
# Wait for Docker to be ready
124+
sleep 15
125+
126+
sudo ln -s ~/.docker/run/docker.sock /var/run/docker.sock
127+
fi
128+
129+
docker run -d --rm -e RTSP_PORT=8558 -p 8558:8558 -e GST_PIPELINE="videotestsrc pattern=ball ! videoscale ! video/x-raw,width=640,height=480,framerate=10/1 ! x264enc tune=zerolatency bitrate=512 ! rtph264pay name=pay0 pt=96" -e STREAM_NAME=stream1 bluenviron/mediamtx
130+
docker run -d --rm -e RTSP_PORT=8559 -p 8559:8559 -e GST_PIPELINE="videotestsrc ! videoscale ! video/x-raw,width=640,height=480,framerate=10/1 ! x264enc tune=zerolatency bitrate=512 ! rtph264pay name=pay0 pt=96" -e STREAM_NAME=stream2 bluenviron/mediamtx
131+
132+
echo "rtsp://0.0.0.0:8558/stream1" > rtsp-urls.txt
133+
echo "rtsp://0.0.0.0:8559/stream2" >> rtsp-urls.txt
134+
135+
sleep 5
136+
137+
./${{ matrix.sample.name }} demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
138+
shell: bash
139+
env:
140+
GST_PLUGIN_PATH: ${{ github.workspace }}/build
141+
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
142+
143+
- name: Run multistream sample (Windows)
144+
if: runner.os == 'Windows' && matrix.sample.name == 'kvs_gstreamer_multistream_sample'
145+
shell: pwsh
146+
working-directory: D:\producer\build
147+
run: |
148+
Invoke-WebRequest -Uri "https://github.com/bluenviron/mediamtx/releases/latest/download/mediamtx_windows_amd64.zip" -OutFile "mediamtx.zip"
149+
Expand-Archive -Path mediamtx.zip -DestinationPath .
150+
151+
echo "paths:
152+
all:
153+
source: publisher
154+
stream1:
155+
runOnInit: `"gst-launch-1.0 videotestsrc pattern=ball ! videoscale ! video/x-raw,width=640,height=480,framerate=10/1 ! x264enc tune=zerolatency bitrate=512 ! rtph264pay name=pay0 pt=96 ! udpsink host=127.0.0.1 port=5004`"
156+
runOnInitRestart: yes
157+
stream2:
158+
runOnInit: `"gst-launch-1.0 videotestsrc ! videoscale ! video/x-raw,width=640,height=480,framerate=10/1 ! x264enc tune=zerolatency bitrate=512 ! rtph264pay name=pay0 pt=96 ! udpsink host=127.0.0.1 port=5006`"
159+
runOnInitRestart: yes" | Out-File -FilePath mediamtx.yml -Encoding utf8
160+
161+
Start-Process -NoNewWindow -FilePath ".\mediamtx.exe" -ArgumentList "-config mediamtx.yml"
162+
163+
echo "rtsp://127.0.0.1:8554/stream1" | Out-File -FilePath rtsp-urls.txt -Encoding UTF8
164+
echo "rtsp://127.0.0.1:8554/stream2" | Out-File -FilePath rtsp-urls.txt -Append -Encoding UTF8
165+
166+
# Run the sample application
167+
Start-Sleep -Seconds 10 # Wait for server to be ready
168+
169+
$env:Path += ';C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\producer\open-source\local\lib;D:\producer\open-source\local\bin;D:\gstreamer\1.0\msvc_x86_64\bin'
170+
171+
mkdir D:\producer\debug_output
172+
173+
$exePath = Join-Path $PWD ${{ matrix.sample.name }}.exe
174+
& $exePath demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
175+
env:
176+
GST_PLUGIN_PATH: D:\producer\build
177+
KVS_DEBUG_DUMP_DATA_FILE_DIR: D:\producer\debug_output
178+
115179
- name: Run ${{ matrix.sample.name }} (Linux & Mac)
116-
if: runner.os == 'Linux' || runner.os == 'macOS'
180+
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.sample.name != 'kvs_gstreamer_multistream_sample'
117181
env:
118182
GST_PLUGIN_PATH: ${{ github.workspace }}/build
119183
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
@@ -123,17 +187,23 @@ jobs:
123187
./${{ matrix.sample.name }} demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
124188
125189
- name: Run ${{ matrix.sample.name }} (Windows)
126-
if: runner.os == 'Windows'
190+
if: runner.os == 'Windows' && matrix.sample.name != 'kvs_gstreamer_multistream_sample'
127191
env:
128-
GST_PLUGIN_PATH: ${{ github.workspace }}/build
129-
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
130-
working-directory: ./build
192+
GST_PLUGIN_PATH: D:\producer\build
193+
KVS_DEBUG_DUMP_DATA_FILE_DIR: D:\producer\debug_output
194+
working-directory: D:\producer\build
131195
run: |
196+
# Equivalent to set -x
197+
Set-PSDebug -Trace 1
198+
132199
$env:Path += ';C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\producer\open-source\local\lib;D:\producer\open-source\local\bin;D:\gstreamer\1.0\msvc_x86_64\bin'
133200
201+
mkdir D:\producer\debug_output
202+
134203
Invoke-WebRequest -Uri https://awsj-iot-handson.s3-ap-northeast-1.amazonaws.com/kvs-workshop/sample.mp4 -OutFile sample.mp4
135-
$exePath = Join-Path $PWD ${{ matrix.sample.name }}
136-
& $exePath.exe demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
204+
dir
205+
$exePath = Join-Path $PWD ${{ matrix.sample.name }}.exe
206+
& $exePath demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
137207
138208
- name: Verify MKV dump (Mac & Linux)
139209
if: runner.os == 'Linux' || runner.os == 'macOS'
@@ -154,13 +224,13 @@ jobs:
154224
done
155225
shell: bash
156226

157-
- name: Verify MKV dump
227+
- name: Verify MKV dump (Windows)
158228
if: runner.os == 'Windows'
159229
working-directory: D:\producer\build
160230
run: |
161231
$env:Path += ";C:\Program Files\MKVToolNix"
162-
dir debug_output
163-
$mkvFiles = Get-ChildItem -Path "D:\producer\build\debug_output" -Filter *.mkv
232+
dir D:\producer\debug_output
233+
$mkvFiles = Get-ChildItem -Path "D:\producer\debug_output" -Filter *.mkv
164234
if ($mkvFiles.Count -eq 0) {
165235
Write-Error "No MKV files found in D:\producer\build\debug_output"
166236
exit 1

0 commit comments

Comments
 (0)