Skip to content

Instantly share code, notes, and snippets.

@Sg4Dylan
Created January 28, 2022 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sg4Dylan/ef52532651e418031088002de97ae69d to your computer and use it in GitHub Desktop.
Save Sg4Dylan/ef52532651e418031088002de97ae69d to your computer and use it in GitHub Desktop.
GitHub action workflow for building OBS plugin obs-libfdk on win64 platform
name: 'CI Build'
on:
push:
paths-ignore:
- '**.md'
branches:
- master
- 'release/**'
tags:
- '*'
env:
REPO_URL: https://github.com/obsproject/obs-studio/
REPO_TAG: 27.1.3
MACOS_CEF_BUILD_VERSION: '4638'
LINUX_CEF_BUILD_VERSION: '4638'
WINDOWS_CEF_BUILD_VERSION: '4638'
TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
RESTREAM_CLIENTID: ${{ secrets.RESTREAM_CLIENTID }}
RESTREAM_HASH: ${{ secrets.RESTREAM_HASH }}
YOUTUBE_CLIENTID: ${{ secrets.YOUTUBE_CLIENTID }}
YOUTUBE_CLIENTID_HASH: ${{ secrets.YOUTUBE_CLIENTID_HASH }}
YOUTUBE_SECRET: ${{ secrets.YOUTUBE_SECRET }}
YOUTUBE_SECRET_HASH: ${{ secrets.YOUTUBE_SECRET_HASH }}
jobs:
win64:
name: 'Windows 64-bit'
runs-on: [windows-latest]
env:
QT_VERSION: '5.15.2'
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
WINDOWS_DEPS_VERSION: '2022-01-01'
WINDOWS_DEPS_CACHE_VERSION: '1'
VLC_VERSION: '3.0.0-git'
VIRTUALCAM-GUID: "A3FCE0F5-3493-419F-958A-ABA1250EC20B"
steps:
- name: 'Add msbuild to PATH'
uses: microsoft/setup-msbuild@v1.0.2
- name: 'Checkout'
run: |
git clone --recurse-submodules --branch ${{ env.REPO_TAG }} --depth 1 ${{ env.REPO_URL }}
- name: 'Restore QT dependency from cache'
id: qt-cache
uses: actions/cache@v2.1.2
env:
CACHE_NAME: 'windows-qt-cache'
with:
path: ${{ github.workspace }}/obs-studio/cmbuild/QT
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.QT_VERSION }}
- name: 'Restore pre-built dependencies from cache'
id: deps-cache
uses: actions/cache@v2.1.2
env:
CACHE_NAME: 'windows-deps-cache'
with:
path: ${{ github.workspace }}/obs-studio/cmbuild/deps
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.WINDOWS_DEPS_VERSION }}-${{ env.WINDOWS_DEPS_CACHE_VERSION }}
- name: 'Restore VLC dependency from cache'
id: vlc-cache
uses: actions/cache@v2.1.2
env:
CACHE_NAME: 'windows-vlc-cache'
with:
path: ${{ github.workspace }}/obs-studio/cmbuild/vlc
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION }}
- name: 'Install prerequisite: QT'
if: steps.qt-cache.outputs.cache-hit != 'true'
run: |
curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_${{ env.QT_VERSION }}.7z -f --retry 5 -C -
7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}/obs-studio/cmbuild/QT"
- name: 'Install prerequisite: Pre-built dependencies'
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
curl -L -O https://github.com/obsproject/obs-deps/releases/download/win-${{ env.WINDOWS_DEPS_VERSION }}/windows-deps-${{ env.WINDOWS_DEPS_VERSION }}.zip --retry 5 -C -
7z x windows-deps-${{ env.WINDOWS_DEPS_VERSION }}.zip -o"${{ github.workspace }}/obs-studio/cmbuild/deps"
- name: 'Install prerequisite: VLC'
if: steps.vlc-cache.outputs.cache-hit != 'true'
run: |
curl -kL https://cdn-fastly.obsproject.com/downloads/vlc.zip -f --retry 5 -o vlc.zip
7z x vlc.zip -o"${{ github.workspace }}/obs-studio/cmbuild/vlc"
- name: 'Install prerequisite: FDK-AAC'
run: |
cd ./obs-studio/cmbuild/deps/win64/include
git clone --recurse-submodules --branch v2.0.2 --depth 1 https://github.com/mstorsjo/fdk-aac
cd ./fdk-aac
cmake . -B build -DBUILD_PROGRAMS=YES -DBUILD_SHARED_LIBS=YES
cmake --build build --config Release
xcopy .\build\Release\fdk-aac.dll ..\..\bin
xcopy .\build\Release\fdk-aac.lib ..\..\bin
xcopy .\libSYS\include\FDK_audio.h .\
xcopy .\libSYS\include\genericStds.h .\
xcopy .\libSYS\include\machine_type.h .\
xcopy .\libSYS\include\syslib_channelMapDescr.h .\
xcopy .\libAACdec\include\aacdecoder_lib.h .\
xcopy .\libAACenc\include\aacenc_lib.h .\
- name: 'Configure'
run: |
cd ./obs-studio
mkdir ./build
mkdir ./build64
cd ./build64
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"x64" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DCOMPILE_D3D12_HOOK=true -DVLCPath="${{ github.workspace }}/obs-studio/cmbuild/vlc" -DDepsPath="${{ github.workspace }}/obs-studio/cmbuild/deps/win64" -DQTDIR="${{ github.workspace }}/obs-studio/cmbuild/QT/${{ env.QT_VERSION }}/msvc2019_64" -DENABLE_VLC=ON -DDISABLE_LIBFDK=false -DTWITCH_CLIENTID='${{ env.TWITCH_CLIENTID }}' -DTWITCH_HASH='${{ env.TWITCH_HASH }}' -DRESTREAM_CLIENTID='${{ env.RESTREAM_CLIENTID }}' -DRESTREAM_HASH='${{ env.RESTREAM_HASH }}' -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE -DVIRTUALCAM_GUID=${{ env.VIRTUALCAM-GUID }} ..
- name: 'Build'
run: msbuild /m /p:Configuration=RelWithDebInfo .\obs-studio\build64\obs-studio.sln
- name: 'Package'
if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
run: |
$env:FILE_DATE=(Get-Date -UFormat "%F")
$env:FILE_NAME="${env:FILE_DATE}-${{ env.REPO_TAG }}-win64"
echo "FILE_NAME=${env:FILE_NAME}" >> ${env:GITHUB_ENV}
robocopy .\obs-studio\build64\rundir\RelWithDebInfo .\obs-studio\build\ /E /XF .gitignore
7z
- name: 'Publish'
if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
uses: actions/upload-artifact@v2.2.0
with:
name: '${{ env.FILE_NAME }}'
path: obs-studio/build/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment