Skip to content

Commit

Permalink
github-action: post-build follow-up tests
Browse files Browse the repository at this point in the history
This includes follow-up tests, which test other software packages
directly depending on NNStreamer.
- Android ML-API
- Ubuntu app test
- Tizen ML-API test
- Tizen ML Agent test

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
  • Loading branch information
myungjoo committed Feb 2, 2024
1 parent 0f3212f commit f70492b
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ jobs:
ls -la /data/nnstreamer/cerbero.custom-1.12.4-ndkr12b-20190213-0900/build/dist/android_arm64/lib/
echo "::endgroup::"
cd ..
- name: ML API Test
if: env.rebuild == '1'
run: |
42 changes: 35 additions & 7 deletions .github/workflows/gbs_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,47 @@ jobs:
if: env.rebuild == '1'
run: |
gbs build --skip-srcrpm --define "_skip_debug_rpm 1" ${{ matrix.aarch }} ${{ matrix.option }}
## Skip nntrainer build test in aarch64. @todo We need #2430 and #2431 in nntrainer.git
if [[ "${{ matrix.aarch }}" == "-A aarch64" ]]; then
echo "rebuild=0" >> "$GITHUB_ENV"
fi
- name: get nntrainer
if: env.rebuild == '1'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: nnstreamer/nntrainer
path: nntrainer
- name: run nntrainer GBS build
if: env.rebuild == '1'
run: |
pushd nntrainer
gbs build --skip-srcrpm ${{ matrix.aarch }} ${{ matrix.option }} --define "_skip_debug_rpm 1"
## Skip nntrainer build test in aarch64. @todo We need #2430 and #2431 in nntrainer.git
if [[ "${{ matrix.aarch }}" == "-A aarch64" ]]; then
echo "Skipping aarch64/nntrainer build temporarily. Reenable this after fp16 related issues are resolved."
else
pushd nntrainer
echo "::group::Build and run unit-tests for NNTrainer"
gbs build --skip-srcrpm ${{ matrix.aarch }} ${{ matrix.option }} --define "_skip_debug_rpm 1"
echo "::endgroup::"
popd
fi
- name: get ML API
if: env.rebuild == '1'
uses: actions/checkout@v4
with:
repository: nnstreamer/api
path: api
- name: get ML Agent
if: env.rebuild == '1'
uses: actions/checkout@v4
with:
repository: nnstreamer/deviceMLOps.MLAgent
path: mlagent
- name: run ml-api and ml-agent build
if: env.rebuild == '1'
run: |
pushd api
echo "::group::Build and run unit-tests for ML API"
gbs build --skip-srcrpm --define "_skip_debug_rpm 1" ${{ matrix.aarch }} ${{ matrix.option }}
echo "::endgroup::"
popd
pushd mlagent
echo "::group::Build and run unit-tests for ML Agent (deviceMLOps.MLAgent)"
gbs build --skip-srcrpm --define "_skip_debug_rpm 1" ${{ matrix.aarch }} ${{ matrix.option }}
echo "::endgroup::"
popd
34 changes: 34 additions & 0 deletions .github/workflows/ubuntu_clean_meson_build.nnstreamer.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Set 1 or True if you want to set your custom sub-plugins' path with env variables.
# Please be informed that, configured ini file should be in RO partition for the release binary.
[common]
enable_envvar=true
enable_symlink=true

[filter]
filters=@SUBPLUGIN_INSTALL_PREFIX@/build/ext/nnstreamer/tensor_filter/
customfilters=@SUBPLUGIN_INSTALL_PREFIX@/build/tests/nnstreamer_example/

# Set framework priority about model file extension when automatically selecting framework for tensor filter.
# A comma separated prioritized list of neural network frameworks to open model file
framework_priority_tflite=tensorflow-lite
framework_priority_nb=
framework_priority_bin=

[decoder]
decoders=@SUBPLUGIN_INSTALL_PREFIX@/build/ext/nnstreamer/tensor_decoder/

[converter]
converters=@SUBPLUGIN_INSTALL_PREFIX@/build/ext/nnstreamer/tensor_converter/

[trainer]
trainers=@SUBPLUGIN_INSTALL_PREFIX@/build/ext/nnstreamer/tensor_trainer/

# Set 1 or True if you want to use GPU with pytorch for computation.
[pytorch]
enable_use_gpu=False

[tensorflow-lite]
subplugin_priority=tensorflow2-lite

