Skip to content

Update main.yml

Update main.yml #1

Workflow file for this run

# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2019-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
name: Build
on:
workflow_dispatch:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- '*'
concurrency:
group: build-${{ github.ref_name }}
cancel-in-progress: true
env:
CACHE_VERSION: "2022-12-02"
jobs:
windows:
strategy:
fail-fast: false
matrix:
runner: [ "windows-2022" ]
name: [ "Windows" ]
compiler: [ "MSVC"]
qt: [ 6 ]
include:
- compiler: "MSVC"
package_name: "windows"
CMAKE_SYSTEM_VERSION: "10.0.20348.0"
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM: "x64"
runs-on: "${{ matrix.runner }}"
name: "${{ matrix.name }} (${{ matrix.compiler }})"
env:
CMAKE_GENERATOR: "${{ matrix.CMAKE_GENERATOR }}"
CMAKE_GENERATOR_PLATFORM: "${{ matrix.CMAKE_GENERATOR_PLATFORM }}"
CMAKE_GENERATOR_TOOLSET: "${{ matrix.CMAKE_GENERATOR_TOOLSET }}"
CMAKE_SYSTEM_VERSION: "${{ matrix.CMAKE_SYSTEM_VERSION }}"
steps:
- name: "Clone"
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: "Gather Information"
id: info
shell: bash
run: |
# Define buildspec file
buildspec="${{ github.workspace }}/third-party/obs-studio/buildspec.json"
# Prebuilt Dependencies Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "prebuilt" "windows-x64"))
echo "obs_deps_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "obs_deps_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "obs_deps_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# Qt Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "qt${{ matrix.qt }}" "windows-x64"))
echo "qt_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "qt_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "qt_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# libOBS Version
echo "obs_version=$(cd "${{ github.workspace }}/third-party/obs-studio" && git describe --tags --long)" >> "$GITHUB_ENV"
- name: "Dependency: Qt (Cache)"
id: qt-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/qt"
key: "qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Qt"
id: qt
if: ${{ steps.qt-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/qt.zip "${{ env.qt_url }}"
if [[ ! -f "${{ github.workspace }}/build/qt" ]]; then mkdir -p "${{ github.workspace }}/build/qt"; fi
7z x -y -o"${{ github.workspace }}/build/qt" -- "/tmp/qt.zip"
- name: "Dependency: Prebuilt OBS Studio Dependencies (Cache)"
id: obsdeps-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obsdeps"
key: "obsdeps${{ env.obs_deps_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Prebuilt OBS Studio Dependencies"
id: obsdeps
if: ${{ steps.obsdeps-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/obsdeps.zip "${{ env.obs_deps_url }}"
if [[ ! -f "${{ github.workspace }}/build/obsdeps" ]]; then mkdir -p "${{ github.workspace }}/build/obsdeps"; fi
7z x -y -o"${{ github.workspace }}/build/obsdeps" -- "/tmp/obsdeps.zip"
- name: "Dependency: OBS Libraries (Cache)"
id: obs-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obs"
key: "obs${{ env.obs_version }}-${{ matrix.runner }}_${{ matrix.compiler }}-obsdeps${{ env.obs_deps_hash }}-qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: OBS Libraries"
id: obs
if: ${{ steps.obs-cache.outputs.cache-hit != 'true' }}
env:
# obs-studio does not support ClangCL
CMAKE_GENERATOR_TOOLSET: ""
shell: bash
run: |
# Apply patches to obs-studio
pushd "${{ github.workspace }}/third-party/obs-studio" > /dev/null
for f in ../../patches/obs-studio/*.patch; do
echo "Applying patch '${f}''..."
[ -e "$f" ] || continue
git apply "$f"
done
popd > /dev/null
# Build obs-studio
cmake \
-S "${{ github.workspace }}/third-party/obs-studio" \
-B "${{ github.workspace }}/build/obs" \
-DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/obs/install" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/obsdeps;${{ github.workspace }}/build/qt" \
-DENABLE_PLUGINS=OFF \
-DENABLE_UI=OFF \
-DENABLE_SCRIPTING=OFF
cmake \
--build "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--target obs-frontend-api
cmake \
--install "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--component obs_libraries
- name: "Configure"
continue-on-error: true
shell: bash
run: |
cmake \
-S "${{ github.workspace }}" \
-B "${{ github.workspace }}/build/ci" \
-DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/ci/install" \
-DPACKAGE_NAME="streamfx-${{ matrix.package_name }}" \
-DPACKAGE_PREFIX="${{ github.workspace }}/build/package" \
-Dlibobs_DIR="${{ github.workspace }}/build/obs/install" \
-DQt${{ matrix.qt }}_DIR="${{ github.workspace }}/build/qt" \
-DFFmpeg_DIR="${{ github.workspace }}/build/obsdeps" \
-DCURL_DIR="${{ github.workspace }}/build/obsdeps"
- name: "Build: Debug"
continue-on-error: true
shell: bash
env:
CMAKE_BUILD_TYPE: "Debug"
run: |
cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target StreamFX
- name: "Build: Release"
shell: bash
env:
CMAKE_BUILD_TYPE: "RelWithDebInfo"
run: |
cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target install
- name: "Packaging: Install InnoSetup"
if: startsWith( matrix.runner, 'windows' )
run: |
curl "-kL" "https://www.dropbox.com/scl/fi/sda9ecx9qzqiaq8ifryi1/innosetup-6.2.1.exe?rlkey=5jf07t109j34dppvmuen36271&dl=1" "-f" "--retry" "5" "-o" "inno.exe"
.\inno.exe /VERYSILENT /SP- /SUPPRESSMSGBOXES /NORESTART
- name: "Packaging"
shell: cmd
run: |
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 ".\build\ci\installer.iss"
- name: "Artifacts"
uses: actions/upload-artifact@v1
with:
name: "${{ matrix.runner }}-${{ matrix.compiler }}-qt${{ matrix.qt }}"
path: "${{ github.workspace }}/build/package"
macos:
strategy:
fail-fast: false
matrix:
runner: [ "macos-12" ]
compiler: [ "Clang" ]
qt: [ 6 ]
include:
- compiler: "Clang"
name: "MacOS"
package_name: "macos"
CMAKE_GENERATOR: "Xcode"
CMAKE_OSX_DEPLOYMENT_TARGET: "10.15"
CMAKE_OSX_ARCHITECTURES: "x86_64;arm64"
runs-on: "${{ matrix.runner }}"
name: "${{ matrix.name }} (${{ matrix.compiler }})"
env:
CMAKE_GENERATOR: "${{ matrix.CMAKE_GENERATOR }}"
CMAKE_GENERATOR_PLATFORM: "${{ matrix.CMAKE_GENERATOR_PLATFORM }}"
CMAKE_GENERATOR_TOOLSET: "${{ matrix.CMAKE_GENERATOR_TOOLSET }}"
CMAKE_SYSTEM_VERSION: "${{ matrix.CMAKE_SYSTEM_VERSION }}"
CMAKE_OSX_DEPLOYMENT_TARGET: "${{ matrix.CMAKE_OSX_DEPLOYMENT_TARGET }}"
CMAKE_OSX_ARCHITECTURES: "${{ matrix.CMAKE_OSX_ARCHITECTURES }}"
steps:
- name: "Clone"
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: "Gather Information"
id: info
shell: bash
run: |
# Define buildspec file
buildspec="${{ github.workspace }}/third-party/obs-studio/buildspec.json"
# Prebuilt Dependencies Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "prebuilt" "macos-universal"))
echo "obs_deps_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "obs_deps_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "obs_deps_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# Qt Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "qt${{ matrix.qt }}" "macos-universal"))
echo "qt_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "qt_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "qt_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# libOBS Version
echo "obs_version=$(cd "${{ github.workspace }}/third-party/obs-studio" && git describe --tags --long)" >> "$GITHUB_ENV"
- name: "Dependency: Qt (Cache)"
id: qt-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/qt"
key: "qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Qt"
id: qt
if: ${{ steps.qt-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/qt.tar.xz "${{ env.qt_url }}"
if [[ ! -f "${{ github.workspace }}/build/qt" ]]; then mkdir -p "${{ github.workspace }}/build/qt"; fi
tar -xvf "/tmp/qt.tar.xz" -C "${{ github.workspace }}/build/qt"
- name: "Dependency: Prebuilt OBS Studio Dependencies (Cache)"
id: obsdeps-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obsdeps"
key: "obsdeps${{ env.obs_deps_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Prebuilt OBS Studio Dependencies"
id: obsdeps
if: ${{ steps.obsdeps-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/obsdeps.tar.xz "${{ env.obs_deps_url }}"
if [[ ! -f "${{ github.workspace }}/build/obsdeps" ]]; then mkdir -p "${{ github.workspace }}/build/obsdeps"; fi
tar -xvf "/tmp/obsdeps.tar.xz" -C "${{ github.workspace }}/build/obsdeps"
- name: "Dependency: OBS Libraries (Cache)"
id: obs-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obs"
key: "obs${{ env.obs_version }}-${{ matrix.runner }}_${{ matrix.compiler }}--obsdeps${{ env.obs_deps_hash }}-qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: OBS Libraries"
id: obs
if: ${{ steps.obs-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
# Apply patches to obs-studio
pushd "${{ github.workspace }}/third-party/obs-studio" > /dev/null
for f in ../../patches/obs-studio/*.patch; do
echo "Applying patch '${f}''..."
[ -e "$f" ] || continue
git apply "$f"
done
popd > /dev/null
# Build obs-studio
cmake \
-S "${{ github.workspace }}/third-party/obs-studio" \
-B "${{ github.workspace }}/build/obs" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/obs/install" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/obsdeps;${{ github.workspace }}/build/qt" \
-DENABLE_PLUGINS=OFF \
-DENABLE_UI=OFF \
-DENABLE_SCRIPTING=OFF
cmake \
--build "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--target obs-frontend-api
cmake \
--install "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--component obs_libraries
- name: "Configure"
continue-on-error: true
shell: bash
run: |
cmake \
-S "${{ github.workspace }}" \
-B "${{ github.workspace }}/build/ci" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/ci/install" \
-DPACKAGE_NAME="streamfx-${{ matrix.package_name }}" \
-DPACKAGE_PREFIX="${{ github.workspace }}/build/package" \
-Dlibobs_DIR="${{ github.workspace }}/build/obs/install" \
-DQt${{ matrix.qt }}_DIR="${{ github.workspace }}/build/qt" \
-DFFmpeg_DIR="${{ github.workspace }}/build/obsdeps" \
-DCURL_DIR="${{ github.workspace }}/build/obsdeps"
- name: "Build: Debug"
continue-on-error: true
shell: bash
run: |
cmake --build "build/ci" --config Debug --target StreamFX
- name: "Build: Release"
shell: bash
env:
CMAKE_BUILD_TYPE: "RelWithDebInfo"
run: |
cmake --build "build/ci" --config RelWithDebInfo --target install
- name: 'Packaging: Install Packages'
if: startsWith( matrix.runner, 'macos' )
shell: bash
run: |
curl -kL "https://www.dropbox.com/scl/fi/fbal90nds32qx5khn8b0c/Packages-1.2.10.dmg?rlkey=a9xr4md58ro7278ioqd1k52w8&dl=1" -f --retry 5 -o "Packages.dmg"
sudo hdiutil attach ./Packages.dmg
pushd /Volumes/Packages*
sudo installer -pkg ./Install\ Packages.pkg -target /
- name: "Packaging"
shell: bash
run: |
packagesbuild "${{ github.workspace }}/build/ci/installer.pkgproj"
- name: "Artifacts"
uses: actions/upload-artifact@v1
with:
name: "${{ matrix.runner }}-${{ matrix.compiler }}-qt${{ matrix.qt }}"
path: "${{ github.workspace }}/build/package"