-
Notifications
You must be signed in to change notification settings - Fork 68
156 lines (146 loc) · 8.72 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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)
build_and_test_win:
name: build and test win
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: build_test
shell: pwsh
run: |
$bashPath = "C:\msys64\usr\bin\bash.exe"
$bashCommand = @'
export PATH=/usr/bin:/usr/lib:/usr/include:$PATH
echo $PATH
echo "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" | sed 's/[^0-9A-Za-z]/^&/g'
eval "$(./win_env/vcvarsall.sh x64)"
export INCLUDE="${INCLUDE};C:\\msys64\\usr\\include"
wget https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-03-20-13-14/ffmpeg-n4.4.4-92-g01fc3034ee-win64-gpl-shared-4.4.zip
pacman -S unzip --noconfirm
unzip ffmpeg-n4.4.4-92-g01fc3034ee-win64-gpl-shared-4.4.zip
cp -r ffmpeg-n4.4.4-92-g01fc3034ee-win64-gpl-shared-4.4/* /usr/
ls /usr/lib
ls /usr/include
ls /usr/bin
cmake -version
./build_win_lite.sh --msvc=2022 --preset=x64-Release bmf_ffmpeg
cmake --build build_win_lite/x64-Release --config Release --target ALL_BUILD
cmake --build build_win_lite/x64-Release --config Release --target ALL_BUILD
cmake --build build_win_lite/x64-Release --config Release --target ALL_BUILD
cp -r build_win_lite/x64-Release/output .
python -m pip install timeout_decorator numpy onnxruntime pytest opencv-python
export PYTHONHOME="$(dirname "$(which python)")"
export C_INCLUDE_PATH=${C_INCLUDE_PATH}:$(pwd)/output/bmf/include
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:$(pwd)/output/bmf/include
export LIBRARY_PATH=${LIBRARY_PATH}:$(pwd)/output/bmf/lib
export PYTHONPATH=$(pwd)/output/bmf/lib:$(pwd)/output
export PATH=$(pwd)/3rd_party/win_rootfs/usr/bin:$(pwd)/3rd_party/win_rootfs/usr/lib:$(pwd)/output/bmf/bin:$(pwd)/output/bmf/lib:${PATH}
echo $PATH
echo $(pwd)
export HMP_TEST_DATA_ROOT=$(pwd)/bmf/hml/tests/data
run_bmf_graph
ffmpeg
module_manager
./output/bmf/bin/module_manager install python_copy_module python my_module:my_module $(pwd)/output/test/customize_module v0.0.1
./output/bmf/bin/module_manager install cpp_copy_module c++ copy_module:CopyModule $(pwd)/output/test/c_module/lib v0.0.1
(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)
cd output/bmf/bin
./test_bmf_module_sdk.exe
./test_bmf_engine.exe --gtest_filter=-go_module.module_loader
./test_cpp_builder.exe
cd -
export
ls output/bmf/lib
ls output/bmf/bin
which python
which python3
(cd output/demo/transcode && python test_transcode.py)
(cd output/demo/edit && python test_edit.py)
(cd output/demo/predict && python predict_sample.py)
(cd output/test/audio_copy && python test_simple.py)
(cd output/test/pre_module && python test_pre_module.py)
(cd output/test/sync_mode && python test_sync_mode.py)
(cd output/test/generator && python test_generator.py)
(cd output/test/run_by_config && python test_run_by_config.py)
(cd output/test/server && python test_server.py)
(cd output/test/c_module && python test_video_c_module.py)
(cd output/test/dynamical_graph && python dynamical_graph.py)
(cd output/test/av_log_buffer && python test_av_log_buffer.py)
(cd output/test/push_data_into_graph && python test_push_data.py)
(cd output/test/complex_edit_case && python test_complex_case.py)
(cd output/test/complex_edit_case && python test_compare_with_edit.py)
(cd bmf/hml/tests/data && ./gen.sh $(pwd)/../../../../output/files)
(cd bmf/hml/tests && python -m pytest)
'@
echo $bashCommand | & $bashPath