Skip to content

New feature: Local distribution capability #151

New feature: Local distribution capability

New feature: Local distribution capability #151

Workflow file for this run

name: Build and test for every PR
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: write
jobs:
build_and_test:
name: build and test
runs-on: ubuntu-20.04
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: prepare libraries
run: |
sudo apt update
sudo apt install -y make git pkg-config libssl-dev cmake binutils-dev libgoogle-glog-dev gcc g++ golang wget libgl1
sudo apt install -y python3.9 python3-dev python3-pip
sudo python3 -m pip install timeout_decorator numpy onnxruntime pytest opencv-python
# The version of ffmpeg installed via apt is 4.2, but the current test results are based on version 4.4, so here we need to compile version 4.4 of ffmpeg from source code
#apt install -y ffmpeg libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev
# When running unit tests, nasm/yasm installed via apt will cause the indicators to be misaligned, so it needs to be compiled from source code
#apt install -y nasm yasm
sudo scripts/build_ffmpeg.sh nasm yasm x264 x265 opus
- name: build
id: build
run: |
./build.sh debug
- name: set envs
run: |
echo "C_INCLUDE_PATH=${C_INCLUDE_PATH}:$(pwd)/output/bmf/include" >> $GITHUB_ENV
echo "CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:$(pwd)/output/bmf/include" >> $GITHUB_ENV
echo "LIBRARY_PATH=${LIBRARY_PATH}:$(pwd)/output/bmf/lib" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$(pwd)/output/bmf/lib:/usr/local/lib" >> $GITHUB_ENV
echo "PYTHONPATH=$(pwd)/output/bmf/lib:$(pwd)/output" >> $GITHUB_ENV
echo "PATH=${PATH}:$(pwd)/output/bmf/bin" >> $GITHUB_ENV
echo "HMP_TEST_DATA_ROOT=$(pwd)/bmf/hml/tests/data" >> $GITHUB_ENV
- name: test
id: test
run: |
# install test modules for c++/python/go
sudo $(pwd)/output/bmf/bin/module_manager install python_copy_module python my_module:my_module $(pwd)/output/test/customize_module v0.0.1
sudo $(pwd)/output/bmf/bin/module_manager install cpp_copy_module c++ libcopy_module:CopyModule $(pwd)/output/test/c_module/lib v0.0.1
(cd $(pwd)/output/test/go_module && go build -buildmode c-shared -o lib/go_copy_module.so test_go_module.go)
sudo $(pwd)/output/bmf/bin/module_manager install go_copy_module go go_copy_module:PassThrough $(pwd)/output/test/go_module/lib v0.0.1
# download files
(cd output && wget https://github.com/BabitMF/bmf/releases/download/files/files.tar.gz && tar xvf files.tar.gz && rm -rf files.tar.gz)
(cd output && wget https://github.com/BabitMF/bmf/releases/download/files/models.tar.gz && tar xvf models.tar.gz && rm -rf models.tar.gz)
# test bmf
(cd output/bmf/bin && ./test_bmf_module_sdk && ./test_bmf_engine && ./test_cpp_builder)
#(cd output/bmf/bin && ./test_builtin_modules)
(cd output/demo/transcode && python3 test_transcode.py)
(cd output/demo/edit && python3 test_edit.py)
(cd output/demo/predict && python3 predict_sample.py)
(cd output/test/audio_copy && python3 test_simple.py)
(cd output/test/pre_module && python3 test_pre_module.py)
(cd output/test/sync_mode && python3 test_sync_mode.py)
(cd output/test/generator && python3 test_generator.py)
(cd output/test/run_by_config && python3 test_run_by_config.py)
(cd output/test/server && python3 test_server.py)
(cd output/test/c_module && python3 test_video_c_module.py)
(cd output/test/dynamical_graph && python3 dynamical_graph.py)
(cd output/test/av_log_buffer && python3 test_av_log_buffer.py)
(cd output/test/push_data_into_graph && python3 test_push_data.py)
(cd output/test/complex_edit_case && python3 test_complex_case.py)
(cd output/test/complex_edit_case && python3 test_compare_with_edit.py)
# test hmp
(cd bmf/hml/tests/data && ./gen.sh $(pwd)/../../../../output/files)
(cd bmf/hml/tests && pytest)