Skip to content

Commit f07a4ba

Browse files
CI/CD workflow (#1)
Merge first PR :)
1 parent 5c811ae commit f07a4ba

File tree

12 files changed

+332
-63
lines changed

12 files changed

+332
-63
lines changed

.github/workflows/main.yml

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
name: hyperion-obs
2+
on: [push, pull_request]
3+
4+
jobs:
5+
Linux:
6+
name: 'Linux 64bit'
7+
runs-on: ubuntu-latest
8+
env:
9+
obs-studio-version: 25.0.0
10+
project-name: hyperion-obs
11+
project-git: hyperion-obs-plugin
12+
maintainer: hyperion-project.org
13+
14+
steps:
15+
- name: Checkout hyperion-obs
16+
uses: actions/checkout@v2
17+
with:
18+
path: ${{ github.workspace }}
19+
submodules: 'true'
20+
21+
- name: Checkout OBS-Studio
22+
uses: actions/checkout@v2
23+
with:
24+
repository: obsproject/obs-studio
25+
path: ${{ github.workspace }}/obs-studio
26+
submodules: 'true'
27+
28+
- name: Generate environment variables from .version
29+
shell: bash
30+
run: echo "VERSION=$(tr -d '\n' < .version)" >> $GITHUB_ENV
31+
32+
- name: Install Dependencies
33+
shell: bash
34+
run: |
35+
sudo apt-get -qq update
36+
sudo apt-get install -y libobs-dev git libc-dev-bin libc6-dev build-essential checkinstall cmake qtbase5-dev
37+
38+
- name: Build plugin
39+
shell: bash
40+
run: |
41+
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DOBS_SOURCE=${{ github.workspace }}/obs-studio -DGLOBAL_INSTALLATION=ON
42+
sudo cmake --build ${{ github.workspace }}/build/ --parallel 4 --target install
43+
44+
cd ${{github.workspace}}/build
45+
PAGER="cat" sudo checkinstall -y --type=debian --fstrans=no --nodoc \
46+
--backup=no --deldoc=yes --install=no \
47+
--pkgname=${{ env.project-name }} --pkgversion=${{ env.VERSION }} \
48+
--exclude="/usr/include/flatbuffers,/usr/bin,/usr/lib/x86_64-linux-gnu/cmake,/usr/lib/x86_64-linux-gnu/pkgconfig" \
49+
--pkglicense="MIT" --maintainer="${{ env.maintainer }}" \
50+
--pkggroup="video" \
51+
--pkgsource="https://github.com/${{ env.project-git }}" \
52+
--requires="obs-studio \(\>= ${{ env.obs-studio-version }}\)" \
53+
--pakdir="${{ github.workspace }}/plugin"
54+
sudo mv ${{ github.workspace }}/plugin/*.deb ${{ github.workspace }}/plugin/${{ env.project-name }}.${{ env.VERSION }}.linux.x64.deb
55+
56+
- name: Upload plugin
57+
if: startsWith(github.event.ref, 'refs/tags')
58+
uses: actions/upload-artifact@v2
59+
with:
60+
name: hyperion-obs
61+
path: ${{ github.workspace }}/plugin
62+
63+
Windows:
64+
name: 'Windows 64bit'
65+
runs-on: [windows-latest]
66+
env:
67+
QT_VERSION: '5.15.2'
68+
WINDOWS_DEPS_VERSION: '2019'
69+
CEF_WRAPPER: 'cef_binary_75.1.16+g16a67c4+chromium-75.0.3770.100_windows64_minimal'
70+
CMAKE_GENERATOR: "Visual Studio 16 2019"
71+
CMAKE_SYSTEM_VERSION: "10.0"
72+
project-git: hyperion-obs-plugin
73+
project-name: hyperion-project.org
74+
75+
steps:
76+
- name: Checkout hyperion-obs
77+
uses: actions/checkout@v2
78+
with:
79+
path: ${{ github.workspace }}
80+
submodules: 'recursive'
81+
82+
- name: 'Checkout OBS-Studio'
83+
uses: actions/checkout@v2
84+
with:
85+
repository: obsproject/obs-studio
86+
path: ${{ github.workspace }}/obs-studio
87+
submodules: 'recursive'
88+
89+
- name: Generate environment variables from .version
90+
shell: bash
91+
run: echo "VERSION=$(tr -d '\n' < .version)" >> $GITHUB_ENV
92+
93+
- name: 'Get OBS-Studio git info'
94+
shell: bash
95+
working-directory: ${{ github.workspace }}/obs-studio
96+
run: |
97+
git fetch --prune --unshallow
98+
echo "OBS_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
99+
100+
- name: 'Checkout last OBS-Studio release'
101+
shell: bash
102+
working-directory: ${{ github.workspace }}/obs-studio
103+
run: |
104+
git checkout ${{ env.OBS_GIT_TAG }}
105+
git submodule update
106+
107+
- name: 'Install QT'
108+
run: |
109+
curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_${{ env.QT_VERSION }}.7z -f --retry 5 -C -
110+
7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}\cmbuild\QT"
111+
112+
- name: 'Install pre-built OBS dependencies'
113+
run: |
114+
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -f --retry 5 -C -
115+
7z x dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -o"${{ github.workspace }}\cmbuild\deps"
116+
curl -kLO https://cdn-fastly.obsproject.com/downloads/${{ env.CEF_WRAPPER }}.zip -f --retry 5 -C -
117+
7z x ${{ env.CEF_WRAPPER }}.zip -o"${{ github.workspace }}\cmbuild"
118+
119+
- name: Add msbuild to PATH
120+
uses: microsoft/[email protected]
121+
122+
- name: 'Restore OBS build from cache'
123+
id: build-cache-obs
124+
uses: actions/cache@v1
125+
with:
126+
path: ${{ github.workspace }}/obs-studio/build
127+
key: ${{ runner.os }}-build-cache-obs-${{ env.OBS_GIT_TAG }}
128+
restore-keys: ${{ runner.os }}-build-cache-obs-${{ env.OBS_GIT_TAG }}
129+
130+
- name: 'Configure OBS'
131+
if: steps.build-cache-obs.outputs.cache-hit != 'true'
132+
working-directory: ${{ github.workspace }}/obs-studio
133+
shell: powershell
134+
run: |
135+
New-Item -ItemType Directory -Force -Path .\build
136+
cd .\build
137+
cmake -G "${{ env.CMAKE_GENERATOR }}" -A x64 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2019_64" -DDepsPath="${{ github.workspace }}\cmbuild\deps\win64" -DCEF_ROOT_DIR="${{ github.workspace }}\cmbuild\${{ env.CEF_WRAPPER }}" -DBUILD_CAPTIONS=YES -DCOPIED_DEPENDENCIES=NO -DCOPY_DEPENDENCIES=YES ..
138+
139+
- name: 'Build OBS-Studio'
140+
if: steps.build-cache-obs.outputs.cache-hit != 'true'
141+
working-directory: ${{ github.workspace }}/obs-studio
142+
run: |
143+
msbuild /m /p:Configuration=RelWithDebInfo .\build\libobs\libobs.vcxproj
144+
msbuild /m /p:Configuration=RelWithDebInfo .\build\UI\obs-frontend-api\obs-frontend-api.vcxproj
145+
146+
- name: 'Build hyperion-obs'
147+
working-directory: ${{ github.workspace }}
148+
run: |
149+
mkdir .\build
150+
cd .\build
151+
cmake -G "${{ env.CMAKE_GENERATOR }}" -A x64 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" `
152+
-DOBS_SOURCE="${{ github.workspace }}\obs-studio" `
153+
-DOBS_BUILD="${{ github.workspace }}\obs-studio\build" ..
154+
msbuild /m /p:Configuration=RelWithDebInfo .\hyperion-obs.sln
155+
env:
156+
Qt5_DIR: ${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2019_64
157+
158+
- name: 'Package hyperion-obs'
159+
working-directory: ${{ github.workspace }}
160+
run: |
161+
mkdir release\obs-plugins\64bit
162+
mkdir release\data\obs-plugins\hyperion-obs\
163+
robocopy .\build\RelWithDebInfo .\release\obs-plugins\64bit\ hyperion-obs.dll hyperion-obs.pdb
164+
robocopy /E .\locale .\release\data\obs-plugins\hyperion-obs\locale
165+
iscc .\build\Windows.iss /O. /F"hyperion-obs.${{ env.VERSION }}.windows.x64"
166+
167+
- name: Upload plugin
168+
if: startsWith(github.event.ref, 'refs/tags')
169+
uses: actions/upload-artifact@v2
170+
with:
171+
name: 'hyperion-obs.${{ env.VERSION }}.windows.x64'
172+
path: ${{ github.workspace }}/*.exe
173+
174+
github_publish:
175+
name: Publish GitHub Releases
176+
if: startsWith(github.event.ref, 'refs/tags')
177+
needs: [Linux, Windows]
178+
runs-on: ubuntu-latest
179+
steps:
180+
- name: Checkout
181+
uses: actions/checkout@v2
182+
183+
- name: Generate environment variables from .version
184+
shell: bash
185+
run: echo "VERSION=$(tr -d '\n' < .version)" >> $GITHUB_ENV
186+
187+
# Download artifacts from previous build process
188+
- name: Download artifacts
189+
uses: actions/download-artifact@v2
190+
with:
191+
path: artifacts
192+
193+
# Create draft release and upload artifacts
194+
- name: Create draft release
195+
uses: softprops/action-gh-release@v1
196+
with:
197+
name: hyperion-obs ${{ env.VERSION }}
198+
tag_name: ${{ env.TAG }}
199+
files: "artifacts/**"
200+
draft: true
201+
env:
202+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# .gitignore
22
build/
3+
.vscode

.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.1

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
cmake_minimum_required(VERSION 3.5)
22
cmake_policy(SET CMP0071 NEW)
33
project(hyperion-obs)
4+
file (STRINGS ".version" PLUGIN_VERSION)
5+
message(STATUS "hyperion-obs version: ${PLUGIN_VERSION}")
6+
set(PLUGIN_AUTHOR "hyperion-project")
7+
set(PLUGIN_GIT "hyperion-obs-plugin")
48

59
# Macro to get path of first sub dir of a dir, used for MAC OSX lib/header searching
610
MACRO(FIRSTSUBDIR result curdir)
@@ -46,29 +50,30 @@ endif()
4650
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
4751
if (NOT DEFINED ENV{Qt5_BASE_DIR})
4852
FIRSTSUBDIR(SUBDIRQT "C:/Qt")
49-
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${SUBDIRQT}/msvc2019_64")
53+
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${SUBDIRQT}/msvc2019_64")
5054
else()
5155
message(STATUS "Qt5_BASE_DIR: $ENV{Qt5_BASE_DIR}")
5256
message(STATUS "Add Qt5_BASE_DIR: $ENV{Qt5_BASE_DIR} to CMAKE_PREFIX_PATH")
53-
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "$ENV{Qt5_BASE_DIR}")
57+
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "$ENV{Qt5_BASE_DIR}")
5458
endif()
5559

5660
if (NOT DEFINED ENV{Qt5_DIR})
5761
if (NOT DEFINED ENV{Qt5_BASE_DIR})
58-
SET (qt_module_path "${SUBDIRQT}/msvc2019_64/lib/cmake/Qt5")
62+
set(qt_module_path "${SUBDIRQT}/msvc2019_64/lib/cmake/Qt5")
5963
else ()
60-
SET (qt_module_path "$ENV{Qt5_BASE_DIR}/lib/cmake/Qt5")
64+
set(qt_module_path "$ENV{Qt5_BASE_DIR}/lib/cmake/Qt5")
6165
endif()
6266
else()
63-
SET (qt_module_path "$ENV{Qt5_DIR}")
67+
file(TO_CMAKE_PATH $ENV{Qt5_DIR} Qt5_DIR)
68+
set(qt_module_path ${Qt5_DIR})
6469
endif()
6570

6671
message(STATUS "Add ${qt_module_path} to CMAKE_MODULE_PATH")
6772
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${qt_module_path}")
6873
endif()
6974

70-
set(OBS_SOURCE "" CACHE STRING "Where is the source code of OBS-Studio located")
71-
set(OBS_BUILD "" CACHE STRING "Where is the build directory of OBS-Studio located")
75+
set(OBS_SOURCE "" CACHE PATH "Where is the source code of OBS-Studio located")
76+
set(OBS_BUILD "" CACHE PATH "Where is the build directory of OBS-Studio located")
7277

7378
set(LIBOBS_INCLUDE_DIR "${OBS_SOURCE}/libobs")
7479
set(OBS_FRONTEND_INCLUDE_DIR "${OBS_SOURCE}/UI/obs-frontend-api")
@@ -84,6 +89,8 @@ include(cmake/FindLibObs.cmake)
8489
find_package(LibObs REQUIRED)
8590
find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED)
8691

92+
option(GLOBAL_INSTALLATION "Whether to install for all users (default: OFF)" OFF)
93+
8794
if (NOT CMAKE_BUILD_TYPE)
8895
set(CMAKE_BUILD_TYPE Release)
8996
endif()
@@ -96,6 +103,10 @@ if (UNIX)
96103
endif()
97104
endif()
98105

106+
if (WIN32)
107+
configure_file(package/Windows.iss.in ${CMAKE_BINARY_DIR}/Windows.iss)
108+
endif()
109+
99110
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared flatbuffers library")
100111
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Build Flatbuffers with tests")
101112
add_subdirectory(external/flatbuffers)
@@ -166,6 +177,14 @@ target_link_libraries(${PROJECT_NAME}
166177
if (UNIX)
167178
include(GNUInstallDirs)
168179
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
169-
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/obs-plugins)
170-
install(DIRECTORY locale/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/hyperion-obs/locale)
180+
181+
if (GLOBAL_INSTALLATION)
182+
# For *.deb installer or install for all user
183+
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/obs-plugins)
184+
install(DIRECTORY locale/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/${PROJECT_NAME}/locale)
185+
else()
186+
# Installs into home directory
187+
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION "$ENV{HOME}/.config/obs-studio/plugins/${PROJECT_NAME}/bin/64bit")
188+
install(DIRECTORY locale/ DESTINATION "$ENV{HOME}/.config/obs-studio/plugins/${PROJECT_NAME}/data/locale")
189+
endif()
171190
endif()

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# hyperion-obs
22

3+
[![Latest-Release](https://img.shields.io/github/v/release/hyperion-project/hyperion-obs-plugin)](https://github.com/hyperion-project/hyperion-obs-plugin/releases)
4+
[![GitHub Actions](https://github.com/hyperion-project/hyperion-obs-plugin/workflows/hyperion-obs/badge.svg?branch=main)](https://github.com/hyperion-project/hyperion-obs-plugin/actions)
5+
36
An [OBS Studio][obs] plugin that provides output capabilities to a
47
[Hyperion.ng][hyperion] Server.
58

6-
The idea for this plugin originated from a fork of [Murat Seker][m-seker].
7-
8-
[obs]: https://obsproject.com/
9-
[hyperion]: https://github.com/hyperion-project/hyperion.ng
10-
[m-seker]: https://github.com/m-seker/hyperion.ng/tree/feature/obs
9+
The idea for this plugin originated from a [Hyperion.ng][hyperion] fork of [Murat Seker][m-seker].
1110

1211
## Usage with hyperion-obs
1312

@@ -17,8 +16,23 @@ The idea for this plugin originated from a fork of [Murat Seker][m-seker].
1716

1817
![hyperion-obs](screenshot/hyperion-obs.png)
1918

19+
## Download
20+
21+
See [Release Page](https://github.com/hyperion-project/hyperion-obs-plugin/releases)
22+
2023
## Build
24+
### Windows
25+
First follow the build guide for [OBS Studio][obs_build].
26+
- Add the following entries before the first configuration:
2127

28+
| Entry name | Type | Value (e.g.) |
29+
|--------------------|----------|-------------------------|
30+
| OBS_SOURCE | PATH | /obs-studio |
31+
| OBS_BUILD | PATH | /obs-studio/build |
32+
33+
- This should cause the plugin DLL file to be created in the desired development environment.
34+
35+
### Linux
2236
- Install QT and libobs
2337

2438
```
@@ -37,7 +51,12 @@ git clone --recursive https://github.com/obsproject/obs-studio.git
3751
git clone --recursive https://github.com/hyperion-project/hyperion-obs-plugin.git
3852
cd hyperion-obs-plugin
3953
mkdir build && cd build
40-
cmake -DOBS_SOURCE="PATH_TO_THE_OBS_SOURCE_CODE_DIRECTORY -DCMAKE_INSTALL_PREFIX=/usr ..
54+
cmake -DOBS_SOURCE=../../obs-studio -DCMAKE_INSTALL_PREFIX=/usr ..
4155
make -j $(nproc)
4256
sudo make install
4357
```
58+
59+
[obs]: https://obsproject.com/
60+
[obs_build]: https://github.com/obsproject/obs-studio/wiki/install-instructions#windows-build-directions
61+
[hyperion]: https://github.com/hyperion-project/hyperion.ng
62+
[m-seker]: https://github.com/m-seker/hyperion.ng/tree/feature/obs

0 commit comments

Comments
 (0)