obs-studio/.github/workflows/main.yml
Ryan Foster d954abedf8 CI: Differentiate Linux CI artifact names
Use the entries in the matrix.ubuntu property to differentiate the
Linux CI artifacts. This allows us to have separate artifacts for each
job configuration created by the matrix.
2022-03-21 14:54:39 -04:00

483 lines
18 KiB
YAML

name: 'BUILD'
on:
push:
paths-ignore: ['**.md']
branches:
- master
- 'release/**'
tags: ['*']
pull_request:
paths-ignore: ['**.md']
branches: [master]
env:
CACHE_REVISION: '004'
CEF_BUILD_VERSION_MAC: '4638'
CEF_HASH_MAC_X86_64: '2fe4cc39b1373b85086e4030dedd2a250d5dbbed8c2f8780002d6cd6214b6bc2'
CEF_HASH_MAC_ARM64: '27809aac427b9c97b0dadcab04371c5f8211f36c6f3e1caa00822de89c5ed249'
CEF_BUILD_VERSION_LINUX: '4638'
CEF_BUILD_VERSION_WIN: '4638'
QT_VERSION_MAC: '5.15.2'
QT_HASH_MAC_X86_64: '35a58fee8dfd70d3d2dcc0ae0b77132c04a451c6f041a02dc41b207b375fc74b'
QT_HASH_MAC_ARM64: 'e99146b9c7775c245a2d22f2ef24fc111fccd71bad0f03b64db707124ffb8707'
QT_VERSION_WIN: '5.15.2'
DEPS_VERSION_MAC: '2022-02-13'
DEPS_HASH_MAC_X86_64: '1a8715d66e664b857942deaded0dc46c4f6cd22e88f01ed1188f3bd3fcf632c4'
DEPS_HASH_MAC_ARM64: '2cfcaf05765400c696908f242aea87b6e1848e1a48cd3edc2eb7f8cb249c9d48'
DEPS_VERSION_WIN: '2022-03-16'
VLC_VERSION_MAC: '3.0.8'
VLC_HASH_MAC: 'e0149ef4a20a19b9ecd87309c2d27787ee3f47dfd47c6639644bc1f6fd95bdf6'
VLC_VERSION_WIN: '3.0.0-git'
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:
clang_check:
name: '01 - Code Format Check'
runs-on: [ubuntu-latest]
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: 'Install clang-format'
run: sudo apt-get install -y clang-format-12
- name: 'Run clang-format'
run: |
./CI/check-format.sh
./CI/check-changes.sh
- name: 'Install cmake-format'
run: sudo pip install cmakelang
- name: 'Run cmake-format'
run: |
./CI/check-cmake.sh
macos_build:
name: '02 - macOS'
runs-on: [macos-11]
strategy:
matrix:
arch: ['x86_64', 'arm64']
if: always()
needs: [clang_check]
env:
MACOSX_DEPLOYMENT_TARGET_X86_64: '10.13'
MACOSX_DEPLOYMENT_TARGET_ARM64: '11.0'
SPARKLE_VERSION: '1.26.0'
SPARKLE_HASH: '8312cbf7528297a49f1b97692c33cb8d33254c396dc51be394e9484e4b6833a0'
BLOCKED_FORMULAS: 'speexdsp curl php composer'
CODESIGN_IDENT: '-'
HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY != '' && secrets.MACOS_SIGNING_CERT != '' }}
defaults:
run:
shell: bash
working-directory: 'obs-studio'
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
submodules: 'recursive'
path: 'obs-studio'
fetch-depth: 0
- name: 'Check for Github Labels'
if: github.event_name == 'pull_request'
run: |
if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
else
echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
fi
echo "CACHE_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
- name: 'Restore ccache from cache'
id: ccache-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'ccache-cache'
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.arch }}-${{ env.CACHE_DATE }}
- name: 'Restore Chromium Embedded Framework from cache'
id: cef-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'cef-cache'
with:
path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_MAC }}_macos_${{ matrix.arch }}
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_MAC }}-${{ matrix.arch }}-${{ env.CACHE_REVISION }}
- name: 'Restore VLC dependency from cache'
id: vlc-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'vlc-cache'
with:
path: ${{ github.workspace }}/obs-build-dependencies/vlc-${{ env.VLC_VERSION_MAC }}
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_MAC }}-${{ env.CACHE_REVISION }}
- name: 'Restore Sparkle dependency from cache'
id: sparkle-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'sparkle-cache'
with:
path: ${{ github.workspace }}/obs-build-dependencies/obs-deps/lib/Sparkle.framework
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.SPARKLE_VERSION }}-${{ env.CACHE_REVISION }}
- name: 'Setup build environment'
run: |
REMOVE_FORMULAS=""
for FORMULA in ${{ env.BLOCKED_FORMULAS }}; do
if [ -d "/usr/local/opt/${FORMULA}" ]; then
REMOVE_FORMULAS="${REMOVE_FORMULAS}${FORMULA} "
fi
done
if [ -n "${REMOVE_FORMULAS}" ]; then
brew uninstall ${REMOVE_FORMULAS}
fi
- name: 'Install dependencies'
env:
RESTORED_VLC: ${{ steps.vlc-cache.outputs.cache-hit }}
RESTORED_SPARKLE: ${{ steps.sparkle-cache.outputs.cache-hit }}
RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
run: CI/macos/01_install_dependencies.sh --architecture "${{ matrix.arch }}"
- name: 'Install Apple Developer Certificate'
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && env.HAVE_CODESIGN_IDENTITY == 'true' }}
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
with:
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' && env.HAVE_CODESIGN_IDENTITY == 'true' }}
run: |
echo "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_IDENTITY }}" >> $GITHUB_ENV
echo "BUILD_FOR_DISTRIBUTION=ON" >> $GITHUB_ENV
- name: 'Build OBS'
run: CI/macos/02_build_obs.sh --codesign --architecture "${{ matrix.arch }}"
- name: 'Run tests'
if: ${{ success() && matrix.arch == 'x86_64' }}
run: cmake --build build -t test
- name: 'Create build artifact'
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
run: |
CI/macos/03_package_obs.sh --codesign --architecture "${{ matrix.arch }}"
ARTIFACT_NAME=$(basename $(/usr/bin/find build -type f -name "obs-studio-*.dmg" -depth 1 | head -1))
echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
- name: 'Upload build Artifact'
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
uses: actions/upload-artifact@v3
with:
name: 'obs-macos-${{ matrix.arch }}'
path: '${{ github.workspace }}/obs-studio/build/${{ env.FILE_NAME }}'
linux_build:
name: '02 - Linux'
runs-on: ${{ matrix.ubuntu }}
strategy:
matrix:
ubuntu: ['ubuntu-20.04', 'ubuntu-18.04']
if: always()
needs: [clang_check]
defaults:
run:
shell: bash
working-directory: 'obs-studio'
env:
BUILD_FOR_DISTRIBUTION: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
submodules: 'recursive'
path: 'obs-studio'
fetch-depth: 0
- name: 'Check for Github Labels'
if: github.event_name == 'pull_request'
run: |
if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
else
echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
fi
echo "CACHE_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
- name: 'Restore ccache from cache'
id: ccache-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'ccache-cache'
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.ubuntu }}-${{ env.CACHE_DATE }}
- name: 'Restore Chromium Embedded Framework from cache'
id: cef-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'cef-cache'
with:
path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_LINUX }}_linux64
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_LINUX }}-${{ env.CACHE_REVISION }}
- name: 'Install dependencies'
env:
RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
run: CI/linux/01_install_dependencies.sh --disable-pipewire
- name: 'Build OBS'
run: CI/linux/02_build_obs.sh --disable-pipewire
- name: 'Run tests'
if: success()
run: cmake --build build -t test
- name: 'Create build artifact'
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
run: |
CI/linux/03_package_obs.sh
ARTIFACT_NAME=$(basename $(/usr/bin/find build -maxdepth 1 -type f -name "obs-studio-*.deb" | sort -rn | head -1))
echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
- name: 'Upload build Artifact'
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
uses: actions/upload-artifact@v3
with:
name: 'obs-linux-${{ matrix.ubuntu }}-deb'
path: '${{ github.workspace }}/obs-studio/build/${{ env.FILE_NAME }}'
windows_build:
name: '02 - Windows'
runs-on: [windows-2019]
needs: [clang_check]
if: always()
strategy:
matrix:
arch: [64, 32]
env:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_SYSTEM_VERSION: '10.0.18363.657'
VIRTUALCAM-GUID: 'A3FCE0F5-3493-419F-958A-ABA1250EC20B'
BUILD_FOR_DISTRIBUTION: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
defaults:
run:
working-directory: 'obs-studio'
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
submodules: 'recursive'
path: 'obs-studio'
fetch-depth: 0
- name: 'Add msbuild to PATH'
uses: microsoft/setup-msbuild@v1.1
- name: 'Check for Github Labels'
if: github.event_name == 'pull_request'
run: |
$LabelFound = try { (Invoke-RestMethod -Authentication 'Bearer' -Token (ConvertTo-SecureString '${{ secrets.GITHUB_TOKEN }}' -AsPlainText) -Uri "${{ github.event.pull_request.url }}" -UseBasicParsing).labels.name.contains("Seeking Testers") } catch { $false }
Write-Output "SEEKING_TESTERS=$(if( $LabelFound -eq $true ) { 1 } else { 0 })" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: 'Restore VLC dependency from cache'
id: vlc-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'vlc-cache'
with:
path: ${{ github.workspace }}/obs-build-dependencies/vlc-${{ env.VLC_VERSION_WIN }}
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.VLC_VERSION_WIN }}-${{ env.CACHE_REVISION }}
- name: 'Restore Chromium Embedded Framework from cache'
id: cef-cache
uses: actions/cache@v2.1.7
env:
CACHE_NAME: 'cef-cache'
with:
path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_WIN }}_windows${{ matrix.arch }}_minimal
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_WIN }}-${{ env.CACHE_REVISION }}
- name: 'Install dependencies'
env:
RESTORED_VLC: ${{ steps.vlc-cache.outputs.cache-hit }}
RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
run: CI/windows/01_install_dependencies.ps1 -BuildArch ${{ matrix.arch }}-bit
- name: 'Build OBS'
run: CI/windows/02_build_obs.ps1 -BuildArch ${{ matrix.arch }}-bit
- name: 'Create build artifact'
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
run: |
CI/windows/03_package_obs.ps1 -BuildArch ${{ matrix.arch }}-bit -Package
$ArtifactName = Get-ChildItem -filter "OBS-Studio-*-Win${{ matrix.arch }}.zip" -File
Write-Output "FILE_NAME=${ArtifactName}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: 'Upload build artifact'
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
uses: actions/upload-artifact@v3
with:
name: 'obs-win${{ matrix.arch }}'
path: '${{ env.FILE_NAME }}'
linux_package:
name: '02 - Flatpak Bundle'
runs-on: [ubuntu-latest]
needs: [clang_check]
if: always()
defaults:
run:
shell: bash
container:
image: bilelmoussaoui/flatpak-github-actions:kde-5.15-21.08
options: --privileged
steps:
- name: 'Check for Github Labels'
if: github.event_name == 'pull_request'
run: |
if ! /usr/bin/command -v "jq" >/dev/null 2>&1; then sudo dnf install -y -q jq; fi
if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
else
echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
fi
- name: 'Checkout'
uses: actions/checkout@v3
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
with:
submodules: 'recursive'
fetch-depth: 0
- name: 'Setup build environment'
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
run: |
echo "OBS_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
echo "OBS_GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "OBS_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build Flatpak Manifest
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
with:
bundle: obs-studio-flatpak-${{ github.sha }}.flatpak
manifest-path: CI/flatpak/com.obsproject.Studio.json
cache-key: flatpak-builder-${{ github.sha }}
windows_package:
name: '03 - Windows Installer'
runs-on: [windows-latest]
needs: [windows_build]
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
env:
BUILD_FOR_DISTRIBUTION: 'ON'
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- name: 'Add msbuild to PATH'
uses: microsoft/setup-msbuild@v1.1
- name: 'Download 64-bit artifact'
uses: actions/download-artifact@v3
with:
name: 'obs-win64'
- name: 'Download 32-bit artifact'
uses: actions/download-artifact@v3
with:
name: 'obs-win32'
- name: 'Unpack Windows build artifacts'
run: |
if (!(Test-Path install_temp)) {
$null = New-Item -ItemType Directory -Force -Path install_temp
}
Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win32.zip" -File)" -DestinationPath install_temp
Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win64.zip" -File)" -Force -DestinationPath install_temp
CI/windows/03_package_obs.ps1 -CombinedArchs -Package
$ArtifactName = (Get-ChildItem -filter "OBS-Studio-*-Windows.zip" -File).Name
Write-Output "FILE_NAME=${ArtifactName}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: 'Upload build artifact'
uses: actions/upload-artifact@v3
with:
name: 'obs-windows'
path: '${{ env.FILE_NAME }}'
macos_release:
name: '03 - macOS notarized image'
runs-on: [macos-11]
needs: [macos_build]
env:
HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY != '' && secrets.MACOS_SIGNING_CERT != '' }}
BUILD_FOR_DISTRIBUTION: 'ON'
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' }}
strategy:
matrix:
arch: ['x86_64', 'arm64']
defaults:
run:
shell: bash
steps:
- name: 'Checkout'
if: env.HAVE_CODESIGN_IDENTITY == 'true'
uses: actions/checkout@v3
- name: 'Download artifact'
if: env.HAVE_CODESIGN_IDENTITY == 'true'
uses: actions/download-artifact@v3
with:
name: 'obs-macos-${{ matrix.arch }}'
- name: 'Install Apple Developer Certificate'
if: env.HAVE_CODESIGN_IDENTITY == 'true'
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
with:
p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
- name: 'Create disk image for distribution'
if: env.HAVE_CODESIGN_IDENTITY == 'true'
env:
CODESIGN_IDENT: ${{ secrets.MACOS_SIGNING_IDENTITY }}
CODESIGN_IDENT_USER: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
CODESIGN_IDENT_PASS: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
run: |
ARTIFACT_NAME=$(/usr/bin/find . -type f -name "obs-studio-*.dmg" -depth 1 | head -1)
CI/macos/03_package_obs.sh --notarize-image ${ARTIFACT_NAME}
echo "FILE_NAME=$(basename ${ARTIFACT_NAME})" >> $GITHUB_ENV
- name: 'Upload build Artifact'
if: env.HAVE_CODESIGN_IDENTITY == 'true'
uses: actions/upload-artifact@v3
with:
name: 'obs-macos-${{ matrix.arch }}-notarized'
path: '${{ github.workspace }}/${{ env.FILE_NAME }}'