Control PTZ Camera using HTTP request #223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Plugin Build | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
branches: | |
- main | |
env: | |
artifactName: ${{ contains(github.ref_name, '/') && 'artifact' || github.ref_name }} | |
jobs: | |
linux_build: | |
runs-on: ${{ matrix.ubuntu }} | |
strategy: | |
fail-fast: false | |
matrix: | |
obs: [28] | |
ubuntu: ['ubuntu-22.04'] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Restore ccache | |
id: ccache-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.ccache | |
key: linux-obs${{ matrix.obs }}-${{ matrix.ubuntu }}-ccache | |
- name: Setup ccache | |
run: | | |
sudo apt install ccache | |
ccache --set-config=cache_dir="${{ github.workspace }}/.ccache" | |
ccache --set-config=compression=true | |
- name: Download obs-studio development environment | |
id: obsdeps | |
uses: norihiro/obs-studio-devel-action@v2 | |
with: | |
obs: ${{ matrix.obs }} | |
verbose: true | |
- name: Download dlib-models | |
run: | | |
set -ex | |
DESTDIR='./' ci/download-dlib-models.sh | |
- name: Build plugin | |
run: | | |
set -ex | |
sudo apt install -y \ | |
libopenblas-dev libopenblas0 \ | |
libcurl4-openssl-dev \ | |
|| true | |
export OPENBLAS_HOME=/lib/x86_64-linux-gnu/ | |
cmake -S . -B build \ | |
-D CMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-D CPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON \ | |
-D PKG_SUFFIX=-obs${{ matrix.obs }}-${{ matrix.ubuntu }}-x86_64 \ | |
${{ steps.obsdeps.outputs.PLUGIN_CMAKE_OPTIONS }} | |
cd build | |
make -j4 | |
make package | |
echo "FILE_NAME=$(find $PWD -name '*.deb' | head -n 1)" >> $GITHUB_ENV | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifactName }}-linux-obs${{ matrix.obs }}-${{ matrix.ubuntu }} | |
path: '${{ env.FILE_NAME }}' | |
- name: Check package | |
run: | | |
. build/ci/ci_includes.generated.sh | |
set -ex | |
sudo apt install -y '${{ env.FILE_NAME }}' | |
ldd /usr/lib/x86_64-linux-gnu/obs-plugins/${PLUGIN_NAME}.so > ldd.out | |
if grep not.found ldd.out ; then | |
echo "Error: unresolved shared object." >&2 | |
exit 1 | |
fi | |
ls /usr/share/obs/obs-plugins/${PLUGIN_NAME}/ | |
macos_build: | |
runs-on: macos-13 | |
strategy: | |
fail-fast: false | |
matrix: | |
obs: [28] | |
arch: [x86_64, arm64] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Environment | |
id: setup | |
run: | | |
set -e | |
echo '::group::Set up code signing' | |
if [[ '${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' != '' && \ | |
'${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}' != '' && \ | |
'${{ secrets.MACOS_SIGNING_CERT }}' != '' ]]; then | |
echo "haveCodesignIdent=true" >> $GITHUB_OUTPUT | |
else | |
echo "haveCodesignIdent=false" >> $GITHUB_OUTPUT | |
fi | |
if [[ '${{ secrets.MACOS_NOTARIZATION_USERNAME }}' != '' && \ | |
'${{ secrets.MACOS_NOTARIZATION_PASSWORD }}' != '' ]]; then | |
echo "haveNotarizationUser=true" >> $GITHUB_OUTPUT | |
else | |
echo "haveNotarizationUser=false" >> $GITHUB_OUTPUT | |
fi | |
echo '::endgroup::' | |
echo '::group::Set up ccache' | |
brew install ccache | |
ccache --set-config=cache_dir="${{ github.workspace }}/.ccache" | |
ccache --set-config=compression=true | |
echo '::endgroup::' | |
- name: Restore ccache | |
id: ccache-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.ccache | |
key: macos-obs${{ matrix.obs }}-${{ matrix.arch }}-ccache | |
- name: Install Apple Developer Certificate | |
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
keychain-password: ${{ github.run_id }} | |
p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }} | |
p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }} | |
- name: Set Signing Identity | |
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' && steps.setup.outputs.haveNotarizationUser == 'true' }} | |
run: | | |
set -e | |
TEAM_ID=$(echo "${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" | sed 's/.*(\([A-Za-z0-9]*\))$/\1/') | |
xcrun notarytool store-credentials AC_PASSWORD \ | |
--apple-id "${{ secrets.MACOS_NOTARIZATION_USERNAME }}" \ | |
--team-id "$TEAM_ID" \ | |
--password "${{ secrets.MACOS_NOTARIZATION_PASSWORD }}" | |
- name: Download obs-studio development environment | |
id: obsdeps | |
uses: norihiro/obs-studio-devel-action@v2 | |
with: | |
path: /tmp/deps-${{ matrix.obs }}-${{ matrix.arch }} | |
arch: ${{ matrix.arch }} | |
obs: ${{ matrix.obs }} | |
verbose: true | |
- name: Prepare dlib dependency | |
if: ${{ matrix.arch == 'x86_64' }} | |
run: | | |
brew install openblas | |
echo "OPENBLAS_HOME=/usr/local/opt/openblas/" >> $GITHUB_ENV | |
cp /usr/local/opt/openblas/LICENSE data/LICENSE-openblas | |
- name: Prepare dlib dependency | |
if: ${{ matrix.arch == 'arm64' }} | |
run: ci/macos/download-openblas-arm64.sh | |
- name: Download dlib-models | |
run: | | |
set -ex | |
mkdir data/dlib_hog_model | |
curl -LO https://github.com/norihiro/obs-face-tracker/releases/download/0.7.0-hogdata/frontal_face_detector.dat.bz2 | |
bunzip2 < frontal_face_detector.dat.bz2 > data/dlib_hog_model/frontal_face_detector.dat | |
git clone --depth 1 https://github.com/davisking/dlib-models | |
mkdir data/{dlib_cnn_model,dlib_face_landmark_model} | |
bunzip2 < dlib-models/mmod_human_face_detector.dat.bz2 > data/dlib_cnn_model/mmod_human_face_detector.dat | |
bunzip2 < dlib-models/shape_predictor_5_face_landmarks.dat.bz2 > data/dlib_face_landmark_model/shape_predictor_5_face_landmarks.dat | |
cp dlib/LICENSE.txt data/LICENSE-dlib | |
cp dlib-models/LICENSE data/LICENSE-dlib-models | |
- name: Build plugin | |
run: | | |
arch=${{ matrix.arch }} | |
deps=/tmp/deps-${{ matrix.obs }}-${{ matrix.arch }} | |
MACOSX_DEPLOYMENT_TARGET=${{ steps.obsdeps.outputs.MACOSX_DEPLOYMENT_TARGET }} | |
GIT_TAG=$(git describe --tags --always) | |
PKG_SUFFIX=-${GIT_TAG}-obs${{ matrix.obs }}-macos-${{ matrix.arch }} | |
export OPENBLAS_HOME=${{ env.OPENBLAS_HOME }} | |
set -e | |
cmake -S . -B build -G Ninja \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_PREFIX_PATH="$PWD/release/" \ | |
-DCMAKE_OSX_ARCHITECTURES=$arch \ | |
-D OBS_BUNDLE_CODESIGN_IDENTITY='${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' \ | |
-D PKG_SUFFIX=$PKG_SUFFIX \ | |
${{ steps.obsdeps.outputs.PLUGIN_CMAKE_OPTIONS }} | |
cmake --build build --config RelWithDebInfo | |
- name: Prepare package | |
run: | | |
set -ex | |
. build/ci/ci_includes.generated.sh | |
cmake --install build --config RelWithDebInfo --prefix=release | |
(cd release/${PLUGIN_NAME}.plugin/Contents && ../../../ci/macos/change-rpath.sh -obs ${{ matrix.obs }} -lib lib/ MacOS/${PLUGIN_NAME}) | |
cp LICENSE release/${PLUGIN_NAME}.plugin/Contents/Resources/LICENSE-$PLUGIN_NAME | |
- name: Codesign | |
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} | |
run: | | |
. build/ci/ci_includes.generated.sh | |
set -ex | |
files=( | |
$(find release/${PLUGIN_NAME}.plugin/ -name '*.dylib') | |
release/${PLUGIN_NAME}.plugin/Contents/MacOS/${PLUGIN_NAME} | |
) | |
for dylib in "${files[@]}"; do | |
codesign --force --sign "${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" "$dylib" | |
done | |
for dylib in "${files[@]}"; do | |
codesign -vvv --deep --strict "$dylib" | |
done | |
- name: Package | |
run: | | |
. build/ci/ci_includes.generated.sh | |
set -ex | |
zipfile=$PWD/package/${PLUGIN_NAME}${PKG_SUFFIX}.zip | |
mkdir package | |
(cd release/ && zip -r $zipfile ${PLUGIN_NAME}.plugin) | |
ci/macos/install-packagesbuild.sh | |
packagesbuild \ | |
--build-folder $PWD/package/ \ | |
build/installer-macOS.generated.pkgproj | |
- name: Productsign | |
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} | |
run: | | |
. build/ci/ci_includes.generated.sh | |
pkgfile=package/${PLUGIN_NAME}${PKG_SUFFIX}.pkg | |
set -e | |
. build/ci/ci_includes.generated.sh | |
productsign --sign "${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" $pkgfile package/${PLUGIN_NAME}-signed.pkg | |
mv package/${PLUGIN_NAME}-signed.pkg $pkgfile | |
- name: Notarize | |
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} | |
uses: norihiro/macos-notarize-action@v1 | |
with: | |
path: package/* | |
keychainProfile: AC_PASSWORD | |
verbose: true | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifactName }}-macos-obs${{ matrix.obs }}-${{ matrix.arch }} | |
path: package/* | |
windows_build: | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
obs: [28] | |
arch: [x64] | |
env: | |
visualStudio: 'Visual Studio 17 2022' | |
Configuration: 'RelWithDebInfo' | |
defaults: | |
run: | |
shell: pwsh | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download obs-studio | |
id: obsdeps | |
uses: norihiro/obs-studio-devel-action@v2 | |
with: | |
obs: ${{ matrix.obs }} | |
- name: Download dlib-models | |
shell: bash | |
run: | | |
set -ex | |
mkdir data/dlib_hog_model | |
curl -LO https://github.com/norihiro/obs-face-tracker/releases/download/0.7.0-hogdata/frontal_face_detector.dat.bz2 | |
bunzip2 < frontal_face_detector.dat.bz2 > data/dlib_hog_model/frontal_face_detector.dat | |
git clone --depth 1 https://github.com/davisking/dlib-models | |
mkdir data/{dlib_cnn_model,dlib_face_landmark_model} | |
7z x dlib-models/mmod_human_face_detector.dat.bz2 -so > data/dlib_cnn_model/mmod_human_face_detector.dat | |
7z x dlib-models/shape_predictor_5_face_landmarks.dat.bz2 -so > data/dlib_face_landmark_model/shape_predictor_5_face_landmarks.dat | |
cp dlib/LICENSE.txt data/LICENSE-dlib | |
cp dlib-models/LICENSE data/LICENSE-dlib-models | |
- name: Build plugin | |
run: | | |
$CmakeArgs = @( | |
'-G', "${{ env.visualStudio }}" | |
'-DCMAKE_SYSTEM_VERSION=10.0.18363.657' | |
) | |
cmake -S . -B build @CmakeArgs ${{ steps.obsdeps.outputs.PLUGIN_CMAKE_OPTIONS_PS }} | |
cmake --build build --config RelWithDebInfo -j 4 | |
cmake --install build --config RelWithDebInfo --prefix "$(Resolve-Path -Path .)/release" | |
- name: Package plugin | |
run: ci/windows/package-windows.cmd ${{ matrix.obs }} | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifactName }}-windows-obs${{ matrix.obs }}-${{ matrix.arch }} | |
path: package/* |