Skip to content

Commit 4b85401

Browse files
committed
Adding sample checks
1 parent 9e057c2 commit 4b85401

File tree

1 file changed

+92
-23
lines changed

1 file changed

+92
-23
lines changed

.github/workflows/samples.yml

Lines changed: 92 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ 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
2929
args: sample.mp4
3030
runner:
31-
- id: macos-latest
32-
image: macos-latest
31+
- id: macos-13
32+
image: macos-13
3333

3434
- id: ubuntu-22.04
3535
image: ubuntu-latest
@@ -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,74 @@ 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
115+
run: |
116+
set -x
117+
if [[ "$RUNNER_OS" == "Linux" ]]; then
118+
apt-get install -y docker.io
119+
else
120+
brew install --cask docker
121+
open -a /Applications/Docker.app --args --unattended --accept-license
122+
echo "We are waiting for Docker to be up and running. It can take over 2 minutes..."
123+
while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do sleep 1; done
124+
125+
sudo ln -s ~/.docker/run/docker.sock /var/run/docker.sock
126+
fi
127+
128+
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
129+
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
130+
131+
echo "rtsp://0.0.0.0:8558/stream1" > rtsp-urls.txt
132+
echo "rtsp://0.0.0.0:8559/stream2" >> rtsp-urls.txt
133+
134+
sleep 5
135+
136+
./${{ matrix.sample.name }} demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
137+
shell: bash
138+
env:
139+
GST_PLUGIN_PATH: ${{ github.workspace }}/build
140+
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
141+
142+
- name: Run multistream sample (Windows)
143+
if: runner.os == 'Windows' && matrix.sample.name == 'kvs_gstreamer_multistream_sample'
144+
shell: pwsh
145+
working-directory: D:\producer\build
146+
run: |
147+
Invoke-WebRequest -Uri "https://github.com/bluenviron/mediamtx/releases/download/v1.11.2/mediamtx_v1.11.2_windows_amd64.zip" -OutFile "mediamtx.zip"
148+
Expand-Archive -Path mediamtx.zip -DestinationPath .
149+
150+
echo "paths:
151+
all:
152+
source: publisher
153+
stream1:
154+
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`"
155+
runOnInitRestart: yes
156+
stream2:
157+
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`"
158+
runOnInitRestart: yes" | Out-File -FilePath mediamtx.yml -Encoding utf8
159+
160+
Start-Process -NoNewWindow -FilePath ".\mediamtx.exe" -ArgumentList "mediamtx.yml"
161+
162+
echo "rtsp://127.0.0.1:8554/stream1" | Out-File -FilePath rtsp-urls.txt -Encoding UTF8
163+
echo "rtsp://127.0.0.1:8554/stream2" | Out-File -FilePath rtsp-urls.txt -Append -Encoding UTF8
164+
165+
# Run the sample application
166+
Start-Sleep -Seconds 10 # Wait for server to be ready
167+
168+
$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'
169+
170+
mkdir D:\producer\debug_output
171+
172+
$exePath = Join-Path $PWD ${{ matrix.sample.name }}.exe
173+
& $exePath demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
174+
env:
175+
GST_PLUGIN_PATH: D:\producer\build
176+
KVS_DEBUG_DUMP_DATA_FILE_DIR: D:\producer\debug_output
177+
115178
- name: Run ${{ matrix.sample.name }} (Linux & Mac)
116-
if: runner.os == 'Linux' || runner.os == 'macOS'
179+
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.sample.name != 'kvs_gstreamer_multistream_sample'
117180
env:
118181
GST_PLUGIN_PATH: ${{ github.workspace }}/build
119182
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
@@ -123,17 +186,23 @@ jobs:
123186
./${{ matrix.sample.name }} demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
124187
125188
- name: Run ${{ matrix.sample.name }} (Windows)
126-
if: runner.os == 'Windows'
189+
if: runner.os == 'Windows' && matrix.sample.name != 'kvs_gstreamer_multistream_sample'
127190
env:
128-
GST_PLUGIN_PATH: ${{ github.workspace }}/build
129-
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
130-
working-directory: ./build
191+
GST_PLUGIN_PATH: D:\producer\build
192+
KVS_DEBUG_DUMP_DATA_FILE_DIR: D:\producer\debug_output
193+
working-directory: D:\producer\build
131194
run: |
195+
# Equivalent to set -x
196+
Set-PSDebug -Trace 1
197+
132198
$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'
133199
200+
mkdir D:\producer\debug_output
201+
134202
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 }}
203+
dir
204+
$exePath = Join-Path $PWD ${{ matrix.sample.name }}.exe
205+
& $exePath demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
137206
138207
- name: Verify MKV dump (Mac & Linux)
139208
if: runner.os == 'Linux' || runner.os == 'macOS'
@@ -154,13 +223,13 @@ jobs:
154223
done
155224
shell: bash
156225

157-
- name: Verify MKV dump
226+
- name: Verify MKV dump (Windows)
158227
if: runner.os == 'Windows'
159228
working-directory: D:\producer\build
160229
run: |
161230
$env:Path += ";C:\Program Files\MKVToolNix"
162-
dir debug_output
163-
$mkvFiles = Get-ChildItem -Path "D:\producer\build\debug_output" -Filter *.mkv
231+
dir D:\producer\debug_output
232+
$mkvFiles = Get-ChildItem -Path "D:\producer\debug_output" -Filter *.mkv
164233
if ($mkvFiles.Count -eq 0) {
165234
Write-Error "No MKV files found in D:\producer\build\debug_output"
166235
exit 1

0 commit comments

Comments
 (0)