@@ -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