Skip to content

Commit ed7b2f1

Browse files
authored
Adding WSL checks for kvssink and samples (#1232)
* Adding WSL checks for kvssink and samples * Address comments * Address comments
1 parent 1bee4d6 commit ed7b2f1

File tree

2 files changed

+243
-10
lines changed

2 files changed

+243
-10
lines changed

.github/workflows/kvssink.yml

Lines changed: 109 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
echo "No MKV files found in debug_output"
132132
exit 1
133133
fi
134-
134+
135135
for file in "${mkvfiles[@]}"; do
136136
echo "Verifying $file with mkvinfo (verbose and hexdump):"
137137
mkvinfo -v -X "$file"
@@ -165,7 +165,7 @@ jobs:
165165
gstreamer1.0-tools \
166166
libcurl4-openssl-dev libgstreamer1.0-dev \
167167
libgstreamer-plugins-base1.0-dev liblog4cplus-dev \
168-
libssl-dev pkg-config mkvtoolnix
168+
libssl-dev pkg-config mkvtoolnix
169169
170170
- name: Setup build directory
171171
run: |
@@ -253,10 +253,10 @@ jobs:
253253
working-directory: D:\producer\build\
254254
run: |
255255
$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'
256-
256+
257257
# Create the debug directory (equivalent to mkdir -p)
258258
New-Item -ItemType Directory -Path "D:\producer\build\debug_output" -Force
259-
259+
260260
# Stream for 15 seconds (450 frames @ 30 fps)
261261
gst-launch-1.0.exe videotestsrc is-live=true num-buffers=450 ! video/x-raw,framerate=30/1,width=640,height=480 ! videoconvert ! x264enc tune=zerolatency key-int-max=45 ! h264parse ! kvssink stream-name="demo-stream"
262262
- name: Verify MKV dump
@@ -275,3 +275,108 @@ jobs:
275275
Write-Output "Verifying $($file.FullName) with mkvinfo (verbose and hexdump):"
276276
mkvinfo.exe -v -X "$($file.FullName)"
277277
}
278+
279+
wsl-debug-dump-dir:
280+
runs-on: windows-2022
281+
env:
282+
AWS_KVS_LOG_LEVEL: 1
283+
strategy:
284+
matrix:
285+
image:
286+
- Ubuntu-22.04
287+
- Ubuntu-24.04
288+
fail-fast: false
289+
defaults:
290+
run:
291+
shell: wsl-bash {0} # Automatically uses wsl-bash for each run step
292+
permissions:
293+
id-token: write
294+
contents: read
295+
steps:
296+
- uses: Vampire/setup-wsl@v4
297+
with:
298+
distribution: ${{ matrix.image }}
299+
additional-packages: |
300+
automake
301+
build-essential
302+
cmake
303+
git
304+
gstreamer1.0-plugins-base-apps
305+
gstreamer1.0-plugins-bad
306+
gstreamer1.0-plugins-good
307+
gstreamer1.0-plugins-ugly
308+
gstreamer1.0-tools
309+
libcurl4-openssl-dev
310+
libgstreamer1.0-dev
311+
libgstreamer-plugins-base1.0-dev
312+
liblog4cplus-dev
313+
libssl-dev
314+
pkg-config
315+
mkvtoolnix
316+
use-cache: 'false' # Cache entry for Ubuntu 22.04 and 24.04 are the same (conflict)
317+
318+
- name: Checkout repository
319+
uses: actions/checkout@v4
320+
321+
- name: Move repository in WSL
322+
run: |
323+
# Copy to ~/kvs-cpp-repo for simplicity
324+
# Note: Can't move due to no permissions
325+
REPO_NAME=$(basename ${{ github.repository }})
326+
cp -r /mnt/d/a/$REPO_NAME/$REPO_NAME ~/kvs-cpp-repo
327+
328+
- name: Build kvssink in WSL
329+
run: |
330+
mkdir -p ~/kvs-cpp-repo/build
331+
cd ~/kvs-cpp-repo/build
332+
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DALIGNED_MEMORY_MODEL=ON -DBUILD_DEPENDENCIES=OFF
333+
make -j$(nproc)
334+
335+
- name: Configure AWS Credentials
336+
uses: aws-actions/configure-aws-credentials@v4
337+
with:
338+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
339+
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
340+
aws-region: ${{ secrets.AWS_REGION }}
341+
role-duration-seconds: 900
342+
343+
- name: Run kvssink with dump dir in WSL
344+
run: |
345+
mkdir -p ~/kvs-cpp-repo/build/debug_output
346+
export GST_PLUGIN_PATH=~/kvs-cpp-repo/build
347+
export KVS_DEBUG_DUMP_DATA_FILE_DIR=~/kvs-cpp-repo/build/debug_output
348+
349+
set +e # Disable exit on error for the timeout command
350+
# Note: `env.` syntax to reference credentials to have GitHub Actions inject
351+
# the secret values into these environment variables before the command runs,
352+
# since the WSL shell doesn't have access to GitHub's environment variables
353+
timeout --preserve-status --signal=SIGINT --kill-after=15s 30s \
354+
gst-launch-1.0 videotestsrc is-live=true num-buffers=450 \
355+
! video/x-raw,framerate=30/1,width=640,height=480 \
356+
! videoconvert ! x264enc tune=zerolatency key-int-max=45 \
357+
! h264parse \
358+
! kvssink stream-name='demo-stream-cpp-kvssink-ci-wsl-videotestsrc-${{ matrix.image }}' \
359+
aws-region=${{ env.AWS_DEFAULT_REGION }} \
360+
access-key=${{ env.AWS_ACCESS_KEY_ID }} \
361+
secret-key=${{ env.AWS_SECRET_ACCESS_KEY }} \
362+
session-token=${{ env.AWS_SESSION_TOKEN }}
363+
EXIT_CODE=$?
364+
set -e # Re-enable exit on error
365+
366+
if [[ $EXIT_CODE -ne 0 ]]; then
367+
echo "gst-launch-1.0 exited with status: $EXIT_CODE"
368+
exit $EXIT_CODE
369+
fi
370+
371+
- name: Verify MKV dump in WSL
372+
run: |
373+
cd ~/kvs-cpp-repo/build/debug_output
374+
mkvfiles=($(ls *.mkv 2>/dev/null))
375+
if [ ${#mkvfiles[@]} -eq 0 ]; then
376+
echo 'No MKV files found in debug_output'
377+
exit 1
378+
fi
379+
for file in "${mkvfiles[@]}"; do
380+
echo "Verifying $file with mkvinfo:"
381+
mkvinfo -v -X "$file"
382+
done

.github/workflows/samples.yml

Lines changed: 134 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ jobs:
262262
set -e # Re-enable exit on error
263263
264264
# 130 (128 + 2): Process killed by SIGINT
265-
# 137: Process killed by SIGKILL (if the --kill-after timeout is reached)
265+
# 137: Process killed by SIGKILL (if the --kill-after timeout is reached)
266266
echo "Command exited with code: $EXIT_CODE"
267267
if [ $EXIT_CODE -ne 130 ]; then
268268
echo "Command did not exit gracefully after interrupt."
@@ -275,35 +275,163 @@ jobs:
275275
working-directory: ./build/debug_output
276276
run: |
277277
shopt -s nullglob # Ensure globbing works correctly and avoids errors when no files are found
278-
278+
279279
ls -tlrh
280280
mkvfiles=(*.mkv)
281281
if [ ${#mkvfiles[@]} -eq 0 ]; then
282282
echo "No MKV files found in debug_output"
283283
exit 1
284284
fi
285-
285+
286286
# Since there are 2 streams, check for the presence of two different prefixed MKV files
287287
found_0=0
288288
found_1=0
289-
289+
290290
for file in "${mkvfiles[@]}"; do
291291
if [[ "$file" == ${KVS_STREAM_NAME_BASE}_0* ]]; then
292292
found_0=1
293293
elif [[ "$file" == ${KVS_STREAM_NAME_BASE}_1* ]]; then
294294
found_1=1
295295
fi
296296
done
297-
297+
298298
if [ $found_0 -eq 0 ] || [ $found_1 -eq 0 ]; then
299299
echo "Expected at least one file starting with each prefix:"
300300
echo " - ${KVS_STREAM_NAME_BASE}_0"
301301
echo " - ${KVS_STREAM_NAME_BASE}_1"
302302
exit 1
303303
fi
304-
304+
305305
for file in "${mkvfiles[@]}"; do
306306
echo "Verifying $file with mkvinfo (verbose and hexdump):"
307307
mkvinfo -v -X "$file"
308308
done
309309
shell: bash
310+
311+
wsl-sample-checks:
312+
name: WSL ${{ matrix.image }} - ${{ matrix.sample.name }}
313+
314+
strategy:
315+
matrix:
316+
sample:
317+
- name: kvs_gstreamer_audio_video_sample
318+
args: -f sample.mp4
319+
- name: kvs_gstreamer_file_uploader_sample
320+
args: sample.mp4 0 audio-video
321+
- name: kvs_gstreamer_sample
322+
args: sample.mp4
323+
- name: kvssink_gstreamer_sample
324+
args: sample.mp4
325+
image:
326+
- Ubuntu-22.04
327+
- Ubuntu-24.04
328+
329+
fail-fast: false
330+
331+
runs-on: windows-2022
332+
timeout-minutes: 30
333+
334+
permissions:
335+
id-token: write
336+
contents: read
337+
338+
defaults:
339+
run:
340+
shell: wsl-bash {0} # Automatically uses wsl-bash for each run step
341+
342+
steps:
343+
- uses: Vampire/setup-wsl@v4
344+
with:
345+
distribution: ${{ matrix.image }}
346+
additional-packages: |
347+
automake
348+
build-essential
349+
cmake
350+
git
351+
gstreamer1.0-plugins-base-apps
352+
gstreamer1.0-plugins-bad
353+
gstreamer1.0-plugins-good
354+
gstreamer1.0-plugins-ugly
355+
gstreamer1.0-tools
356+
libcurl4-openssl-dev
357+
libgstreamer1.0-dev
358+
libgstreamer-plugins-base1.0-dev
359+
liblog4cplus-dev
360+
libssl-dev
361+
pkg-config
362+
mkvtoolnix
363+
use-cache: 'false' # Cache entry for Ubuntu 22.04 and 24.04 are the same (conflict)
364+
365+
- name: Clone repository
366+
uses: actions/checkout@v4
367+
368+
- name: Move repository in WSL
369+
run: |
370+
# Copy to ~/kvs-cpp-repo for simplicity
371+
# Note: Can't move due to no permissions
372+
REPO_NAME=$(basename ${{ github.repository }})
373+
cp -r /mnt/d/a/$REPO_NAME/$REPO_NAME ~/kvs-cpp-repo
374+
375+
- name: Build samples in WSL
376+
run: |
377+
mkdir -p ~/kvs-cpp-repo/build
378+
cd ~/kvs-cpp-repo/build
379+
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DALIGNED_MEMORY_MODEL=ON -DBUILD_DEPENDENCIES=OFF
380+
make -j$(nproc)
381+
382+
- name: Configure AWS Credentials
383+
uses: aws-actions/configure-aws-credentials@v4
384+
with:
385+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
386+
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
387+
aws-region: ${{ secrets.AWS_REGION }}
388+
role-duration-seconds: 900
389+
390+
- name: Run ${{ matrix.sample.name }} (WSL)
391+
run: |
392+
cd ~/kvs-cpp-repo/build
393+
export KVS_DEBUG_DUMP_DATA_FILE_DIR=~/kvs-cpp-repo/build/debug_output
394+
mkdir "$KVS_DEBUG_DUMP_DATA_FILE_DIR"
395+
export GST_PLUGIN_PATH=~/kvs-cpp-repo/build
396+
export AWS_KVS_LOG_LEVEL=2
397+
398+
curl -fsSL -o sample.mp4 https://awsj-iot-handson.s3-ap-northeast-1.amazonaws.com/kvs-workshop/sample.mp4
399+
400+
# Note: `env.` syntax to reference credentials to have GitHub Actions inject
401+
# the secret values into these environment variables before the command runs,
402+
# since the WSL shell doesn't have access to GitHub's environment variables
403+
export AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }}
404+
export AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }}
405+
export AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }}
406+
export AWS_DEFAULT_REGION=${{ env.AWS_DEFAULT_REGION }}
407+
408+
set +e # Disable exit on error for the timeout command
409+
./${{ matrix.sample.name }} demo-stream-producer-cpp-wsl-${{ matrix.image }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
410+
EXIT_CODE=$?
411+
set -e # Re-enable exit on error
412+
413+
unset AWS_ACCESS_KEY_ID
414+
unset AWS_SECRET_ACCESS_KEY
415+
unset AWS_SESSION_TOKEN
416+
417+
if [[ EXIT_CODE -ne 0 ]]; then
418+
echo "${{ matrix.sample.name }} exited with code: $EXIT_CODE"
419+
exit $EXIT_CODE
420+
fi
421+
422+
- name: Verify MKV dump exists (WSL)
423+
run: |
424+
cd ~/kvs-cpp-repo/build/debug_output
425+
shopt -s nullglob # Ensure globbing works correctly and avoids errors when no files are found
426+
427+
ls -tlrh
428+
mkvfiles=(*.mkv)
429+
if [ ${#mkvfiles[@]} -eq 0 ]; then
430+
echo "No MKV files found in debug_output"
431+
exit 1
432+
fi
433+
434+
for file in "${mkvfiles[@]}"; do
435+
echo "Verifying $file with mkvinfo (verbose and hexdump):"
436+
mkvinfo -v -X "$file"
437+
done

0 commit comments

Comments
 (0)