Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI workflow #84

Merged
merged 11 commits into from
Jul 15, 2024
14 changes: 8 additions & 6 deletions .github/containers/fedora-common/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ docker_image="$1"
rpmbuild="$2"

PLUGIN_NAME=$(awk '/^project\(/{print gensub(/project\(([^ ()]*).*/, "\\1", 1, $0)}' CMakeLists.txt)
PLUGIN_NAME_FEDORA="$(sed -e 's/^obs-/obs-studio-plugin-/' <<< "$PLUGIN_NAME")"
OBS_VERSION=$(docker run $docker_image bash -c 'rpm -q --qf "%{version}" obs-studio')
eval $(git describe --tag --always --long | awk '
BEGIN {
Expand Down Expand Up @@ -33,17 +34,18 @@ test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled && chcon -Rt contai
# Prepare files
sed \
-e "s/@PLUGIN_NAME@/$PLUGIN_NAME/g" \
-e "s/@PLUGIN_NAME_FEDORA@/$PLUGIN_NAME_FEDORA/g" \
-e "s/@VERSION@/$VERSION/g" \
-e "s/@RELEASE@/$RELEASE/g" \
-e "s/@OBS_VERSION@/$OBS_VERSION/g" \
< ci/plugin.spec \
> $rpmbuild/SPECS/$PLUGIN_NAME.spec
> $rpmbuild/SPECS/$PLUGIN_NAME_FEDORA.spec

git archive --format=tar --prefix=$PLUGIN_NAME-$VERSION/ HEAD | bzip2 > $rpmbuild/SOURCES/$PLUGIN_NAME-$VERSION.tar.bz2
git archive --format=tar --prefix=$PLUGIN_NAME_FEDORA-$VERSION/ HEAD | bzip2 > $rpmbuild/SOURCES/$PLUGIN_NAME_FEDORA-$VERSION.tar.bz2

docker run -v $rpmbuild:/home/rpm/rpmbuild $docker_image bash -c "
sudo dnf builddep -y ~/rpmbuild/SPECS/$PLUGIN_NAME.spec &&
sudo chown 0.0 ~/rpmbuild/SOURCES/* &&
sudo chown 0.0 ~/rpmbuild/SPECS/* &&
rpmbuild -ba ~/rpmbuild/SPECS/$PLUGIN_NAME.spec
sudo dnf builddep -y ~/rpmbuild/SPECS/$PLUGIN_NAME_FEDORA.spec &&
sudo chown 0:0 ~/rpmbuild/SOURCES/* &&
sudo chown 0:0 ~/rpmbuild/SPECS/* &&
rpmbuild -ba ~/rpmbuild/SPECS/$PLUGIN_NAME_FEDORA.spec
"
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
FROM fedora:36
FROM fedora:%releasever%

RUN dnf install -y rpm-build python3-dnf-plugins-core && dnf clean all

# https://docs.fedoraproject.org/en-US/quick-docs/setup_rpmfusion/
RUN dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm && dnf clean all
RUN dnf install -y obs-studio obs-studio-devel && dnf clean all
RUN dnf install -y qt5-qtbase-devel qt5-qtbase-private-devel && dnf clean all

Expand Down
4 changes: 4 additions & 0 deletions .github/containers/fedora-template/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
set -ex
.github/containers/fedora-common/build.sh obs-plugin-build/fedora%releasever% fedora%releasever%-rpmbuild
echo 'FILE_NAME=fedora%releasever%-rpmbuild/*RPMS/**/*.rpm' >> $GITHUB_ENV
4 changes: 0 additions & 4 deletions .github/containers/fedora36/build.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/containers/fedora37/Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions .github/containers/fedora37/build.sh

This file was deleted.

10 changes: 8 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
fail-fast: false
matrix:
target:
- fedora36
- fedora37
- fedora39
- fedora40
defaults:
run:
shell: bash
Expand All @@ -39,6 +39,12 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Generate container directory
run: |
cp -a .github/containers/fedora-template .github/containers/$target
releasever="$(cut -b 7- <<< "$target")"
sed -i "s/%releasever%/$releasever/g" .github/containers/$target/*

- name: Restore docker from cache
id: docker-cache
uses: actions/cache/restore@v4
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
path: '${{ env.FILE_NAME }}'
- name: Check package
run: |
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
set -ex
sudo apt install '${{ env.FILE_NAME }}'
case ${{ matrix.obs }} in
Expand All @@ -93,7 +93,7 @@ jobs:
ls /usr/share/obs/obs-plugins/${PLUGIN_NAME}/

macos_build:
runs-on: macos-12
runs-on: macos-14
strategy:
fail-fast: false
matrix:
Expand All @@ -119,15 +119,15 @@ jobs:
if [[ '${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' != '' && \
'${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}' != '' && \
'${{ secrets.MACOS_SIGNING_CERT }}' != '' ]]; then
echo '::set-output name=haveCodesignIdent::true'
echo "haveCodesignIdent=true" >> $GITHUB_OUTPUT
else
echo '::set-output name=haveCodesignIdent::false'
echo "haveCodesignIdent=false" >> $GITHUB_OUTPUT
fi
if [[ '${{ secrets.MACOS_NOTARIZATION_USERNAME }}' != '' && \
'${{ secrets.MACOS_NOTARIZATION_PASSWORD }}' != '' ]]; then
echo '::set-output name=haveNotarizationUser::true'
echo "haveNotarizationUser=true" >> $GITHUB_OUTPUT
else
echo '::set-output name=haveNotarizationUser::false'
echo "haveNotarizationUser=false" >> $GITHUB_OUTPUT
fi
echo '::endgroup::'

Expand All @@ -140,7 +140,7 @@ jobs:
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' }}
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/')
Expand Down Expand Up @@ -188,12 +188,11 @@ jobs:
-D PKG_SUFFIX=$PKG_SUFFIX \
"${cmake_opt[@]}"
cmake --build build --config RelWithDebInfo
echo "PKG_SUFFIX='$PKG_SUFFIX'" >> ci/ci_includes.generated.sh

- name: Prepare package
run: |
set -ex
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
cmake --install build --config RelWithDebInfo --prefix=release
case ${{ matrix.obs }} in
27)
Expand All @@ -209,8 +208,8 @@ jobs:
- name: Codesign
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
. ci/ci_includes.generated.sh
set -e
. build/ci/ci_includes.generated.sh
set -ex
case ${{ matrix.obs }} in
27)
files=(
Expand All @@ -234,7 +233,7 @@ jobs:

- name: Package
run: |
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
set -ex
zipfile=$PWD/package/${PLUGIN_NAME}${PKG_SUFFIX}.zip
mkdir package
Expand All @@ -250,10 +249,10 @@ jobs:
- name: Productsign
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
. ci/ci_includes.generated.sh
. build/ci/ci_includes.generated.sh
pkgfile=package/${PLUGIN_NAME}${PKG_SUFFIX}.pkg
set -e
. ci/ci_includes.generated.sh
. 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

Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
/build32/
/build64/
/release/
/installer/Output/

.vscode
.idea

# ignore generated files
*.generated.*
79 changes: 45 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,17 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(libobs REQUIRED)
find_package(obs-frontend-api REQUIRED)
include(cmake/ObsPluginHelpers.cmake)
find_qt(VERSION ${QT_VERSION} COMPONENTS Widgets Core Gui)

configure_file(
src/plugin-macros.h.in
../src/plugin-macros.generated.h
)
configure_file(
installer/installer-Windows.iss.in
../installer/installer-Windows.generated.iss
)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
find_package(libobs REQUIRED)
find_package(obs-frontend-api REQUIRED)
include(cmake/ObsPluginHelpers.cmake)
add_library(OBS::frontend-api ALIAS OBS::obs-frontend-api)
find_qt(VERSION ${QT_VERSION} COMPONENTS Widgets Core Gui)
endif()

configure_file(
ci/ci_includes.sh.in
../ci/ci_includes.generated.sh
)
configure_file(
ci/ci_includes.cmd.in
../ci/ci_includes.generated.cmd
src/plugin-macros.h.in
plugin-macros.generated.h
)

set(PLUGIN_SOURCES
Expand Down Expand Up @@ -73,33 +63,35 @@ set(PLUGIN_SOURCES
src-obsstudio/qt-wrappers.cpp
)

add_library(${CMAKE_PROJECT_NAME} MODULE ${PLUGIN_SOURCES})
add_library(${PROJECT_NAME} MODULE ${PLUGIN_SOURCES})

include_directories(
src-obsstudio/
)

target_link_libraries(${CMAKE_PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
OBS::libobs
OBS::obs-frontend-api
OBS::frontend-api
Qt::Core
Qt::Widgets
Qt::Gui
Qt::GuiPrivate
)

target_include_directories(${PROJECT_NAME}
PRIVATE
src-obsstudio/
${CMAKE_CURRENT_BINARY_DIR}
)

if(OS_WINDOWS)
# Enable Multicore Builds and disable FH4 (to not depend on VCRUNTIME140_1.DLL when building with VS2019)
if (MSVC)
add_definitions(/MP /d2FH4-)
endif()

target_link_libraries(${CMAKE_PROJECT_NAME} OBS::w32-pthreads)
target_link_libraries(${PROJECT_NAME} OBS::w32-pthreads)
endif()

if(OS_LINUX)
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Wextra)
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE -Wl,-z,defs)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
target_link_options(${PROJECT_NAME} PRIVATE -Wl,-z,defs)
if(ENABLE_COVERAGE)
target_compile_options(${PROJECT_NAME} PRIVATE -coverage)
target_link_options(${PROJECT_NAME} PRIVATE -coverage)
Expand All @@ -109,12 +101,31 @@ endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fvisibility=default")

set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "")
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set(MACOSX_PLUGIN_GUI_IDENTIFIER "${MACOS_BUNDLEID}")
set(MACOSX_PLUGIN_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION}")
set(MACOSX_PLUGIN_BUNDLE_VERSION "${PROJECT_VERSION}")
set(MACOSX_PLUGIN_SHORT_VERSION_STRING "1")
endif()

setup_plugin_target(${CMAKE_PROJECT_NAME})

configure_file(installer/installer-macOS.pkgproj.in installer-macOS.generated.pkgproj)
setup_plugin_target(${PROJECT_NAME})

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
configure_file(
installer/installer-Windows.iss.in
installer-Windows.generated.iss
)

configure_file(
ci/ci_includes.sh.in
ci/ci_includes.generated.sh
)
configure_file(
ci/ci_includes.cmd.in
ci/ci_includes.generated.cmd
)

configure_file(
installer/installer-macOS.pkgproj.in
installer-macOS.generated.pkgproj
)
endif()
4 changes: 2 additions & 2 deletions ci/ci_includes.cmd.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set PluginName=@CMAKE_PROJECT_NAME@
set PluginVersion=@CMAKE_PROJECT_VERSION@
set PluginName=@PROJECT_NAME@
set PluginVersion=@PROJECT_VERSION@
7 changes: 5 additions & 2 deletions ci/ci_includes.sh.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
PLUGIN_NAME="@CMAKE_PROJECT_NAME@"
PLUGIN_VERSION="@CMAKE_PROJECT_VERSION@"
PLUGIN_NAME="@PROJECT_NAME@"
PLUGIN_VERSION="@PROJECT_VERSION@"
MACOS_BUNDLEID="@MACOS_BUNDLEID@"
LINUX_MAINTAINER_EMAIL="@LINUX_MAINTAINER_EMAIL@"
PKG_SUFFIX='@PKG_SUFFIX@'
4 changes: 0 additions & 4 deletions ci/macos/Brewfile

This file was deleted.

38 changes: 0 additions & 38 deletions ci/macos/download-extract.sh

This file was deleted.

Loading
Loading