[filter-aliases]
trix-engine = srnpu
114 changes: 110 additions & 4 deletions .github/workflows/ubuntu_clean_meson_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ jobs:
- name: install requirements
if: env.rebuild == '1'
run: |
sudo apt-get update && sudo apt-get install -y libglib2.0-dev libjson-glib-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev googletest
sudo apt-get install -y liborc-0.4-dev flex bison libopencv-dev pkg-config python3-dev python3-numpy python3
sudo add-apt-repository -y ppa:nnstreamer/ppa && sudo apt-get update && sudo apt-get install -y ssat libpaho-mqtt-dev
sudo apt-get install -y valgrind gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-base libgtest-dev libpng-dev libc6-dbg binutils-x86-64-linux-gnu-dbg valgrind-dbg
sudo add-apt-repository -y ppa:nnstreamer/ppa
sudo apt-get update
sudo apt-get install -y ssat libpaho-mqtt-dev libglib2.0-dev libjson-glib-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev googletest liborc-0.4-dev flex bison libopencv-dev pkg-config python3-dev python3-numpy python3 sed valgrind gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-base libgtest-dev libpng-dev libc6-dbg binutils-x86-64-linux-gnu-dbg valgrind-dbg gstreamer1.0-tools tigervnc-standalone-server
pip install meson ninja
- name: build and unit test
if: env.rebuild == '1'
Expand All @@ -55,6 +54,113 @@ jobs:
- name: GTEST run with Valgrind on a case
if: env.rebuild == '1'
run: if [ '${{ matrix.os }}' == 'ubuntu-22.04' ]; then export NNSTREAMER_BUILD_ROOT_PATH=`pwd`/build && export NNSTREAMER_FILTERS=`pwd`/build/ext/nnstreamer/tensor_filter && export NNSTREAMER_DECODERS=`pwd`/build/ext/nnstreamer/tensor_decoder && export NNSTREAMER_CONVERTERS=`pwd`/build/ext/nnstreamer/tensor_converter && export GST_PLUGIN_PATH=`pwd`/build/gst && export NNSTREAMER_CONF=`pwd`/build/nnstreamer-test.ini && G_SLICE=always-malloc G_DEBUG=gc-friendly ./packaging/run_unittests_binaries.sh --valgrind ./tests/ || echo "There are Valgrind errors. Please fix it. As we have a lot of Valgrind errors from different libraries and possible from nnstreamer itself, we are not halting the build with Valgrind errors until we get them all."; fi
- name: get NNStreamer Example Apps
if: env.rebuild == '1'
uses: actions/checkout@v4
with:
repository: nnstreamer/nnstreamer-example
path: examples
- name: get V4L2 loopback
if: env.rebuild == '1'
uses: actions/checkout@v4
with:
repository: umlaeute/v4l2loopback
path: v4l2loopback
- name: NNStreamer App Test
if: env.rebuild == '1'
run: |
export GST_PLUGIN_PATH=$(pwd)/build/gst/nnstreamer
currentpath=$(pwd)
sed -i "s|@SUBPLUGIN_INSTALL_PREFIX@|${currentpath}|" .github/workflows/ubuntu_clean_meson_build.nnstreamer.ini
sudo cp .github/workflows/ubuntu_clean_meson_build.nnstreamer.ini /etc/nnstreamer.ini
pushd examples
echo "::group::Start building exmaple apps."
meson --prefix=$(pwd) --sysconfdir=$(pwd) --libdir=lib --bindir=bin --includedir=include build
ninja -C build install
echo "::endgroup::"
pushd bin
echo "::group::Fetch an image classification model"
bash get-model-image-classification-tflite.sh
echo "::endgroup::"
popd
popd
echo "Install a V4L2 cam with videotestsrc"
declare -i xvnc_ports=31
if [[ ! -e /dev/video0 ]]; then
pushd v4l2loopback
make clean
make
sudo insmod /lib/modules/`uname -r`/kernel/drivers/media/media.ko
sudo insmod /lib/modules/`uname -r`/kernel/drivers/v4l2-core/videodev.ko
sudo insmod ./v4l2loopback.ko
cat /etc/group | grep video
popd
fi
if [[ ! -f ~/.Xauthority ]]; then
touch ~/.Xauthority
fi
declare -i xvnc_pid=0
xvnc_pid=$(ps -A -o pid,cmd | grep "[\:]${xvnc_port}" | awk '{printf $1}')
if [[ $xvnc_pid -ne 0 ]]; then
kill $xvnc_pid
fi
Xtigervnc :${xvnc_port}
export DISPLAY=0.0:${xvnc_port}
declare -i producer_id=0
gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video0 &
producer_id=$!
echo "V4L2 Loopback producer is = ${producer_id}"
gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! ximagesink &>> /dev/null &
pid=$!
sleep 2
kill ${pid}
pushd examples/bin
echo "::group::V4L2Cam --> Image Classification (C/GStreamer)"
./nnstreamer_example_image_classification_tflite
pid=$!
sleep 2
kill ${pid}
echo "::endgroup::"
echo "::group::V4L2Cam --> Image Classification (Python/GStreamer)"
python nnstreamer_example_image_classification_tflite.py
pid=$!
sleep 2
kill ${pid}
echo "::endgroup::"
echo "::group::V4L2Cam --> Tensor Stream Path Manipulators (C/GStreamer)"
./nnstreamer_example_cam
pid=$!
sleep 2
kill ${pid}
echo "::endgroup::"
echo "::group::V4L2Cam --> Sink examples (C/GStreamer)"
./nnstreamer_sink_example
pid=$!
sleep 2
kill ${pid}
echo "::endgroup::"
echo "::group::V4L2Cam --> Sink examples with more tensor paths (C/GStreamer)"
./nnstreamer_sink_example_play
pid=$!
sleep 2
kill ${pid}
echo "::endgroup::"
kill ${producer_id}
popd
# TODO: add more subplugins to be built
# TODO: add unit testing
Expand Down

0 comments on commit f70492b

Please sign in to comment.