mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Update github actions
Based on obs-plugintemplate@68e9fcd
This commit is contained in:
parent
8e7955984e
commit
a4e26a7a51
|
|
@ -26,7 +26,7 @@ runs:
|
|||
|
||||
- name: Restore cached dependencies
|
||||
id: restore-cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.DEP_DIR }}
|
||||
key: ${{ env.DEP_DIR }}-${{ runner.os }}-${{ inputs.target }}
|
||||
|
|
@ -37,12 +37,13 @@ runs:
|
|||
run: |
|
||||
build_args=(
|
||||
-c ${{ inputs.config }}
|
||||
-t macos-${{ inputs.target }}
|
||||
-t ${{ inputs.target }}
|
||||
-o ${{ env.DEP_DIR }}
|
||||
)
|
||||
|
||||
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/build-deps-macos.zsh -o ${{ env.DEP_DIR }} ${build_args}
|
||||
.github/scripts/build-deps-macos.zsh -o ${{ env.DEP_DIR }} ${build_args}
|
||||
|
||||
- name: Run Linux Build
|
||||
if: ${{ runner.os == 'Linux' && steps.restore-cache.outputs.cache-hit != 'true' }}
|
||||
|
|
@ -57,7 +58,7 @@ runs:
|
|||
build_args+=(--debug)
|
||||
fi
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/build-deps-linux.sh -o ${{ env.DEP_DIR }} "${build_args[@]}"
|
||||
.github/scripts/build-deps-linux.sh -o ${{ env.DEP_DIR }} "${build_args[@]}"
|
||||
|
||||
- name: Run Windows Build
|
||||
if: ${{ runner.os == 'Windows' && steps.restore-cache.outputs.cache-hit != 'true' }}
|
||||
|
|
@ -66,7 +67,7 @@ runs:
|
|||
$BuildArgs = @{
|
||||
Target = '${{ inputs.target }}'
|
||||
Configuration = '${{ inputs.config }}'
|
||||
CMakeGenerator = '${{ inputs.visualStudio }}'
|
||||
OutDirName = '${{ env.DEP_DIR }}'
|
||||
}
|
||||
|
||||
if ( ( Test-Path env:CI ) -and ( Test-Path env:RUNNER_DEBUG ) ) {
|
||||
|
|
@ -75,5 +76,5 @@ runs:
|
|||
}
|
||||
}
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/Build-Deps-Windows.ps1 -OutDirName ${{ env.DEP_DIR }} @BuildArgs
|
||||
.github/scripts/Build-Deps-Windows.ps1 -OutDirName ${{ env.DEP_DIR }} @BuildArgs
|
||||
|
||||
110
.github/actions/build-plugin/action.yaml
vendored
Normal file
110
.github/actions/build-plugin/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
name: 'Set up and build plugin'
|
||||
description: 'Builds the plugin for specified architecture and build config'
|
||||
inputs:
|
||||
target:
|
||||
description: 'Target architecture for dependencies'
|
||||
required: true
|
||||
config:
|
||||
description: 'Build configuration'
|
||||
required: false
|
||||
default: 'RelWithDebInfo'
|
||||
codesign:
|
||||
description: 'Enable codesigning (macOS only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
codesignIdent:
|
||||
description: 'Developer ID for application codesigning (macOS only)'
|
||||
required: false
|
||||
default: '-'
|
||||
workingDirectory:
|
||||
description: 'Working directory for packaging'
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run macOS Build
|
||||
if: runner.os == 'macOS'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
env:
|
||||
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
|
||||
CODESIGN_TEAM: ${{ inputs.codesignTeam }}
|
||||
run: |
|
||||
: Run macOS Build
|
||||
|
||||
local -a build_args=(
|
||||
--config ${{ inputs.config }}
|
||||
--dep ${{ env.DEP_DIR }}
|
||||
)
|
||||
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
if [[ '${{ inputs.codesign }}' == 'true' ]] build_args+=(--codesign)
|
||||
|
||||
.github/scripts/build-macos ${build_args}
|
||||
|
||||
- name: Install Dependencies 🛍️
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
: Install Dependencies 🛍️
|
||||
echo ::group::Install Dependencies
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
||||
brew install --quiet zsh
|
||||
echo ::endgroup::
|
||||
|
||||
- name: Run Ubuntu Build
|
||||
if: runner.os == 'Linux'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
run: |
|
||||
: Run Ubuntu Build
|
||||
|
||||
local -a build_args=(
|
||||
--target linux-${{ inputs.target }}
|
||||
--config ${{ inputs.config }}
|
||||
)
|
||||
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
.github/scripts/build-linux ${build_args}
|
||||
|
||||
- name: Run Windows Build
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Run Windows Build
|
||||
if ( $Env:RUNNER_DEBUG -ne $null ) {
|
||||
Set-PSDebug -Trace 1
|
||||
}
|
||||
|
||||
$BuildArgs = @{
|
||||
Target = '${{ inputs.target }}'
|
||||
Configuration = '${{ inputs.config }}'
|
||||
ADVSSDepName = '${{ env.DEP_DIR }}'
|
||||
}
|
||||
|
||||
.github/scripts/Build-Windows.ps1 @BuildArgs
|
||||
|
||||
- name: Create Summary 📊
|
||||
if: contains(fromJSON('["Linux", "macOS"]'),runner.os)
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
env:
|
||||
CCACHE_CONFIGPATH: ${{ inputs.workingDirectory }}/.ccache.conf
|
||||
run: |
|
||||
: Create Summary 📊
|
||||
|
||||
local -a ccache_data
|
||||
if (( ${+RUNNER_DEBUG} )) {
|
||||
setopt XTRACE
|
||||
ccache_data=("${(fA)$(ccache -s -vv)}")
|
||||
} else {
|
||||
ccache_data=("${(fA)$(ccache -s)}")
|
||||
}
|
||||
|
||||
print '### ${{ runner.os }} Ccache Stats (${{ inputs.target }})' >> $GITHUB_STEP_SUMMARY
|
||||
print '```' >> $GITHUB_STEP_SUMMARY
|
||||
for line (${ccache_data}) {
|
||||
print ${line} >> $GITHUB_STEP_SUMMARY
|
||||
}
|
||||
print '```' >> $GITHUB_STEP_SUMMARY
|
||||
89
.github/actions/build-plugin/action.yml
vendored
89
.github/actions/build-plugin/action.yml
vendored
|
|
@ -1,89 +0,0 @@
|
|||
name: 'Setup and build plugin'
|
||||
description: 'Builds the plugin for specified architecture and build config.'
|
||||
inputs:
|
||||
target:
|
||||
description: 'Build target for dependencies'
|
||||
required: true
|
||||
config:
|
||||
description: 'Build configuration'
|
||||
required: false
|
||||
default: 'Release'
|
||||
codesign:
|
||||
description: 'Enable codesigning (macOS only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
codesignIdent:
|
||||
description: 'Developer ID for application codesigning (macOS only)'
|
||||
required: false
|
||||
default: '-'
|
||||
visualStudio:
|
||||
description: 'Visual Studio version (Windows only)'
|
||||
required: false
|
||||
default: 'Visual Studio 16 2019'
|
||||
portable:
|
||||
description: 'Set portable mode (Linux only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
workingDirectory:
|
||||
description: 'Working directory for packaging'
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Setup cmake
|
||||
uses: jwlawson/actions-setup-cmake@v1.13
|
||||
with:
|
||||
cmake-version: '3.24.x'
|
||||
- name: Run macOS Build
|
||||
if: ${{ runner.os == 'macOS' }}
|
||||
shell: zsh {0}
|
||||
env:
|
||||
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
|
||||
run: |
|
||||
build_args=(
|
||||
-c ${{ inputs.config }}
|
||||
-t macos-${{ inputs.target }}
|
||||
)
|
||||
|
||||
if [[ '${{ inputs.codesign }}' == 'true' ]] build_args+=(-s)
|
||||
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/build-macos.zsh -d ${{ env.DEP_DIR }} ${build_args}
|
||||
|
||||
- name: Run Linux Build
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
shell: bash
|
||||
run: |
|
||||
build_args=(
|
||||
-c ${{ inputs.config }}
|
||||
-t linux-${{ inputs.target }}
|
||||
)
|
||||
|
||||
if [[ -n "${CI}" && -n "${RUNNER_DEBUG}" ]]; then
|
||||
build_args+=(--debug)
|
||||
fi
|
||||
|
||||
if [[ '${{ inputs.portable }}' == 'true' ]]; then
|
||||
build_args+=(-p)
|
||||
fi
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/build-linux.sh -d ${{ env.DEP_DIR }} "${build_args[@]}"
|
||||
|
||||
- name: Run Windows Build
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
$BuildArgs = @{
|
||||
Target = '${{ inputs.target }}'
|
||||
Configuration = '${{ inputs.config }}'
|
||||
CMakeGenerator = '${{ inputs.visualStudio }}'
|
||||
}
|
||||
|
||||
if ( ( Test-Path env:CI ) -and ( Test-Path env:RUNNER_DEBUG ) ) {
|
||||
$BuildArgs += @{
|
||||
Debug = $true
|
||||
}
|
||||
}
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/Build-Windows.ps1 -ADVSSDepName ${{ env.DEP_DIR }} @BuildArgs
|
||||
117
.github/actions/package-plugin/action.yaml
vendored
Normal file
117
.github/actions/package-plugin/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
name: 'Package plugin'
|
||||
description: 'Packages the plugin for specified architecture and build config.'
|
||||
inputs:
|
||||
target:
|
||||
description: 'Build target for dependencies'
|
||||
required: true
|
||||
config:
|
||||
description: 'Build configuration'
|
||||
required: false
|
||||
default: 'RelWithDebInfo'
|
||||
codesign:
|
||||
description: 'Enable codesigning (macOS only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
notarize:
|
||||
description: 'Enable notarization (macOS only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
codesignIdent:
|
||||
description: 'Developer ID for application codesigning (macOS only)'
|
||||
required: false
|
||||
default: '-'
|
||||
installerIdent:
|
||||
description: 'Developer ID for installer package codesigning (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
codesignTeam:
|
||||
description: 'Developer team for codesigning (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
codesignUser:
|
||||
description: 'Apple ID username for notarization (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
codesignPass:
|
||||
description: 'Apple ID password for notarization (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
package:
|
||||
description: 'Create Windows or macOS installation package'
|
||||
required: false
|
||||
default: 'true'
|
||||
workingDirectory:
|
||||
description: 'Working directory for packaging'
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run macOS Packaging
|
||||
if: runner.os == 'macOS'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
env:
|
||||
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
|
||||
CODESIGN_IDENT_INSTALLER: ${{ inputs.installerIdent }}
|
||||
CODESIGN_TEAM: ${{ inputs.codesignTeam }}
|
||||
CODESIGN_IDENT_USER: ${{ inputs.codesignUser }}
|
||||
CODESIGN_IDENT_PASS: ${{ inputs.codesignPass }}
|
||||
run: |
|
||||
: Run macOS Packaging
|
||||
|
||||
local -a package_args=(--config ${{ inputs.config }})
|
||||
if (( ${+RUNNER_DEBUG} )) package_args+=(--debug)
|
||||
|
||||
if [[ '${{ inputs.codesign }}' == 'true' ]] package_args+=(--codesign)
|
||||
if [[ '${{ inputs.notarize }}' == 'true' ]] package_args+=(--notarize)
|
||||
if [[ '${{ inputs.package }}' == 'true' ]] package_args+=(--package)
|
||||
|
||||
.github/scripts/package-macos ${package_args}
|
||||
|
||||
- name: Install Dependencies 🛍️
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
: Install Dependencies 🛍️
|
||||
echo ::group::Install Dependencies
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
||||
brew install --quiet zsh
|
||||
echo ::endgroup::
|
||||
|
||||
- name: Run Ubuntu Packaging
|
||||
if: runner.os == 'Linux'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
run: |
|
||||
: Run Ubuntu Packaging
|
||||
package_args=(
|
||||
--target linux-${{ inputs.target }}
|
||||
--config ${{ inputs.config }}
|
||||
)
|
||||
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
if [[ '${{ inputs.package }}' == 'true' ]] package_args+=(--package)
|
||||
|
||||
.github/scripts/package-linux ${package_args}
|
||||
|
||||
- name: Run Windows Packaging
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Run Windows Packaging
|
||||
if ( $Env:RUNNER_DEBUG -ne $null ) {
|
||||
Set-PSDebug -Trace 1
|
||||
}
|
||||
|
||||
$PackageArgs = @{
|
||||
Target = '${{ inputs.target }}'
|
||||
Configuration = '${{ inputs.config }}'
|
||||
}
|
||||
|
||||
if ( '${{ inputs.package }}' -eq 'true' ) {
|
||||
$PackageArgs += @{BuildInstaller = $true}
|
||||
}
|
||||
|
||||
.github/scripts/Package-Windows.ps1 @PackageArgs
|
||||
109
.github/actions/package-plugin/action.yml
vendored
109
.github/actions/package-plugin/action.yml
vendored
|
|
@ -1,109 +0,0 @@
|
|||
name: 'Package plugin'
|
||||
description: 'Packages the plugin for specified architecture and build config.'
|
||||
inputs:
|
||||
target:
|
||||
description: 'Build target for dependencies'
|
||||
required: true
|
||||
config:
|
||||
description: 'Build configuration'
|
||||
required: false
|
||||
default: 'Release'
|
||||
codesign:
|
||||
description: 'Enable codesigning (macOS only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
notarize:
|
||||
description: 'Enable notarization (macOS only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
codesignIdent:
|
||||
description: 'Developer ID for application codesigning (macOS only)'
|
||||
required: false
|
||||
default: '-'
|
||||
installerIdent:
|
||||
description: 'Developer ID for installer package codesigning (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
codesignUser:
|
||||
description: 'Apple ID username for notarization (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
codesignPass:
|
||||
description: 'Apple ID password for notarization (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
createInstaller:
|
||||
description: 'Create InnoSetup installer (Windows only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
portable:
|
||||
description: 'Create deb package / portable archive (Linux only)'
|
||||
required: false
|
||||
default: 'false'
|
||||
workingDirectory:
|
||||
description: 'Working directory for packaging'
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Run macOS packaging
|
||||
if: ${{ runner.os == 'macOS' }}
|
||||
shell: zsh {0}
|
||||
env:
|
||||
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
|
||||
CODESIGN_IDENT_INSTALLER: ${{ inputs.installerIdent }}
|
||||
CODESIGN_IDENT_USER: ${{ inputs.codesignUser }}
|
||||
CODESIGN_IDENT_PASS: ${{ inputs.codesignPass }}
|
||||
run: |
|
||||
package_args=(
|
||||
-c ${{ inputs.config }}
|
||||
-t macos-${{ inputs.target }}
|
||||
)
|
||||
|
||||
if [[ '${{ inputs.codesign }}' == 'true' ]] package_args+=(-s)
|
||||
if [[ '${{ inputs.notarize }}' == 'true' ]] package_args+=(-n)
|
||||
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
package_args+=(-z)
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/package-macos.zsh ${package_args}
|
||||
|
||||
- name: Run Linux packaging
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
shell: bash
|
||||
run: |
|
||||
package_args=(
|
||||
-c ${{ inputs.config }}
|
||||
-t linux-${{ inputs.target }}
|
||||
)
|
||||
if [[ -n "${CI}" && -n "${RUNNER_DEBUG}" ]]; then
|
||||
build_args+=(--debug)
|
||||
fi
|
||||
|
||||
if [[ '${{ inputs.portable }}' == 'true' ]]; then
|
||||
package_args+=(-z)
|
||||
fi
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/package-linux.sh "${package_args[@]}"
|
||||
|
||||
- name: Run Windows packaging
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
$PackageArgs = @{
|
||||
Target = '${{ inputs.target }}'
|
||||
Configuration = '${{ inputs.config }}'
|
||||
}
|
||||
|
||||
if ( '${{ inputs.createInstaller }}' -eq 'true' ) {
|
||||
$PackageArgs += @{BuildInstaller = $true}
|
||||
}
|
||||
|
||||
if ( ( Test-Path env:CI ) -and ( Test-Path env:RUNNER_DEBUG ) ) {
|
||||
$BuildArgs += @{
|
||||
Debug = $true
|
||||
}
|
||||
}
|
||||
|
||||
${{ inputs.workingDirectory }}/.github/scripts/Package-Windows.ps1 @PackageArgs
|
||||
61
.github/actions/run-clang-format/action.yaml
vendored
Normal file
61
.github/actions/run-clang-format/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
name: Run clang-format
|
||||
description: Runs clang-format and checks for any changes introduced by it
|
||||
inputs:
|
||||
failCondition:
|
||||
description: Controls whether failed checks also fail the workflow run
|
||||
required: false
|
||||
default: 'never'
|
||||
workingDirectory:
|
||||
description: Working directory for checks
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Check Runner Operating System 🏃♂️
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
: Check Runner Operating System 🏃♂️
|
||||
echo "::notice::run-clang-format action requires a macOS-based or Linux-based runner."
|
||||
exit 2
|
||||
|
||||
- name: Install Dependencies 🛍️
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
: Install Dependencies 🛍️
|
||||
echo ::group::Install Dependencies
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
||||
echo "/home/linuxbrew/.linuxbrew/opt/clang-format@16/bin" >> $GITHUB_PATH
|
||||
brew install --quiet zsh
|
||||
echo ::endgroup::
|
||||
|
||||
- name: Run clang-format 🐉
|
||||
id: result
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
env:
|
||||
GITHUB_EVENT_FORCED: ${{ github.event.forced }}
|
||||
GITHUB_REF_BEFORE: ${{ github.event.before }}
|
||||
run: |
|
||||
: Run clang-format 🐉
|
||||
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
||||
|
||||
local -a changes=($(git diff --name-only HEAD~1 HEAD))
|
||||
case ${GITHUB_EVENT_NAME} {
|
||||
pull_request) changes=($(git diff --name-only origin/${GITHUB_BASE_REF} HEAD)) ;;
|
||||
push) if [[ ${GITHUB_EVENT_FORCED} != true ]] changes=($(git diff --name-only ${GITHUB_REF_BEFORE} HEAD)) ;;
|
||||
*) ;;
|
||||
}
|
||||
|
||||
if (( ${changes[(I)(*.c|*.h|*.cpp|*.hpp|*.m|*.mm)]} )) {
|
||||
echo ::group::Install clang-format-16
|
||||
brew install --quiet obsproject/tools/clang-format@16
|
||||
echo ::endgroup::
|
||||
|
||||
echo ::group::Run clang-format-16
|
||||
./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check
|
||||
echo ::endgroup::
|
||||
}
|
||||
59
.github/actions/run-cmake-format/action.yaml
vendored
Normal file
59
.github/actions/run-cmake-format/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
name: Run cmake-format
|
||||
description: Runs cmake-format and checks for any changes introduced by it
|
||||
inputs:
|
||||
failCondition:
|
||||
description: Controls whether failed checks also fail the workflow run
|
||||
required: false
|
||||
default: 'never'
|
||||
workingDirectory:
|
||||
description: Working directory for checks
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Check Runner Operating System 🏃♂️
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
: Check Runner Operating System 🏃♂️
|
||||
echo "::notice::run-cmake-format action requires a macOS-based or Linux-based runner."
|
||||
exit 2
|
||||
|
||||
- name: Install Dependencies 🛍️
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
: Install Dependencies 🛍️
|
||||
echo ::group::Install Dependencies
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
||||
brew install --quiet zsh
|
||||
echo ::endgroup::
|
||||
|
||||
- name: Run cmake-format 🎛️
|
||||
id: result
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
GITHUB_EVENT_FORCED: ${{ github.event.forced }}
|
||||
GITHUB_REF_BEFORE: ${{ github.event.before }}
|
||||
run: |
|
||||
: Run cmake-format 🎛️
|
||||
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
||||
|
||||
local -a changes=($(git diff --name-only HEAD~1 HEAD))
|
||||
case ${GITHUB_EVENT_NAME} {
|
||||
pull_request) changes=($(git diff --name-only origin/${GITHUB_BASE_REF} HEAD)) ;;
|
||||
push) if [[ ${GITHUB_EVENT_FORCED} != true ]] changes=($(git diff --name-only ${GITHUB_REF_BEFORE} HEAD)) ;;
|
||||
*) ;;
|
||||
}
|
||||
|
||||
if (( ${changes[(I)*.cmake|*CMakeLists.txt]} )) {
|
||||
echo ::group::Install cmakelang
|
||||
pip3 install cmakelang
|
||||
echo ::endgroup::
|
||||
echo ::group::Run cmake-format
|
||||
./build-aux/run-cmake-format --fail-${{ inputs.failCondition }} --check
|
||||
echo ::endgroup::
|
||||
}
|
||||
37
.github/actions/run-tests/action.yml
vendored
37
.github/actions/run-tests/action.yml
vendored
|
|
@ -1,37 +0,0 @@
|
|||
name: 'Package plugin'
|
||||
description: 'Packages the plugin for specified architecture and build config.'
|
||||
inputs:
|
||||
target:
|
||||
description: 'Build target'
|
||||
required: true
|
||||
workingDirectory:
|
||||
description: 'Working directory'
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Run macOS tests
|
||||
if: ${{ runner.os == 'macOS' }}
|
||||
shell: zsh {0}
|
||||
run: |
|
||||
if [[ '${{ inputs.target }}' != 'x86_64' ]]; then
|
||||
echo tests skipped!
|
||||
exit 0
|
||||
fi
|
||||
${{ inputs.workingDirectory }}/build_x86_64/tests/advanced-scene-switcher-tests
|
||||
|
||||
- name: Run Linux packaging
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ '${{ inputs.target }}' != 'x86_64' ]]; then
|
||||
exit 0
|
||||
fi
|
||||
${{ inputs.workingDirectory }}/build_x86_64/tests/advanced-scene-switcher-tests
|
||||
|
||||
- name: Run Windows packaging
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
${{ inputs.workingDirectory }}/build_x64/tests/RelWithDebInfo/advanced-scene-switcher-tests.exe
|
||||
154
.github/actions/setup-macos-codesigning/action.yaml
vendored
Normal file
154
.github/actions/setup-macos-codesigning/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
name: Set up macOS codesigning
|
||||
description: Sets up code signing certificates, provisioning profiles, and notarization information
|
||||
inputs:
|
||||
codesignIdentity:
|
||||
description: Codesigning identity
|
||||
required: true
|
||||
installerIdentity:
|
||||
description: Codesigning identity for package installer
|
||||
required: false
|
||||
codesignCertificate:
|
||||
description: PKCS12 certificate in base64 format
|
||||
required: true
|
||||
certificatePassword:
|
||||
description: Password required to install PKCS12 certificate
|
||||
required: true
|
||||
keychainPassword:
|
||||
description: Password to use for temporary keychain
|
||||
required: false
|
||||
notarizationUser:
|
||||
description: Apple ID to use for notarization
|
||||
required: false
|
||||
notarizationPassword:
|
||||
description: Application password for notarization
|
||||
provisioningProfile:
|
||||
description: Provisioning profile in base64 format
|
||||
required: false
|
||||
outputs:
|
||||
haveCodesignIdent:
|
||||
description: True if necessary codesigning credentials were found
|
||||
value: ${{ steps.codesign.outputs.haveCodesignIdent }}
|
||||
haveProvisioningProfile:
|
||||
description: True if necessary provisioning profile credentials were found
|
||||
value: ${{ steps.provisioning.outputs.haveProvisioningProfile }}
|
||||
haveNotarizationUser:
|
||||
description: True if necessary notarization credentials were found
|
||||
value: ${{ steps.notarization.outputs.haveNotarizationUser }}
|
||||
codesignIdent:
|
||||
description: Codesigning identity
|
||||
value: ${{ steps.codesign.outputs.codesignIdent }}
|
||||
installerIdent:
|
||||
description: Codesigning identity for package installer
|
||||
value: ${{ steps.codesign.outputs.installerIdent }}
|
||||
codesignTeam:
|
||||
description: Codesigning team
|
||||
value: ${{ steps.codesign.outputs.codesignTeam }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Check Runner Operating System 🏃♂️
|
||||
if: runner.os != 'macOS'
|
||||
shell: bash
|
||||
run: |
|
||||
: Check Runner Operating System 🏃♂️
|
||||
echo "setup-macos-codesigning action requires a macOS-based runner."
|
||||
exit 2
|
||||
|
||||
- name: macOS Codesigning ✍️
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
id: codesign
|
||||
env:
|
||||
MACOS_SIGNING_IDENTITY: ${{ inputs.codesignIdentity }}
|
||||
MACOS_SIGNING_IDENTITY_INSTALLER: ${{ inputs.installerIdentity}}
|
||||
MACOS_SIGNING_CERT: ${{ inputs.codesignCertificate }}
|
||||
MAOCS_SIGNING_CERT_PASSWORD: ${{ inputs.certificatePassword }}
|
||||
MACOS_KEYCHAIN_PASSWORD: ${{ inputs.keychainPassword }}
|
||||
run: |
|
||||
: macOS Codesigning ✍️
|
||||
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
||||
|
||||
if [[ ${MACOS_SIGNING_IDENTITY} && ${MACOS_SIGNING_IDENTITY_INSTALLER} && ${MACOS_SIGNING_CERT} ]] {
|
||||
print 'haveCodesignIdent=true' >> $GITHUB_OUTPUT
|
||||
|
||||
local -r certificate_path="${RUNNER_TEMP}/build_certificate.p12"
|
||||
local -r keychain_path="${RUNNER_TEMP}/app-signing.keychain-db"
|
||||
|
||||
print -n "${MACOS_SIGNING_CERT}" | base64 --decode --output="${certificate_path}"
|
||||
|
||||
: "${MACOS_KEYCHAIN_PASSWORD:="$(print ${RANDOM} | shasum | head -c 32)"}"
|
||||
|
||||
print '::group::Keychain setup'
|
||||
security create-keychain -p "${MACOS_KEYCHAIN_PASSWORD}" ${keychain_path}
|
||||
security set-keychain-settings -lut 21600 ${keychain_path}
|
||||
security unlock-keychain -p "${MACOS_KEYCHAIN_PASSWORD}" ${keychain_path}
|
||||
|
||||
security import "${certificate_path}" -P "${MAOCS_SIGNING_CERT_PASSWORD}" -A \
|
||||
-t cert -f pkcs12 -k ${keychain_path} \
|
||||
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/xcrun
|
||||
|
||||
security set-key-partition-list -S 'apple-tool:,apple:' -k "${MACOS_KEYCHAIN_PASSWORD}" \
|
||||
${keychain_path} &> /dev/null
|
||||
|
||||
security list-keychain -d user -s ${keychain_path} 'login-keychain'
|
||||
print '::endgroup::'
|
||||
|
||||
local -r team_id="${${MACOS_SIGNING_IDENTITY##* }//(\(|\))/}"
|
||||
|
||||
print "codesignIdent=${MACOS_SIGNING_IDENTITY}" >> $GITHUB_OUTPUT
|
||||
print "installerIdent=${MACOS_SIGNING_IDENTITY_INSTALLER}" >> $GITHUB_OUTPUT
|
||||
print "MACOS_KEYCHAIN_PASSWORD=${MACOS_KEYCHAIN_PASSWORD}" >> $GITHUB_ENV
|
||||
print "codesignTeam=${team_id}" >> $GITHUB_OUTPUT
|
||||
} else {
|
||||
print 'haveCodesignIdent=false' >> $GITHUB_OUTPUT
|
||||
}
|
||||
|
||||
- name: Provisioning Profile 👤
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
id: provisioning
|
||||
if: ${{ fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
|
||||
env:
|
||||
MACOS_SIGNING_PROVISIONING_PROFILE: ${{ inputs.provisioningProfile }}
|
||||
run: |
|
||||
: Provisioning Profile 👤
|
||||
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
||||
|
||||
if [[ ${MACOS_SIGNING_PROVISIONING_PROFILE} ]] {
|
||||
print 'haveProvisioningProfile=true' >> $GITHUB_OUTPUT
|
||||
|
||||
local -r profile_path="${RUNNER_TEMP}/build_profile.provisionprofile"
|
||||
print -n "${MACOS_SIGNING_PROVISIONING_PROFILE}" \
|
||||
| base64 --decode --output ${profile_path}
|
||||
|
||||
print '::group::Provisioning Profile Setup'
|
||||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
|
||||
security cms -D -i ${profile_path} -o ${RUNNER_TEMP}/build_profile.plist
|
||||
local -r uuid="$(plutil -extract UUID raw ${RUNNER_TEMP}/build_profile.plist)"
|
||||
local -r team_id="$(plutil -extract TeamIdentifier.0 raw -expect string ${RUNNER_TEMP}/build_profile.plist)"
|
||||
|
||||
if [[ ${team_id} != '${{ steps.codesign.codesignTeam }}' ]] {
|
||||
print '::notice::Code Signing team in provisioning profile does not match certificate.'
|
||||
}
|
||||
|
||||
cp ${profile_path} ~/Library/MobileDevice/Provisioning\ Profiles/${uuid}.provisionprofile
|
||||
print "provisioningProfileUUID=${uuid}" >> $GITHUB_OUTPUT
|
||||
print '::endgroup::'
|
||||
} else {
|
||||
print 'haveProvisioningProfile=false' >> $GITHUB_OUTPUT
|
||||
}
|
||||
|
||||
- name: Notarization 🧑💼
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
id: notarization
|
||||
if: ${{ fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
|
||||
env:
|
||||
MACOS_NOTARIZATION_USERNAME: ${{ inputs.notarizationUser }}
|
||||
MACOS_NOTARIZATION_PASSWORD: ${{ inputs.notarizationPassword }}
|
||||
run: |
|
||||
: Notarization 🧑💼
|
||||
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
||||
|
||||
if [[ ${MACOS_NOTARIZATION_USERNAME} && ${MACOS_NOTARIZATION_PASSWORD} ]] {
|
||||
print 'haveNotarizationUser=true' >> $GITHUB_OUTPUT
|
||||
} else {
|
||||
print 'haveNotarizationUser=false' >> $GITHUB_OUTPUT
|
||||
}
|
||||
6
.github/scripts/.Aptfile
vendored
6
.github/scripts/.Aptfile
vendored
|
|
@ -1,14 +1,12 @@
|
|||
package 'cmake'
|
||||
package 'ccache'
|
||||
package 'curl'
|
||||
package 'git'
|
||||
package 'jq'
|
||||
package 'ninja-build', bin: 'ninja'
|
||||
package 'pkg-config'
|
||||
package 'clang'
|
||||
package 'clang-format-13'
|
||||
package 'libcurl4-openssl-dev'
|
||||
package 'libxtst-dev'
|
||||
package 'libxss-dev'
|
||||
package 'libopencv-dev'
|
||||
package 'libtesseract-dev'
|
||||
package 'libprocps-dev'
|
||||
package 'libprocps-dev'
|
||||
2
.github/scripts/.Brewfile
vendored
2
.github/scripts/.Brewfile
vendored
|
|
@ -3,4 +3,4 @@ brew "coreutils"
|
|||
brew "cmake"
|
||||
brew "git"
|
||||
brew "jq"
|
||||
brew "ninja"
|
||||
brew "xcbeautify"
|
||||
|
|
|
|||
3
.github/scripts/.Wingetfile
vendored
3
.github/scripts/.Wingetfile
vendored
|
|
@ -1,4 +1,3 @@
|
|||
package '7zip.7zip', path: '7-zip', bin: '7z'
|
||||
package 'cmake', path: 'Cmake\bin', bin: 'cmake'
|
||||
package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'
|
||||
package 'OpenSSL', path: 'OpenSSL', bin: 'openssl'
|
||||
package 'OpenSSL', path: 'OpenSSL', bin: 'openssl'
|
||||
125
.github/scripts/.build-deps.zsh
vendored
125
.github/scripts/.build-deps.zsh
vendored
|
|
@ -33,7 +33,6 @@ _trap_error() {
|
|||
build() {
|
||||
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
|
||||
local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[3]}
|
||||
local target="${host_os}-${CPUTYPE}"
|
||||
local project_root=${SCRIPT_HOME:A:h:h}
|
||||
local buildspec_file="${project_root}/buildspec.json"
|
||||
|
||||
|
|
@ -53,8 +52,6 @@ build() {
|
|||
local -i _verbosity=1
|
||||
local -r _version='1.0.0'
|
||||
local -r -a _valid_targets=(
|
||||
macos-x86_64
|
||||
macos-arm64
|
||||
macos-universal
|
||||
linux-x86_64
|
||||
)
|
||||
|
|
@ -126,7 +123,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
BUILD_CONFIG=${2}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-o|--out)
|
||||
|
|
@ -164,11 +161,6 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
check_${host_os}
|
||||
setup_ccache
|
||||
|
||||
typeset -g QT_VERSION
|
||||
typeset -g DEPLOYMENT_TARGET
|
||||
typeset -g OBS_DEPS_VERSION
|
||||
setup_${host_os}
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
local git_tag="$(git describe --tags)"
|
||||
|
|
@ -183,12 +175,111 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
log_info "Using buildspec.json version identifier '${product_version}'"
|
||||
}
|
||||
|
||||
if [[ -z "${OUT_DIR}" ]] {
|
||||
OUT_DIR="advss-build-dependencies"
|
||||
case ${host_os} {
|
||||
macos)
|
||||
sed -i '' \
|
||||
"s/project(\(.*\) VERSION \(.*\))/project(${product_name} VERSION ${product_version})/" \
|
||||
"${project_root}/CMakeLists.txt"
|
||||
;;
|
||||
linux)
|
||||
sed -i'' \
|
||||
"s/project(\(.*\) VERSION \(.*\))/project(${product_name} VERSION ${product_version})/"\
|
||||
"${project_root}/CMakeLists.txt"
|
||||
;;
|
||||
}
|
||||
mkdir -p "${project_root}/../${OUT_DIR}"
|
||||
local advss_dep_path="$(realpath ${project_root}/../${OUT_DIR})"
|
||||
local _plugin_deps="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
|
||||
|
||||
log_info "Run plugin configure step to download OBS deps ..."
|
||||
pushd ${project_root}
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
|
||||
log_group "Configuring ${product_name}..."
|
||||
|
||||
local -a cmake_args=()
|
||||
local -a cmake_build_args=(--build)
|
||||
local -a cmake_install_args=(--install)
|
||||
|
||||
case ${_loglevel} {
|
||||
0) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR) ;;
|
||||
1) ;;
|
||||
2) cmake_build_args+=(--verbose) ;;
|
||||
*) cmake_args+=(--debug-output) ;;
|
||||
}
|
||||
|
||||
local -r _preset="${target%%-*}${CI:+-ci}"
|
||||
case ${target} {
|
||||
macos-*)
|
||||
if (( ${+CI} )) typeset -gx NSUnbufferedIO=YES
|
||||
|
||||
cmake_args+=(
|
||||
-DENABLE_TWITCH_PLUGIN=OFF
|
||||
--preset ${_preset}
|
||||
)
|
||||
|
||||
if (( codesign )) {
|
||||
autoload -Uz read_codesign_team && read_codesign_team
|
||||
|
||||
if [[ -z ${CODESIGN_TEAM} ]] {
|
||||
autoload -Uz read_codesign && read_codesign
|
||||
}
|
||||
}
|
||||
|
||||
cmake_args+=(
|
||||
-DCODESIGN_TEAM=${CODESIGN_TEAM:-}
|
||||
-DCODESIGN_IDENTITY=${CODESIGN_IDENT:--}
|
||||
)
|
||||
|
||||
cmake_build_args+=(--preset ${_preset} --parallel --config ${config} -- ONLY_ACTIVE_ARCH=NO -arch arm64 -arch x86_64)
|
||||
cmake_install_args+=(build_macos --config ${config} --prefix "${project_root}/release/${config}")
|
||||
|
||||
local -a xcbeautify_opts=()
|
||||
if (( _loglevel == 0 )) xcbeautify_opts+=(--quiet)
|
||||
;;
|
||||
linux-*)
|
||||
cmake_args+=(
|
||||
--preset ${_preset}-${target##*-}
|
||||
-G "${generator}"
|
||||
-DQT_VERSION=${QT_VERSION:-6}
|
||||
-DCMAKE_BUILD_TYPE=${config}
|
||||
)
|
||||
|
||||
local cmake_version
|
||||
read -r _ _ cmake_version <<< "$(cmake --version)"
|
||||
|
||||
if [[ ${CPUTYPE} != ${target##*-} ]] {
|
||||
if is-at-least 3.21.0 ${cmake_version}; then
|
||||
cmake_args+=(--toolchain "${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
|
||||
else
|
||||
cmake_args+=(-D"CMAKE_TOOLCHAIN_FILE=${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
|
||||
fi
|
||||
}
|
||||
|
||||
cmake_build_args+=(--preset ${_preset}-${target##*-} --config ${config})
|
||||
if [[ ${generator} == 'Unix Makefiles' ]] {
|
||||
cmake_build_args+=(--parallel $(( $(nproc) + 1 )))
|
||||
} else {
|
||||
cmake_build_args+=(--parallel)
|
||||
}
|
||||
|
||||
cmake_install_args+=(build_${target##*-} --prefix ${project_root}/release/${config})
|
||||
;;
|
||||
}
|
||||
|
||||
log_debug "Attempting to configure with CMake arguments: ${cmake_args}"
|
||||
|
||||
cmake ${cmake_args}
|
||||
|
||||
}
|
||||
|
||||
popd
|
||||
log_group
|
||||
|
||||
if [[ -z "${OUT_DIR}" ]] {
|
||||
OUT_DIR=".deps/advss-build-dependencies"
|
||||
}
|
||||
mkdir -p "${project_root}/${OUT_DIR}"
|
||||
local advss_dep_path="$(realpath ${project_root}/${OUT_DIR})"
|
||||
local deps_version=$(jq -r '.dependencies.prebuilt.version' ${buildspec_file})
|
||||
local qt_deps_version=$(jq -r '.dependencies.qt6.version' ${buildspec_file})
|
||||
local _plugin_deps="${project_root:h}/.deps/obs-deps-${deps_version}-${target##*-};${project_root:h}/.deps/obs-deps-qt6-${qt_deps_version}-${target##*-}"
|
||||
|
||||
case ${host_os} {
|
||||
macos)
|
||||
|
|
@ -210,7 +301,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
|
||||
pushd ${opencv_dir}
|
||||
log_info "Configure OpenCV ..."
|
||||
cmake -S . -B ${opencv_build_dir} -G ${generator} ${opencv_cmake_args}
|
||||
cmake -S . -B ${opencv_build_dir} ${opencv_cmake_args}
|
||||
|
||||
log_info "Building OpenCV ..."
|
||||
cmake --build ${opencv_build_dir} --config Release
|
||||
|
|
@ -239,7 +330,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
|
||||
pushd ${leptonica_dir}
|
||||
log_info "Configure Leptonica ..."
|
||||
cmake -S . -B ${leptonica_build_dir} -G ${generator} ${leptonica_cmake_args}
|
||||
cmake -S . -B ${leptonica_build_dir} ${leptonica_cmake_args}
|
||||
|
||||
log_info "Building Leptonica ..."
|
||||
cmake --build ${leptonica_build_dir} --config Release
|
||||
|
|
@ -277,7 +368,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
|
||||
pushd ${tesseract_dir}
|
||||
log_info "Configure Tesseract ..."
|
||||
cmake -S . -B ${tesseract_build_dir} -G ${generator} ${tesseract_cmake_args}
|
||||
cmake -S . -B ${tesseract_build_dir} ${tesseract_cmake_args}
|
||||
|
||||
log_info "Building Tesseract ..."
|
||||
cmake --build ${tesseract_build_dir} --config Release
|
||||
|
|
|
|||
244
.github/scripts/.build.zsh
vendored
244
.github/scripts/.build.zsh
vendored
|
|
@ -17,56 +17,77 @@ setopt FUNCTION_ARGZERO
|
|||
# setopt XTRACE
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||
print -u2 -PR "%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
print -u2 -PR "${CI:+::error::}%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_trap_error() {
|
||||
print -u2 -PR '%F{1} ✖︎ script execution error%f'
|
||||
print -PR -e "
|
||||
TRAPEXIT() {
|
||||
local return_value=$?
|
||||
|
||||
if (( ${+CI} )) unset NSUnbufferedIO
|
||||
|
||||
return ${return_value}
|
||||
}
|
||||
|
||||
TRAPZERR() {
|
||||
if (( ${_loglevel:-3} > 2 )) {
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ✖︎ script execution error%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
"
|
||||
}
|
||||
|
||||
exit 2
|
||||
}
|
||||
|
||||
build() {
|
||||
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
|
||||
local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[2]}
|
||||
local target="${host_os}-${CPUTYPE}"
|
||||
local project_root=${SCRIPT_HOME:A:h:h}
|
||||
local buildspec_file="${project_root}/buildspec.json"
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
local dep_dir=""
|
||||
|
||||
trap '_trap_error' ZERR
|
||||
|
||||
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
|
||||
autoload -Uz log_info log_error log_output set_loglevel check_${host_os} setup_${host_os} setup_obs setup_ccache
|
||||
autoload -Uz log_group log_info log_error log_output set_loglevel check_${host_os} setup_ccache
|
||||
|
||||
if [[ ! -r ${buildspec_file} ]] {
|
||||
log_error \
|
||||
'No buildspec.json found. Please create a build specification for your project.' \
|
||||
'A buildspec.json.template file is provided in the repository to get you started.'
|
||||
'No buildspec.json found. Please create a build specification for your project.'
|
||||
return 2
|
||||
}
|
||||
|
||||
typeset -g -a skips=()
|
||||
local -i _verbosity=1
|
||||
local -r _version='1.0.0'
|
||||
local -i verbosity=1
|
||||
local -r _version='2.0.0'
|
||||
local -r -a _valid_targets=(
|
||||
macos-x86_64
|
||||
macos-arm64
|
||||
macos-universal
|
||||
linux-x86_64
|
||||
linux-aarch64
|
||||
)
|
||||
local target
|
||||
local config='RelWithDebInfo'
|
||||
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
|
||||
if [[ ${host_os} == 'macos' ]] {
|
||||
local -r -a _valid_generators=(Xcode Ninja 'Unix Makefiles')
|
||||
local generator="${${CI:+Ninja}:-Xcode}"
|
||||
} else {
|
||||
local -i codesign=0
|
||||
|
||||
if [[ ${host_os} == linux ]] {
|
||||
local -r -a _valid_generators=(Ninja 'Unix Makefiles')
|
||||
local generator='Ninja'
|
||||
local -r _usage_host="
|
||||
%F{yellow} Additional options for Linux builds%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B--generator%b Specify build system to generate
|
||||
Available generators:
|
||||
- Ninja
|
||||
- Unix Makefiles"
|
||||
} elif [[ ${host_os} == macos ]] {
|
||||
local -r _usage_host="
|
||||
%F{yellow} Additional options for macOS builds%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-s | --codesign%b Enable codesigning (macOS only)"
|
||||
}
|
||||
|
||||
local -i print_config=0
|
||||
local -r _usage="
|
||||
Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
||||
|
||||
|
|
@ -74,28 +95,23 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
|
||||
%F{yellow} Build configuration options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-t | --target%b Specify target - default: %B%F{green}${host_os}-${CPUTYPE}%f%b
|
||||
%B-c | --config%b Build configuration - default: %B%F{green}RelWithDebInfo%f%b
|
||||
%B-s | --codesign%b Enable codesigning (macOS only)
|
||||
%B-t | --target%b Specify target
|
||||
%B-c | --config%b Build configuration
|
||||
%B-p | --portable%b Enable portable mode (Linux only)
|
||||
%B-d | --dep%b Dependency directory name - default: %B%F{green}advss-build-dependencies%f%b
|
||||
%B--generator%b Specify build system to generate - default: %B%F{green}Ninja%f%b
|
||||
Available generators:
|
||||
- Ninja
|
||||
- Unix Makefiles
|
||||
- Xcode (macOS only)
|
||||
%B--skip-[all|build|deps]%b Skip all|building|checking for dependencies
|
||||
|
||||
%F{yellow} Output options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-q | --quiet%b Quiet (error output only)
|
||||
%B-v | --verbose%b Verbose (more detailed output)
|
||||
%B--skip-[all|build|deps|unpack]%b Skip all|building OBS|checking for dependencies|unpacking dependencies
|
||||
%B--debug%b Debug (very detailed and added output)
|
||||
|
||||
%F{yellow} General options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-h | --help%b Print this usage help
|
||||
%B-V | --version%b Print script version information"
|
||||
%B-V | --version%b Print script version information
|
||||
${_usage_host:-}"
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
|
|
@ -129,32 +145,35 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
BUILD_CONFIG=${2}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) codesign=1; shift ;;
|
||||
-d|--dep)
|
||||
dep_dir="${2}"
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) CODESIGN=1; shift ;;
|
||||
-p|--portable) typeset -g PORTABLE=1; shift ;;
|
||||
-q|--quiet) (( _verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( _verbosity += 1 )); shift ;;
|
||||
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( verbosity += 1 )); shift ;;
|
||||
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||
--debug) _verbosity=3; shift ;;
|
||||
--debug) verbosity=3; shift ;;
|
||||
--generator)
|
||||
if (( ! ${_valid_generators[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
if [[ ${host_os} == linux ]] {
|
||||
if (( ! ${_valid_generators[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
generator=${2}
|
||||
}
|
||||
generator=${2}
|
||||
shift 2
|
||||
;;
|
||||
--print-config) print_config=1; skips+=(deps); shift ;;
|
||||
--skip-*)
|
||||
local _skip="${${(s:-:)1}[-1]}"
|
||||
local _check=(all deps unpack build)
|
||||
local -r _skip="${${(s:-:)1}[-1]}"
|
||||
local -r -a _check=(all build deps)
|
||||
(( ${_check[(Ie)${_skip}]} )) || log_warning "Invalid skip mode %B${_skip}%b supplied"
|
||||
typeset -g -a skips=(${skips} ${_skip})
|
||||
shift
|
||||
|
|
@ -163,30 +182,32 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
}
|
||||
}
|
||||
|
||||
: "${target:="${host_os}-${CPUTYPE}"}"
|
||||
|
||||
set -- ${(@)args}
|
||||
set_loglevel ${_verbosity}
|
||||
set_loglevel ${verbosity}
|
||||
|
||||
check_${host_os}
|
||||
setup_ccache
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
check_${host_os}
|
||||
setup_ccache
|
||||
}
|
||||
|
||||
typeset -g QT_VERSION
|
||||
typeset -g DEPLOYMENT_TARGET
|
||||
typeset -g OBS_DEPS_VERSION
|
||||
setup_${host_os}
|
||||
if [[ ${host_os} == linux ]] {
|
||||
autoload -Uz setup_linux && setup_linux
|
||||
}
|
||||
|
||||
local advss_deps_path
|
||||
if [[ -z "${dep_dir}" ]] {
|
||||
log_info "Building advss deps ..."
|
||||
dep_dir="advss-build-dependencies"
|
||||
${SCRIPT_HOME}/build-deps-${host_os}.zsh -c "${BUILD_CONFIG:-RelWithDebInfo}" -t "${target}" --generator "${generator}" -o "${dep_dir}" --skip-deps --skip-unpack
|
||||
dep_dir=".deps/advss-build-dependencies"
|
||||
${SCRIPT_HOME}/build-deps-${host_os}.zsh -c "${BUILD_CONFIG:-RelWithDebInfo}" -t "${target}" --generator "${generator}" -o "${dep_dir}"
|
||||
}
|
||||
advss_deps_path=$(realpath ${project_root}/../${dep_dir})
|
||||
advss_deps_path=$(realpath ${project_root}/${dep_dir})
|
||||
log_info "Using advss deps at $advss_deps_path ..."
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
local git_tag="$(git describe --tags)"
|
||||
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
|
||||
|
||||
|
|
@ -210,77 +231,108 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
;;
|
||||
}
|
||||
|
||||
setup_obs
|
||||
|
||||
pushd ${project_root}
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
|
||||
log_info "Configuring ${product_name}..."
|
||||
log_group "Configuring ${product_name}..."
|
||||
|
||||
local _plugin_deps="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
|
||||
local -a cmake_args=(
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG:-RelWithDebInfo}
|
||||
-DQT_VERSION=${QT_VERSION}
|
||||
-DCMAKE_PREFIX_PATH="${_plugin_deps};${advss_deps_path}"
|
||||
-DCMAKE_PREFIX_PATH="${advss_deps_path}"
|
||||
)
|
||||
local -a cmake_build_args=(--build)
|
||||
local -a cmake_install_args=(--install)
|
||||
|
||||
if (( _loglevel == 0 )) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR)
|
||||
if (( _loglevel > 2 )) cmake_args+=(--debug-output)
|
||||
|
||||
local num_procs
|
||||
case ${_loglevel} {
|
||||
0) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR) ;;
|
||||
1) ;;
|
||||
2) cmake_build_args+=(--verbose) ;;
|
||||
*) cmake_args+=(--debug-output) ;;
|
||||
}
|
||||
|
||||
local -r _preset="${target%%-*}${CI:+-ci}"
|
||||
case ${target} {
|
||||
macos-*)
|
||||
autoload -Uz read_codesign
|
||||
if (( ${+CODESIGN} )) {
|
||||
read_codesign
|
||||
}
|
||||
|
||||
num_procs=$(( $(sysctl -n hw.ncpu) + 1 ))
|
||||
if (( ${+CI} )) typeset -gx NSUnbufferedIO=YES
|
||||
|
||||
local openssl_lib_dir="${advss_deps_path}/openssl-combined/"
|
||||
local openssl_include_dir="${advss_deps_path}/openssl/include"
|
||||
|
||||
cmake_args+=(
|
||||
-DCMAKE_FRAMEWORK_PATH="${_plugin_deps}/Frameworks"
|
||||
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
||||
-DOBS_CODESIGN_LINKER=ON
|
||||
-DOBS_BUNDLE_CODESIGN_IDENTITY="${CODESIGN_IDENT:--}"
|
||||
-DOPENSSL_INCLUDE_DIR="${openssl_include_dir}"
|
||||
-DOPENSSL_LIBRARIES="${openssl_lib_dir}/libcrypto.a;${openssl_lib_dir}/libssl.a"
|
||||
--preset ${_preset}
|
||||
)
|
||||
|
||||
if (( codesign )) {
|
||||
autoload -Uz read_codesign_team && read_codesign_team
|
||||
|
||||
if [[ -z ${CODESIGN_TEAM} ]] {
|
||||
autoload -Uz read_codesign && read_codesign
|
||||
}
|
||||
}
|
||||
|
||||
cmake_args+=(
|
||||
-DCODESIGN_TEAM=${CODESIGN_TEAM:-}
|
||||
-DCODESIGN_IDENTITY=${CODESIGN_IDENT:--}
|
||||
)
|
||||
|
||||
cmake_build_args+=(--preset ${_preset} --parallel --config ${config} -- ONLY_ACTIVE_ARCH=NO -arch arm64 -arch x86_64)
|
||||
cmake_install_args+=(build_macos --config ${config} --prefix "${project_root}/release/${config}")
|
||||
|
||||
local -a xcbeautify_opts=()
|
||||
if (( _loglevel == 0 )) xcbeautify_opts+=(--quiet)
|
||||
;;
|
||||
linux-*)
|
||||
if (( ${+PORTABLE} )) {
|
||||
cmake_args+=(
|
||||
-DLINUX_PORTABLE=ON
|
||||
)
|
||||
} else {
|
||||
cmake_args+=(
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
-DLINUX_PORTABLE=OFF
|
||||
)
|
||||
cmake_args+=(
|
||||
--preset ${_preset}-${target##*-}
|
||||
-G "${generator}"
|
||||
-DQT_VERSION=${QT_VERSION:-6}
|
||||
-DCMAKE_BUILD_TYPE=${config}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
)
|
||||
|
||||
local cmake_version
|
||||
read -r _ _ cmake_version <<< "$(cmake --version)"
|
||||
|
||||
if [[ ${CPUTYPE} != ${target##*-} ]] {
|
||||
if is-at-least 3.21.0 ${cmake_version}; then
|
||||
cmake_args+=(--toolchain "${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
|
||||
else
|
||||
cmake_args+=(-D"CMAKE_TOOLCHAIN_FILE=${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
|
||||
fi
|
||||
}
|
||||
num_procs=$(( $(nproc) + 1 ))
|
||||
|
||||
cmake_build_args+=(--preset ${_preset}-${target##*-} --config ${config})
|
||||
if [[ ${generator} == 'Unix Makefiles' ]] {
|
||||
cmake_build_args+=(--parallel $(( $(nproc) + 1 )))
|
||||
} else {
|
||||
cmake_build_args+=(--parallel)
|
||||
}
|
||||
|
||||
cmake_install_args+=(build_${target##*-} --prefix ${project_root}/release/${config})
|
||||
;;
|
||||
}
|
||||
|
||||
log_debug "Attempting to configure ${product_name} with CMake arguments: ${cmake_args}"
|
||||
cmake -S . -B build_${target##*-} -G ${generator} ${cmake_args}
|
||||
log_debug "Attempting to configure with CMake arguments: ${cmake_args}"
|
||||
|
||||
log_info "Building ${product_name}..."
|
||||
local -a cmake_args=()
|
||||
if (( _loglevel > 1 )) cmake_args+=(--verbose)
|
||||
if [[ ${generator} == 'Unix Makefiles' ]] cmake_args+=(--parallel ${num_procs})
|
||||
cmake --build build_${target##*-} --config ${BUILD_CONFIG:-RelWithDebInfo} ${cmake_args}
|
||||
cmake ${cmake_args}
|
||||
|
||||
log_group "Building ${product_name}..."
|
||||
if [[ ${host_os} == macos ]] {
|
||||
if (( _loglevel > 1 )) {
|
||||
cmake ${cmake_build_args}
|
||||
} else {
|
||||
cmake ${cmake_build_args} 2>&1 | xcbeautify ${xcbeautify_opts}
|
||||
}
|
||||
} else {
|
||||
cmake ${cmake_build_args}
|
||||
}
|
||||
}
|
||||
|
||||
log_info "Installing ${product_name}..."
|
||||
local -a cmake_args=()
|
||||
if (( _loglevel > 1 )) cmake_args+=(--verbose)
|
||||
cmake --install build_${target##*-} --config ${BUILD_CONFIG:-RelWithDebInfo} --prefix "${project_root}/release" ${cmake_args}
|
||||
log_group "Installing ${product_name}..."
|
||||
if (( _loglevel > 1 )) cmake_install_args+=(--verbose)
|
||||
cmake ${cmake_install_args}
|
||||
popd
|
||||
log_group
|
||||
}
|
||||
|
||||
build ${@}
|
||||
|
|
|
|||
246
.github/scripts/.package.zsh
vendored
246
.github/scripts/.package.zsh
vendored
|
|
@ -17,39 +17,70 @@ setopt FUNCTION_ARGZERO
|
|||
# setopt XTRACE
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||
print -u2 -PR "%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
print -u2 -PR "${CI:+::error::}%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_trap_error() {
|
||||
print -u2 -PR '%F{1} ✖︎ script execution error%f'
|
||||
print -PR -e "
|
||||
TRAPEXIT() {
|
||||
local return_value=$?
|
||||
|
||||
if (( ${+CI} )) {
|
||||
unset NSUnbufferedIO
|
||||
}
|
||||
|
||||
return ${return_value}
|
||||
}
|
||||
|
||||
TRAPZERR() {
|
||||
if (( ${_loglevel:-3} > 2 )) {
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ✖︎ script execution error%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
"
|
||||
}
|
||||
|
||||
exit 2
|
||||
}
|
||||
|
||||
package() {
|
||||
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
|
||||
local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[2]}
|
||||
local target="${host_os}-${CPUTYPE}"
|
||||
local project_root=${SCRIPT_HOME:A:h:h}
|
||||
local buildspec_file="${project_root}/buildspec.json"
|
||||
trap '_trap_error' ZERR
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
|
||||
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
|
||||
autoload -Uz set_loglevel log_info log_error log_output check_${host_os}
|
||||
autoload -Uz set_loglevel log_info log_group log_error log_output check_${host_os}
|
||||
|
||||
local -i _verbosity=1
|
||||
local -r _version='1.0.0'
|
||||
if [[ ! -r ${buildspec_file} ]] {
|
||||
log_error \
|
||||
'No buildspec.json found. Please create a build specification for your project.'
|
||||
return 2
|
||||
}
|
||||
|
||||
local -i verbosity=1
|
||||
local -r _version='2.0.0'
|
||||
local -r -a _valid_targets=(
|
||||
macos-x86_64
|
||||
macos-arm64
|
||||
macos-universal
|
||||
linux-x86_64
|
||||
)
|
||||
local target
|
||||
local config='RelWithDebInfo'
|
||||
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
|
||||
local -i codesign=0
|
||||
local -i notarize=0
|
||||
local -i package=0
|
||||
local -i skip_deps=0
|
||||
|
||||
if [[ ${host_os} == macos ]] {
|
||||
local -r _usage_host="
|
||||
%F{yellow} Additional options for macOS builds%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-s | --codesign%b Enable codesigning (macOS only)
|
||||
%B-n | --notarize%b Enable notarization (macOS only)
|
||||
%B-p | --package%b Create package installer (macOS only)"
|
||||
}
|
||||
|
||||
local -r _usage="
|
||||
Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
||||
|
||||
|
|
@ -57,11 +88,9 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
|
||||
%F{yellow} Package configuration options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-t | --target%b Specify target - default: %B%F{green}${host_os}-${CPUTYPE}%f%b
|
||||
%B-c | --config%b Build configuration - default: %B%F{green}RelWithDebInfo%f%b
|
||||
%B-s | --codesign%b Enable codesigning (macOS only)
|
||||
%B-n | --notarize%b Enable notarization (macOS only)
|
||||
%B-z | --zip%b Zip only (Linux only)
|
||||
%B-t | --target%b Specify target
|
||||
%B-c | --config%b Build configuration
|
||||
%B--skip-deps%b Skip checking for dependencies
|
||||
|
||||
%F{yellow} Output options%f
|
||||
-----------------------------------------------------------------------------
|
||||
|
|
@ -72,7 +101,8 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
%F{yellow} General options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-h | --help%b Print this usage help
|
||||
%B-V | --version%b Print script version information"
|
||||
%B-V | --version%b Print script version information
|
||||
${_usage_host:-}"
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
|
|
@ -101,115 +131,139 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||
shift 2
|
||||
;;
|
||||
-c|--config)
|
||||
if (( ! ${_valid_configs[(Ie)${2}]} )) {
|
||||
if (( !${_valid_configs[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
BUILD_CONFIG=${2}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) typeset -g CODESIGN=1; shift ;;
|
||||
-n|--notarize) typeset -g NOTARIZE=1; typeset -g CODESIGN=1; shift ;;
|
||||
-z|--zip) typeset -g ZIP=1; shift ;;
|
||||
-q|--quiet) (( _verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( _verbosity += 1 )); shift ;;
|
||||
-s|--codesign) typeset -g codesign=1; shift ;;
|
||||
-n|--notarize) typeset -g notarize=1; typeset -g codesign=1; shift ;;
|
||||
-p|--package) typeset -g package=1; shift ;;
|
||||
--skip-deps) typeset -g skip_deps=1; shift ;;
|
||||
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( verbosity += 1 )); shift ;;
|
||||
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||
--debug) _verbosity=3; shift ;;
|
||||
--debug) verbosity=3; shift ;;
|
||||
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
|
||||
}
|
||||
}
|
||||
|
||||
set -- ${(@)args}
|
||||
set_loglevel ${_verbosity}
|
||||
: "${target:="${host_os}-${CPUTYPE}"}"
|
||||
|
||||
check_${host_os}
|
||||
set -- ${(@)args}
|
||||
set_loglevel ${verbosity}
|
||||
|
||||
if (( ! skip_deps )) {
|
||||
check_${host_os}
|
||||
}
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
local git_tag="$(git describe --tags)"
|
||||
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' ${project_root}/buildspec.json)"
|
||||
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
|
||||
|
||||
if [[ "${git_tag}" =~ '^([0-9]+\.){0,2}(\*|[0-9]+)$' ]] {
|
||||
log_info "Using git tag as version identifier '${git_tag}'"
|
||||
product_version="${git_tag}"
|
||||
} else {
|
||||
log_info "Using buildspec.json version identifier '${product_version}'"
|
||||
}
|
||||
|
||||
if [[ ${host_os} == 'macos' ]] {
|
||||
if [[ ${host_os} == macos ]] {
|
||||
autoload -Uz check_packages read_codesign read_codesign_installer read_codesign_pass
|
||||
|
||||
local output_name="${product_name}-${host_os}-${target##*-}.pkg"
|
||||
local output_name="${product_name}-${product_version}-${host_os}-universal"
|
||||
|
||||
if [[ ! -d ${project_root}/release/${product_name}.plugin ]] {
|
||||
if [[ ! -d ${project_root}/release/${config}/${product_name}.plugin ]] {
|
||||
log_error 'No release artifact found. Run the build script or the CMake install procedure first.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if [[ ! -f ${project_root}/build_${target##*-}/installer-macos.generated.pkgproj ]] {
|
||||
log_error 'Packages project file not found. Run the build script or the CMake build and install procedures first.'
|
||||
return 2
|
||||
}
|
||||
local _tarflags='cJf'
|
||||
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"
|
||||
|
||||
check_packages
|
||||
|
||||
log_info "Packaging ${product_name}..."
|
||||
pushd ${project_root}
|
||||
packagesbuild \
|
||||
--build-folder ${project_root}/release \
|
||||
${project_root}/build_${target##*-}/installer-macos.generated.pkgproj
|
||||
|
||||
if (( ${+CODESIGN} )) {
|
||||
read_codesign_installer
|
||||
productsign \
|
||||
--sign "${CODESIGN_IDENT_INSTALLER}" \
|
||||
"${project_root}/release/${product_name}.pkg" \
|
||||
"${project_root}/release/${output_name}"
|
||||
|
||||
rm "${project_root}/release/${product_name}.pkg"
|
||||
} else {
|
||||
mv "${project_root}/release/${product_name}.pkg" \
|
||||
"${project_root}/release/${output_name}"
|
||||
}
|
||||
|
||||
if (( ${+CODESIGN} && ${+NOTARIZE} )) {
|
||||
if [[ ! -f "${project_root}/release/${output_name}" ]] {
|
||||
log_error "No package for notarization found."
|
||||
if (( package )) {
|
||||
if [[ ! -f ${project_root}/release/${config}/${product_name}.pkg ]] {
|
||||
log_error 'Installer Package not found. Run the build script or the CMake build and install procedures first.'
|
||||
return 2
|
||||
}
|
||||
|
||||
read_codesign_installer
|
||||
read_codesign_pass
|
||||
|
||||
xcrun notarytool submit "${project_root}/release/${output_name}" \
|
||||
--keychain-profile "OBS-Codesign-Password" --wait
|
||||
xcrun stapler staple "${project_root}/release/${output_name}"
|
||||
}
|
||||
if (( ${+ZIP} )) {
|
||||
local output_name="${product_name}-${host_os}-${target##*-}.zip"
|
||||
pushd ${project_root}/release
|
||||
zip -r "${output_name}" *~*.pkg
|
||||
popd
|
||||
}
|
||||
popd
|
||||
} elif [[ ${host_os} == 'linux' ]] {
|
||||
if (( ${+ZIP} )) {
|
||||
local output_name="${product_name}-${host_os}-${target##*-}.zip"
|
||||
pushd ${project_root}/release
|
||||
zip -r "${output_name}" *
|
||||
popd
|
||||
} else {
|
||||
local -a cmake_args=()
|
||||
if (( _loglevel > 1 )) cmake_args+=(--verbose)
|
||||
|
||||
log_group "Packaging ${product_name}..."
|
||||
pushd ${project_root}
|
||||
cmake --build build_${target##*-} --config ${BUILD_CONFIG:-RelWithDebInfo} -t package ${cmake_args}
|
||||
|
||||
if (( codesign )) {
|
||||
read_codesign_installer
|
||||
productsign \
|
||||
--sign "${CODESIGN_IDENT_INSTALLER}" \
|
||||
${project_root}/release/${config}/${product_name}.pkg \
|
||||
${project_root}/release/${output_name}.pkg
|
||||
|
||||
rm ${project_root}/release/${config}/${product_name}.pkg
|
||||
} else {
|
||||
mv ${project_root}/release/${config}/${product_name}.pkg \
|
||||
${project_root}/release/${output_name}.pkg
|
||||
}
|
||||
|
||||
if (( codesign && notarize )) {
|
||||
if [[ ! -f ${project_root}/release/${output_name}.pkg ]] {
|
||||
log_error "No package for notarization found."
|
||||
return 2
|
||||
}
|
||||
|
||||
read_codesign_installer
|
||||
read_codesign_pass
|
||||
|
||||
xcrun notarytool submit ${project_root}/release/${output_name}.pkg \
|
||||
--keychain-profile "OBS-Codesign-Password" --wait
|
||||
|
||||
local -i _status=0
|
||||
|
||||
xcrun stapler staple ${project_root}/release/${output_name}.pkg || _status=1
|
||||
|
||||
if (( _status )) {
|
||||
log_error "Notarization failed. Use 'xcrun notarytool log <submission ID>' to check for errors."
|
||||
return 2
|
||||
}
|
||||
}
|
||||
popd
|
||||
}
|
||||
|
||||
log_group "Archiving ${product_name}..."
|
||||
pushd ${project_root}/release/${config}
|
||||
XZ_OPT=-T0 tar "-${_tarflags}" ${project_root}/release/${output_name}.tar.xz ${product_name}.plugin
|
||||
popd
|
||||
|
||||
if [[ ${config} == Release ]] {
|
||||
log_group "Archiving ${product_name} Debug Symbols..."
|
||||
pushd ${project_root}/release/${config}
|
||||
XZ_OPT=-T0 tar "-${_tarflags}" ${project_root}/release/${output_name}-dSYMs.tar.xz ${product_name}.plugin.dSYM
|
||||
popd
|
||||
}
|
||||
|
||||
log_group
|
||||
} elif [[ ${host_os} == linux ]] {
|
||||
local -a cmake_args=()
|
||||
if (( _loglevel > 1 )) cmake_args+=(--verbose)
|
||||
|
||||
log_group "Creating source tarball for ${product_name}..."
|
||||
pushd ${project_root}
|
||||
cmake --build build_${target##*-} --config ${config} -t package_source ${cmake_args}
|
||||
popd
|
||||
|
||||
if (( package )) {
|
||||
log_group "Packaging ${product_name}..."
|
||||
pushd ${project_root}
|
||||
cmake --build build_${target##*-} --config ${config} -t package ${cmake_args}
|
||||
popd
|
||||
}
|
||||
|
||||
log_group "Archiving ${product_name}..."
|
||||
local output_name="${product_name}-${product_version}-${target##*-}-linux-gnu"
|
||||
local _tarflags='cJf'
|
||||
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"
|
||||
|
||||
pushd ${project_root}/release/${config}
|
||||
XZ_OPT=-T0 tar "-${_tarflags}" ${project_root}/release/${output_name}.tar.xz (lib|share)
|
||||
popd
|
||||
|
||||
log_group
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
82
.github/scripts/Build-Deps-Windows.ps1
vendored
82
.github/scripts/Build-Deps-Windows.ps1
vendored
|
|
@ -13,6 +13,10 @@ param(
|
|||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if (-not $Target) {
|
||||
$Target = "x64"
|
||||
}
|
||||
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$VerbosePreference = 'Continue'
|
||||
$InformationPreference = 'Continue'
|
||||
|
|
@ -41,28 +45,65 @@ function Build {
|
|||
. $Utility.FullName
|
||||
}
|
||||
|
||||
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||
$ProductName = $BuildSpec.name
|
||||
$ProductVersion = $BuildSpec.version
|
||||
|
||||
$script:VisualStudioVersion = ''
|
||||
$script:PlatformSDK = '10.0.18363.657'
|
||||
|
||||
Setup-Host
|
||||
|
||||
if ( $CmakeGenerator -eq '' ) {
|
||||
$CmakeGenerator = $script:VisualStudioVersion
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
|
||||
$DepsPath = "plugin-deps-${script:DepsVersion}-*-${script:Target}"
|
||||
$OBSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../obs-build-dependencies/${DepsPath})"
|
||||
Log-Information "Run plugin configure step to download OBS deps ..."
|
||||
Push-Location -Stack BuildTemp
|
||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
||||
Ensure-Location $ProjectRoot
|
||||
|
||||
$CmakeArgs = @(
|
||||
"-DCMAKE_PREFIX_PATH:PATH=${ADVSSDepPath}"
|
||||
)
|
||||
$CmakeBuildArgs = @()
|
||||
$CmakeInstallArgs = @()
|
||||
|
||||
if ( $VerbosePreference -eq 'Continue' ) {
|
||||
$CmakeBuildArgs += ('--verbose')
|
||||
$CmakeInstallArgs += ('--verbose')
|
||||
}
|
||||
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$CmakeArgs += ('--debug-output')
|
||||
}
|
||||
|
||||
$Preset = "windows-$(if ( $Env:CI -ne $null ) { 'ci-' })${Target}"
|
||||
|
||||
$CmakeArgs += @(
|
||||
'--preset', $Preset
|
||||
)
|
||||
|
||||
$CmakeBuildArgs += @(
|
||||
'--build'
|
||||
'--preset', $Preset
|
||||
'--config', $Configuration
|
||||
'--parallel'
|
||||
'--', '/consoleLoggerParameters:Summary', '/noLogo'
|
||||
)
|
||||
|
||||
$CmakeInstallArgs += @(
|
||||
'--install', "build_${Target}"
|
||||
'--prefix', "${ProjectRoot}/release/${Configuration}"
|
||||
'--config', $Configuration
|
||||
)
|
||||
|
||||
Log-Group "Configuring ${ProductName}..."
|
||||
Invoke-External cmake @CmakeArgs
|
||||
}
|
||||
|
||||
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||
$depsVersion = $BuildSpec.dependencies.prebuilt.version
|
||||
$qtDepsVersion = $BuildSpec.dependencies.qt6.version
|
||||
$OBSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/.deps/obs-deps-${depsVersion}-${Target});$(Resolve-Path -Path ${ProjectRoot}/.deps/obs-deps-qt6-${qtDepsVersion}-${Target})"
|
||||
|
||||
if ( $OutDirName -eq '' ) {
|
||||
$OutDirName = "advss-build-dependencies"
|
||||
$OutDirName = ".deps/advss-build-dependencies"
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path ${ProjectRoot}/../${OutDirName}
|
||||
New-Item -ItemType Directory -Force -Path ${ProjectRoot}/${OutDirName}
|
||||
|
||||
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../${OutDirName})"
|
||||
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/${OutDirName})"
|
||||
|
||||
$OpenCVPath = "${ProjectRoot}/deps/opencv"
|
||||
$OpenCVBuildPath = "${OpenCVPath}/build"
|
||||
|
|
@ -71,9 +112,6 @@ function Build {
|
|||
Ensure-Location $ProjectRoot
|
||||
|
||||
$OpenCVCmakeArgs = @(
|
||||
'-G', $CmakeGenerator
|
||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
|
||||
|
|
@ -103,9 +141,6 @@ function Build {
|
|||
Ensure-Location $ProjectRoot
|
||||
|
||||
$LeptonicaCmakeArgs = @(
|
||||
'-G', $CmakeGenerator
|
||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||
"-DCMAKE_BUILD_TYPE=${Configuration}"
|
||||
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
|
||||
|
|
@ -138,9 +173,6 @@ function Build {
|
|||
|
||||
# Explicitly disable PkgConfig and tiff as it will lead build errors
|
||||
$TesseractCmakeArgs = @(
|
||||
'-G', $CmakeGenerator
|
||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||
"-DCMAKE_BUILD_TYPE=${Configuration}"
|
||||
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
|
||||
|
|
|
|||
108
.github/scripts/Build-Windows.ps1
vendored
108
.github/scripts/Build-Windows.ps1
vendored
|
|
@ -1,16 +1,13 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo',
|
||||
[ValidateSet('x86', 'x64')]
|
||||
[string] $Target,
|
||||
[ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
|
||||
[string] $CMakeGenerator,
|
||||
[string] $ADVSSDepName,
|
||||
[switch] $SkipAll,
|
||||
[switch] $SkipBuild,
|
||||
[switch] $SkipDeps,
|
||||
[switch] $SkipUnpack
|
||||
[string] $ADVSSDepName
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
|
@ -20,6 +17,10 @@ if ( $DebugPreference -eq 'Continue' ) {
|
|||
$InformationPreference = 'Continue'
|
||||
}
|
||||
|
||||
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
|
||||
throw "A 64-bit system is required to build the project."
|
||||
}
|
||||
|
||||
if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
|
||||
Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
|
||||
exit 2
|
||||
|
|
@ -29,6 +30,7 @@ function Build {
|
|||
trap {
|
||||
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
|
||||
Write-Error $_
|
||||
Log-Group
|
||||
exit 2
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +40,7 @@ function Build {
|
|||
|
||||
$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
|
||||
|
||||
foreach ($Utility in $UtilityFunctions) {
|
||||
foreach($Utility in $UtilityFunctions) {
|
||||
Write-Debug "Loading $($Utility.FullName)"
|
||||
. $Utility.FullName
|
||||
}
|
||||
|
|
@ -47,66 +49,82 @@ function Build {
|
|||
$ProductName = $BuildSpec.name
|
||||
$ProductVersion = $BuildSpec.version
|
||||
|
||||
$script:DepsVersion = ''
|
||||
$script:QtVersion = '5'
|
||||
$script:VisualStudioVersion = ''
|
||||
$script:PlatformSDK = '10.0.18363.657'
|
||||
|
||||
Setup-Host
|
||||
|
||||
if ( $CmakeGenerator -eq '' ) {
|
||||
$CmakeGenerator = $script:VisualStudioVersion
|
||||
$GitOutput = git describe --tags
|
||||
if ($GitOutput -match '^([0-9]+\.){0,2}(\*|[0-9]+)$') {
|
||||
Log-Information "Using git tag as version identifier '${GitOutput}'"
|
||||
$ProductVersion = $GitOutput
|
||||
} else {
|
||||
Log-Information "Using buildspec.json version identifier '${ProductVersion}'"
|
||||
}
|
||||
|
||||
$DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
|
||||
$DepInstallPath = "$(Resolve-Path -Path ${ProjectRoot}/../obs-build-dependencies/${DepsPath})"
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
|
||||
if ( $ADVSSDepName -eq '' ) {
|
||||
Log-Information "Building advss deps ..."
|
||||
$ADVSSDepName = "advss-build-dependencies"
|
||||
invoke-expression -Command "$PSScriptRoot/Build-Deps-Windows.ps1 -Configuration $Configuration -Target $Target -CMakeGenerator `"$CMakeGenerator`" -OutDirName $ADVSSDepName -SkipDeps -SkipUnpack"
|
||||
$ADVSSDepName = ".deps/advss-build-dependencies"
|
||||
}
|
||||
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../${script:ADVSSDepName})"
|
||||
|
||||
if ( -not (Test-Path -LiteralPath "${ProjectRoot}/${ADVSSDepName}") ) {
|
||||
Log-Information "Building advss deps ${ProjectRoot}/${ADVSSDepName} ..."
|
||||
invoke-expression -Command "$PSScriptRoot/Build-Deps-Windows.ps1 -Configuration $Configuration -Target $Target -OutDirName $ADVSSDepName"
|
||||
}
|
||||
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/${ADVSSDepName})"
|
||||
Log-Information "Using advss deps at $ADVSSDepPath ..."
|
||||
|
||||
(Get-Content -Path ${ProjectRoot}/CMakeLists.txt -Raw) `
|
||||
-replace "project\((.*) VERSION (.*)\)", "project(${ProductName} VERSION ${ProductVersion})" `
|
||||
| Out-File -Path ${ProjectRoot}/CMakeLists.txt -NoNewline
|
||||
|
||||
Setup-Obs
|
||||
|
||||
Push-Location -Stack BuildTemp
|
||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
||||
Ensure-Location $ProjectRoot
|
||||
|
||||
$CmakeArgs = @(
|
||||
'-G', $CmakeGenerator
|
||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||
"-DCMAKE_BUILD_TYPE=${Configuration}"
|
||||
"-DCMAKE_PREFIX_PATH:PATH=${DepInstallPath};${ADVSSDepPath}"
|
||||
"-DQT_VERSION=${script:QtVersion}"
|
||||
)
|
||||
|
||||
Log-Debug "Attempting to configure OBS with CMake arguments: $($CmakeArgs | Out-String)"
|
||||
Log-Information "Configuring ${ProductName}..."
|
||||
Invoke-External cmake -S . -B build_${script:Target} @CmakeArgs
|
||||
|
||||
$CmakeArgs = @(
|
||||
'--config', "${Configuration}"
|
||||
)
|
||||
$CmakeArgs = @()
|
||||
$CmakeBuildArgs = @()
|
||||
$CmakeInstallArgs = @()
|
||||
|
||||
if ( $VerbosePreference -eq 'Continue' ) {
|
||||
$CmakeArgs += ('--verbose')
|
||||
$CmakeBuildArgs += ('--verbose')
|
||||
$CmakeInstallArgs += ('--verbose')
|
||||
}
|
||||
|
||||
Log-Information "Building ${ProductName}..."
|
||||
Invoke-External cmake --build "build_${script:Target}" @CmakeArgs
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$CmakeArgs += ('--debug-output')
|
||||
}
|
||||
|
||||
$Preset = "windows-$(if ( $Env:CI -ne $null ) { 'ci-' })${Target}"
|
||||
|
||||
$CmakeArgs += @(
|
||||
'--preset', $Preset
|
||||
"-DCMAKE_PREFIX_PATH:PATH=${ADVSSDepPath}"
|
||||
)
|
||||
|
||||
$CmakeBuildArgs += @(
|
||||
'--build'
|
||||
'--preset', $Preset
|
||||
'--config', $Configuration
|
||||
'--parallel'
|
||||
'--', '/consoleLoggerParameters:Summary', '/noLogo'
|
||||
)
|
||||
|
||||
$CmakeInstallArgs += @(
|
||||
'--install', "build_${Target}"
|
||||
'--prefix', "${ProjectRoot}/release/${Configuration}"
|
||||
'--config', $Configuration
|
||||
)
|
||||
|
||||
Log-Group "Configuring ${ProductName}..."
|
||||
Invoke-External cmake @CmakeArgs
|
||||
|
||||
Log-Group "Building ${ProductName}..."
|
||||
Invoke-External cmake @CmakeBuildArgs
|
||||
}
|
||||
Log-Information "Install ${ProductName}..."
|
||||
Invoke-External cmake --install "build_${script:Target}" --prefix "${ProjectRoot}/release" @CmakeArgs
|
||||
Log-Group "Install ${ProductName}..."
|
||||
Invoke-External cmake @CmakeInstallArgs
|
||||
|
||||
Pop-Location -Stack BuildTemp
|
||||
Log-Group
|
||||
}
|
||||
|
||||
Build
|
||||
|
|
|
|||
60
.github/scripts/Package-Windows.ps1
vendored
60
.github/scripts/Package-Windows.ps1
vendored
|
|
@ -1,10 +1,11 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo',
|
||||
[ValidateSet('x86', 'x64', 'x86+x64')]
|
||||
[string] $Target,
|
||||
[switch] $BuildInstaller = $false
|
||||
[switch] $BuildInstaller,
|
||||
[switch] $SkipDeps
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
|
@ -14,14 +15,21 @@ if ( $DebugPreference -eq 'Continue' ) {
|
|||
$InformationPreference = 'Continue'
|
||||
}
|
||||
|
||||
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
|
||||
throw "Packaging script requires a 64-bit system to build and run."
|
||||
}
|
||||
|
||||
|
||||
if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
|
||||
Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
|
||||
Write-Warning 'The packaging script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
|
||||
exit 2
|
||||
}
|
||||
|
||||
function Package {
|
||||
trap {
|
||||
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
|
||||
Write-Error $_
|
||||
Log-Group
|
||||
exit 2
|
||||
}
|
||||
|
||||
|
|
@ -38,12 +46,13 @@ function Package {
|
|||
|
||||
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||
$ProductName = $BuildSpec.name
|
||||
$ProductVersion = $BuildSpec.version
|
||||
|
||||
$OutputName = "${ProductName}-windows-${Target}"
|
||||
$OutputName = "${ProductName}-${ProductVersion}-windows-${Target}"
|
||||
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
|
||||
Log-Information "Packaging ${ProductName}..."
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
|
||||
$RemoveArgs = @{
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
|
|
@ -55,19 +64,20 @@ function Package {
|
|||
|
||||
Remove-Item @RemoveArgs
|
||||
|
||||
Log-Group "Archiving ${ProductName}..."
|
||||
$CompressArgs = @{
|
||||
Path = (Get-ChildItem -Path "${ProjectRoot}/release/${Configuration}" -Exclude "${OutputName}*.*")
|
||||
CompressionLevel = 'Optimal'
|
||||
DestinationPath = "${ProjectRoot}/release/${OutputName}.zip"
|
||||
Verbose = ($Env:CI -ne $null)
|
||||
}
|
||||
Compress-Archive -Force @CompressArgs
|
||||
Log-Group
|
||||
|
||||
if ( ( $BuildInstaller ) ) {
|
||||
if ( $Target -eq 'x86+x64' ) {
|
||||
$IsccCandidates = Get-ChildItem -Recurse -Path '*.iss'
|
||||
|
||||
if ( $IsccCandidates.length -gt 0 ) {
|
||||
$IsccFile = $IsccCandidates[0].FullName
|
||||
} else {
|
||||
$IsccFile = ''
|
||||
}
|
||||
} else {
|
||||
$IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.generated.iss"
|
||||
}
|
||||
Log-Group "Packaging ${ProductName}..."
|
||||
|
||||
$IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.generated.iss"
|
||||
if ( ! ( Test-Path -Path $IsccFile ) ) {
|
||||
throw 'InnoSetup install script not found. Run the build script or the CMake build and install procedures first.'
|
||||
}
|
||||
|
|
@ -75,17 +85,13 @@ function Package {
|
|||
Log-Information 'Creating InnoSetup installer...'
|
||||
Push-Location -Stack BuildTemp
|
||||
Ensure-Location -Path "${ProjectRoot}/release"
|
||||
Invoke-External iscc ${IsccFile} /O. /F"${OutputName}-Installer"
|
||||
Copy-Item -Path ${Configuration} -Destination Package -Recurse
|
||||
Invoke-External iscc ${IsccFile} /O"${ProjectRoot}/release" /F"${OutputName}-Installer"
|
||||
Remove-Item -Path Package -Recurse
|
||||
Pop-Location -Stack BuildTemp
|
||||
}
|
||||
|
||||
$CompressArgs = @{
|
||||
Path = (Get-ChildItem -Path "${ProjectRoot}/release" -Exclude "${OutputName}*.*")
|
||||
CompressionLevel = 'Optimal'
|
||||
DestinationPath = "${ProjectRoot}/release/${OutputName}.zip"
|
||||
Log-Group
|
||||
}
|
||||
|
||||
Compress-Archive -Force @CompressArgs
|
||||
}
|
||||
|
||||
Package
|
||||
|
|
|
|||
13
.github/scripts/build-linux.sh
vendored
13
.github/scripts/build-linux.sh
vendored
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if ! type zsh > /dev/null 2>&1; then
|
||||
echo ' => Installing script dependency Zsh.'
|
||||
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install zsh
|
||||
fi
|
||||
|
||||
SCRIPT=$(readlink -f "${0}")
|
||||
SCRIPT_DIR=$(dirname "${SCRIPT}")
|
||||
|
||||
zsh ${SCRIPT_DIR}/build-linux.zsh "${@}"
|
||||
11
.github/scripts/check-changes.sh
vendored
11
.github/scripts/check-changes.sh
vendored
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
dirty=$(git ls-files --modified)
|
||||
|
||||
set +x
|
||||
if [[ $dirty ]]; then
|
||||
echo "================================="
|
||||
echo "Files were not formatted properly"
|
||||
echo "$dirty"
|
||||
echo "================================="
|
||||
exit 1
|
||||
fi
|
||||
53
.github/scripts/check-cmake.sh
vendored
53
.github/scripts/check-cmake.sh
vendored
|
|
@ -1,53 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
if [ ${#} -eq 1 -a "${1}" = "VERBOSE" ]; then
|
||||
VERBOSITY="-l debug"
|
||||
else
|
||||
VERBOSITY=""
|
||||
fi
|
||||
|
||||
if [ "${CI}" ]; then
|
||||
MODE="--check"
|
||||
else
|
||||
MODE="-i"
|
||||
fi
|
||||
|
||||
# Runs the formatter in parallel on the code base.
|
||||
# Return codes:
|
||||
# - 1 there are files to be formatted
|
||||
# - 0 everything looks fine
|
||||
|
||||
# Get CPU count
|
||||
OS=$(uname)
|
||||
NPROC=1
|
||||
if [[ ${OS} = "Linux" ]] ; then
|
||||
NPROC=$(nproc)
|
||||
elif [[ ${OS} = "Darwin" ]] ; then
|
||||
NPROC=$(sysctl -n hw.physicalcpu)
|
||||
fi
|
||||
|
||||
# Discover clang-format
|
||||
if ! type cmake-format 2> /dev/null ; then
|
||||
echo "Required cmake-format not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find . -type d \( \
|
||||
-path ./\*build -o \
|
||||
-path ./deps/jansson -o \
|
||||
-path ./plugins/decklink/\*/decklink-sdk -o \
|
||||
-path ./plugins/enc-amf -o \
|
||||
-path ./plugins/mac-syphon/syphon-framework -o \
|
||||
-path ./plugins/obs-outputs/ftl-sdk -o \
|
||||
-path ./plugins/obs-vst -o \
|
||||
-path ./plugins/obs-browser -o \
|
||||
-path ./plugins/win-dshow/libdshowcapture -o \
|
||||
-path ./plugins/obs-websocket/deps -o \
|
||||
-path ./deps \
|
||||
\) -prune -false -type f -o \
|
||||
-name 'CMakeLists.txt' -or \
|
||||
-name '*.cmake' \
|
||||
| xargs -L10 -P ${NPROC} cmake-format ${MODE} ${VERBOSITY}
|
||||
60
.github/scripts/check-format.sh
vendored
60
.github/scripts/check-format.sh
vendored
|
|
@ -1,60 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Original source https://github.com/Project-OSRM/osrm-backend/blob/master/scripts/format.sh
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
if [ ${#} -eq 1 ]; then
|
||||
VERBOSITY="--verbose"
|
||||
else
|
||||
VERBOSITY=""
|
||||
fi
|
||||
|
||||
# Runs the Clang Formatter in parallel on the code base.
|
||||
# Return codes:
|
||||
# - 1 there are files to be formatted
|
||||
# - 0 everything looks fine
|
||||
|
||||
# Get CPU count
|
||||
OS=$(uname)
|
||||
NPROC=1
|
||||
if [[ ${OS} = "Linux" ]] ; then
|
||||
NPROC=$(nproc)
|
||||
elif [[ ${OS} = "Darwin" ]] ; then
|
||||
NPROC=$(sysctl -n hw.physicalcpu)
|
||||
fi
|
||||
|
||||
# Discover clang-format
|
||||
if type clang-format-13 2> /dev/null ; then
|
||||
CLANG_FORMAT=clang-format-13
|
||||
elif type clang-format 2> /dev/null ; then
|
||||
# Clang format found, but need to check version
|
||||
CLANG_FORMAT=clang-format
|
||||
V=$(clang-format --version)
|
||||
if [[ $V != *"version 13.0"* ]]; then
|
||||
echo "clang-format is not 13.0 (returned ${V})"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "No appropriate clang-format found (expected clang-format-13.0.0, or clang-format)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find . -type d \( \
|
||||
-path ./\*build -o \
|
||||
-path ./cmake -o \
|
||||
-path ./plugins/decklink/\*/decklink-sdk -o \
|
||||
-path ./plugins/enc-amf -o \
|
||||
-path ./plugins/mac-syphon/syphon-framework -o \
|
||||
-path ./plugins/obs-outputs/ftl-sdk -o \
|
||||
-path ./plugins/obs-websocket/deps -o \
|
||||
-path ./deps \
|
||||
\) -prune -false -type f -o \
|
||||
-name '*.h' -or \
|
||||
-name '*.hpp' -or \
|
||||
-name '*.m' -or \
|
||||
-name '*.mm' -or \
|
||||
-name '*.c' -or \
|
||||
-name '*.cpp' \
|
||||
| xargs -L100 -P ${NPROC} "${CLANG_FORMAT}" ${VERBOSITY} -i -style=file -fallback-style=none
|
||||
13
.github/scripts/package-linux.sh
vendored
13
.github/scripts/package-linux.sh
vendored
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if ! type zsh > /dev/null 2>&1; then
|
||||
echo ' => Installing script dependency Zsh.'
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install zsh
|
||||
fi
|
||||
|
||||
SCRIPT=$(readlink -f "${0}")
|
||||
SCRIPT_DIR=$(dirname "${SCRIPT}")
|
||||
|
||||
zsh ${SCRIPT_DIR}/package-linux.zsh "${@}"
|
||||
25
.github/scripts/utils.pwsh/Check-Git.ps1
vendored
25
.github/scripts/utils.pwsh/Check-Git.ps1
vendored
|
|
@ -1,25 +0,0 @@
|
|||
function Check-Git {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Ensures available git executable on host system.
|
||||
.DESCRIPTION
|
||||
Checks whether a git command is available on the host system. If none is found,
|
||||
Git is installed via winget.
|
||||
.EXAMPLE
|
||||
Check-Git
|
||||
#>
|
||||
|
||||
if ( ! ( Test-Path function:Log-Info ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
Log-Information 'Checking for Git executable...'
|
||||
|
||||
if ( ! ( Get-Command git ) ) {
|
||||
Log-Warning 'No Git executable found. Will try to install via winget.'
|
||||
winget install git
|
||||
} else {
|
||||
Log-Debug "Git found at $(Get-Command git)."
|
||||
Log-Status "Git found."
|
||||
}
|
||||
}
|
||||
|
|
@ -17,8 +17,12 @@ function Install-BuildDependencies {
|
|||
if ( ! ( Test-Path function:Log-Warning ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
$Host64Bit = [System.Environment]::Is64BitOperatingSystem
|
||||
|
||||
$Prefixes = @{
|
||||
'x64' = ${Env:ProgramFiles}
|
||||
'x86' = ${Env:ProgramFiles(x86)}
|
||||
'arm64' = ${Env:ProgramFiles(arm)}
|
||||
}
|
||||
|
||||
$Paths = $Env:Path -split [System.IO.Path]::PathSeparator
|
||||
|
||||
|
|
@ -28,14 +32,15 @@ function Install-BuildDependencies {
|
|||
$WingetOptions += '--silent'
|
||||
}
|
||||
|
||||
Log-Group 'Check Windows build requirements'
|
||||
Get-Content $WingetFile | ForEach-Object {
|
||||
$_, $Package, $_, $Path, $_, $Binary = ([regex]::Split($_, " (?=(?:[^']|'[^']*')*$)")) -replace ',', '' -replace "'",''
|
||||
$_, $Package, $_, $Path, $_, $Binary, $_, $Version = $_ -replace ',','' -split " +(?=(?:[^\']*\'[^\']*\')*[^\']*$)" -replace "'",''
|
||||
|
||||
(${Env:ProgramFiles(x86)}, $Env:ProgramFiles) | ForEach-Object {
|
||||
$Prefix = $_
|
||||
$Prefixes.GetEnumerator() | ForEach-Object {
|
||||
$Prefix = $_.value
|
||||
$FullPath = "${Prefix}\${Path}"
|
||||
if ( ( Test-Path $FullPath ) -and ! ( $Paths -contains $FullPath ) ) {
|
||||
$Paths += $FullPath
|
||||
$Paths = @($FullPath) + $Paths
|
||||
$Env:Path = $Paths -join [System.IO.Path]::PathSeparator
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +51,11 @@ function Install-BuildDependencies {
|
|||
if ( $Found ) {
|
||||
Log-Status "Found dependency ${Binary} as $($Found.Source)"
|
||||
} else {
|
||||
Log-Status "Installing package ${Package}"
|
||||
Log-Status "Installing package ${Package} $(if ( $Version -ne $null ) { "Version: ${Version}" } )"
|
||||
|
||||
if ( $Version -ne $null ) {
|
||||
$WingetOptions += @('--version', ${Version})
|
||||
}
|
||||
|
||||
try {
|
||||
$Params = $WingetOptions + $Package
|
||||
|
|
@ -57,4 +66,5 @@ function Install-BuildDependencies {
|
|||
}
|
||||
}
|
||||
}
|
||||
Log-Group
|
||||
}
|
||||
|
|
|
|||
117
.github/scripts/utils.pwsh/Invoke-GitCheckout.ps1
vendored
117
.github/scripts/utils.pwsh/Invoke-GitCheckout.ps1
vendored
|
|
@ -1,117 +0,0 @@
|
|||
function Set-GitConfig {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets a git config value.
|
||||
.DESCRIPTION
|
||||
Allows setting single or multiple config values in a PowerShell-friendly fashion.
|
||||
.EXAMPLE
|
||||
Set-GitConfig advice.detachedHead false
|
||||
#>
|
||||
|
||||
if ( $args.Count -lt 2 ) {
|
||||
throw 'Set-GitConfig called without required arguments <OPTION> <VALUE>.'
|
||||
}
|
||||
|
||||
Invoke-External git config @args
|
||||
}
|
||||
|
||||
function Invoke-GitCheckout {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks out a specified git repository.
|
||||
.DESCRIPTION
|
||||
Wraps the git executable with PowerShell syntax to check out
|
||||
a specified Git repository with a given commit hash and branch,
|
||||
or a GitHub pull request ID.
|
||||
.EXAMPLE
|
||||
Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash"
|
||||
Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash" -Branch "main"
|
||||
Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash" -PullRequest 250
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Uri,
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Commit,
|
||||
[string] $Path,
|
||||
[string] $Branch = "master",
|
||||
[string] $PullRequest
|
||||
)
|
||||
|
||||
if ( ! ( $Uri -like "*github.com*" ) -and ( $PullRequest -ne "" ) ) {
|
||||
throw 'Fetching pull requests is only supported with GitHub-based repositories.'
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Log-Information ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Invoke-External ) ) {
|
||||
. $PSScriptRoot/Invoke-External.ps1
|
||||
}
|
||||
|
||||
$RepositoryName = [System.IO.Path]::GetFileNameWithoutExtension($Uri)
|
||||
|
||||
if ( $Path -eq "" ) {
|
||||
$Path = "$(Get-Location | Convert-Path)\${RepositoryName}"
|
||||
}
|
||||
|
||||
Push-Location -Stack GitCheckoutTemp
|
||||
|
||||
if ( Test-Path $Path/.git ) {
|
||||
Write-Information "Repository ${RepositoryName} found in ${Path}"
|
||||
|
||||
Set-Location $Path
|
||||
|
||||
Set-GitConfig advice.detachedHead false
|
||||
Set-GitConfig remote.origin.url $Uri
|
||||
Set-GitConfig remote.origin.tapOpt --no-tags
|
||||
|
||||
$Ref = "+refs/heads/{0}:refs/remotes/origin/{0}" -f $Branch
|
||||
|
||||
Set-GitConfig --replace-all remote.origin.fetch $Ref
|
||||
|
||||
if ( $PullRequest -ne "" ) {
|
||||
try {
|
||||
Invoke-External git show-ref --quiet --verify refs/heads/pr-$PullRequest
|
||||
} catch {
|
||||
Invoke-External git fetch origin $("pull/{0}/head:pull-{0}" -f $PullRequest)
|
||||
} finally {
|
||||
Invoke-External git checkout -f "pull-${PullRequest}"
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$null = Invoke-External git rev-parse -q --verify "${Commit}^{commit}"
|
||||
} catch {
|
||||
Invoke-External git fetch origin
|
||||
}
|
||||
|
||||
Invoke-External git checkout -f $Commit -- | Log-Information
|
||||
} else {
|
||||
Invoke-External git clone $Uri $Path
|
||||
|
||||
Set-Location $Path
|
||||
|
||||
Set-GitConfig advice.detachedHead false
|
||||
|
||||
if ( $PullRequest -ne "" ) {
|
||||
$Ref = "pull/{0}/head:pull-{0}" -f $PullRequest
|
||||
$Branch = "pull-${PullRequest}"
|
||||
Invoke-External git fetch origin $Ref
|
||||
Invoke-External git checkout $Branch
|
||||
}
|
||||
|
||||
Invoke-External git checkout -f $Commit
|
||||
}
|
||||
|
||||
Log-Information "Checked out commit ${Commit} on branch ${Branch}"
|
||||
|
||||
if ( Test-Path ${Path}/.gitmodules ) {
|
||||
Invoke-External git submodule foreach --recursive git submodule sync
|
||||
Invoke-External git submodule update --init --recursive
|
||||
}
|
||||
|
||||
Pop-Location -Stack GitCheckoutTemp
|
||||
}
|
||||
32
.github/scripts/utils.pwsh/Logger.ps1
vendored
32
.github/scripts/utils.pwsh/Logger.ps1
vendored
|
|
@ -8,7 +8,7 @@ function Log-Debug {
|
|||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Debug $m
|
||||
Write-Debug "$(if ( $env:CI -ne $null ) { '::debug::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ function Log-Warning {
|
|||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Warning $m
|
||||
Write-Warning "$(if ( $env:CI -ne $null ) { '::warning::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ function Log-Error {
|
|||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Error $m
|
||||
Write-Error "$(if ( $env:CI -ne $null ) { '::error::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +79,32 @@ function Log-Information {
|
|||
}
|
||||
}
|
||||
|
||||
function Log-Group {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(ValueFromPipeline)]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( $Env:CI -ne $null ) {
|
||||
if ( $script:LogGroup ) {
|
||||
Write-Output '::endgroup::'
|
||||
$script:LogGroup = $false
|
||||
}
|
||||
|
||||
if ( $Message.count -ge 1 ) {
|
||||
Write-Output "::group::$($Message -join ' ')"
|
||||
$script:LogGroup = $true
|
||||
}
|
||||
} else {
|
||||
if ( $Message.count -ge 1 ) {
|
||||
Log-Information $Message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Status {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
|
|
|
|||
103
.github/scripts/utils.pwsh/Setup-Host.ps1
vendored
103
.github/scripts/utils.pwsh/Setup-Host.ps1
vendored
|
|
@ -1,103 +0,0 @@
|
|||
function Setup-Host {
|
||||
if ( ! ( Test-Path function:Log-Output ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Ensure-Location ) ) {
|
||||
. $PSScriptRoot/Ensure-Location.ps1
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Install-BuildDependencies ) ) {
|
||||
. $PSScriptRoot/Install-BuildDependencies.ps1
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Expand-ArchiveExt ) ) {
|
||||
. $PSScriptRoot/Expand-ArchiveExt.ps1
|
||||
}
|
||||
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
|
||||
if ( $script:Target -eq '' ) { $script:Target = $script:HostArchitecture }
|
||||
|
||||
$script:QtVersion = $BuildSpec.platformConfig."windows-${script:Target}".qtVersion
|
||||
$script:VisualStudioVersion = $BuildSpec.platformConfig."windows-${script:Target}".visualStudio
|
||||
$script:PlatformSDK = $BuildSpec.platformConfig."windows-${script:Target}".platformSDK
|
||||
|
||||
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipDeps ) ) ) {
|
||||
('prebuilt', "qt${script:QtVersion}") | ForEach-Object {
|
||||
$_Dependency = $_
|
||||
$_Version = $BuildSpec.dependencies."${_Dependency}".version
|
||||
$_BaseUrl = $BuildSpec.dependencies."${_Dependency}".baseUrl
|
||||
$_Label = $BuildSpec.dependencies."${_Dependency}".label
|
||||
$_Hash = $BuildSpec.dependencies."${_Dependency}".hashes."windows-${script:Target}"
|
||||
|
||||
if ( $BuildSpec.dependencies."${_Dependency}".PSobject.Properties.Name -contains "pdb-hashes" ) {
|
||||
$_PdbHash = $BuildSpec.dependencies."${_Dependency}".'pdb-hashes'."$windows-${script:Target}"
|
||||
}
|
||||
|
||||
if ( $_Version -eq '' ) {
|
||||
throw "No ${_Dependency} spec found in ${script:BuildSpecFile}."
|
||||
}
|
||||
|
||||
Log-Information "Setting up ${_Label}..."
|
||||
|
||||
Push-Location -Stack BuildTemp
|
||||
Ensure-Location -Path "$(Resolve-Path -Path "${ProjectRoot}/..")/obs-build-dependencies"
|
||||
|
||||
switch -wildcard ( $_Dependency ) {
|
||||
prebuilt {
|
||||
$_Filename = "windows-deps-${_Version}-${script:Target}.zip"
|
||||
$_Uri = "${_BaseUrl}/${_Version}/${_Filename}"
|
||||
$_Target = "plugin-deps-${_Version}-qt${script:QtVersion}-${script:Target}"
|
||||
$script:DepsVersion = ${_Version}
|
||||
}
|
||||
"qt*" {
|
||||
$_Filename = "windows-deps-qt${script:QtVersion}-${_Version}-${script:Target}.zip"
|
||||
$_Uri = "${_BaseUrl}/${_Version}/${_Filename}"
|
||||
$_Target = "plugin-deps-${_Version}-qt${script:QtVersion}-${script:Target}"
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path -Path $_Filename ) ) {
|
||||
$Params = @{
|
||||
UserAgent = 'NativeHost'
|
||||
Uri = $_Uri
|
||||
OutFile = $_Filename
|
||||
UseBasicParsing = $true
|
||||
ErrorAction = 'Stop'
|
||||
}
|
||||
|
||||
Invoke-WebRequest @Params
|
||||
Log-Status "Downloaded ${_Label} for ${script:Target}."
|
||||
} else {
|
||||
Log-Status "Found downloaded ${_Label}."
|
||||
}
|
||||
|
||||
$_FileHash = Get-FileHash -Path $_Filename -Algorithm SHA256
|
||||
|
||||
if ( $_FileHash.Hash.ToLower() -ne $_Hash ) {
|
||||
throw "Checksum of downloaded ${_Label} does not match specification. Expected '${_Hash}', 'found $(${_FileHash}.Hash.ToLower())'"
|
||||
}
|
||||
Log-Status "Checksum of downloaded ${_Label} matches."
|
||||
|
||||
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipUnpack ) ) ) {
|
||||
Push-Location -Stack BuildTemp
|
||||
Ensure-Location -Path $_Target
|
||||
|
||||
Expand-ArchiveExt -Path "../${_Filename}" -DestinationPath . -Force
|
||||
|
||||
Pop-Location -Stack BuildTemp
|
||||
}
|
||||
Pop-Location -Stack BuildTemp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-HostArchitecture {
|
||||
$Host64Bit = [System.Environment]::Is64BitOperatingSystem
|
||||
$HostArchitecture = ('x86', 'x64')[$Host64Bit]
|
||||
|
||||
return $HostArchitecture
|
||||
}
|
||||
|
||||
$script:HostArchitecture = Get-HostArchitecture
|
||||
84
.github/scripts/utils.pwsh/Setup-Obs.ps1
vendored
84
.github/scripts/utils.pwsh/Setup-Obs.ps1
vendored
|
|
@ -1,84 +0,0 @@
|
|||
function Setup-Obs {
|
||||
if ( ! ( Test-Path function:Log-Output ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Check-Git ) ) {
|
||||
. $PSScriptRoot/Check-Git.ps1
|
||||
}
|
||||
|
||||
Check-Git
|
||||
|
||||
if ( ! ( Test-Path function:Ensure-Location ) ) {
|
||||
. $PSScriptRoot/Ensure-Location.ps1
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Invoke-GitCheckout ) ) {
|
||||
. $PSScriptRoot/Invoke-GitCheckout.ps1
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Invoke-External ) ) {
|
||||
. $PSScriptRoot/Invoke-External.ps1
|
||||
}
|
||||
|
||||
Log-Information 'Setting up OBS Studio...'
|
||||
|
||||
$ObsVersion = $BuildSpec.dependencies.'obs-studio'.version
|
||||
$ObsRepository = $BuildSpec.dependencies.'obs-studio'.repository
|
||||
$ObsBranch = $BuildSpec.dependencies.'obs-studio'.branch
|
||||
$ObsHash = $BuildSpec.dependencies.'obs-studio'.hash
|
||||
|
||||
if ( $ObsVersion -eq '' ) {
|
||||
throw 'No obs-studio version found in buildspec.json.'
|
||||
}
|
||||
|
||||
Push-Location -Stack BuildTemp
|
||||
Ensure-Location -Path "$(Resolve-Path -Path "${ProjectRoot}/../")/obs-studio"
|
||||
|
||||
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipUnpack ) ) ) {
|
||||
Invoke-GitCheckout -Uri $ObsRepository -Commit $ObsHash -Path . -Branch $ObsBranch
|
||||
}
|
||||
|
||||
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipBuild ) ) ) {
|
||||
Log-Information 'Configuring OBS Studio...'
|
||||
|
||||
$NumProcessors = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
|
||||
|
||||
if ( $NumProcessors -gt 1 ) {
|
||||
$env:UseMultiToolTask = $true
|
||||
$env:EnforceProcessCountAcrossBuilds = $true
|
||||
}
|
||||
|
||||
$DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
|
||||
|
||||
$CmakeArgs = @(
|
||||
'-G', $CmakeGenerator
|
||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||
"-DCMAKE_BUILD_TYPE=${script:Configuration}"
|
||||
"-DQT_VERSION=${script:QtVersion}"
|
||||
'-DENABLE_PLUGINS=OFF'
|
||||
'-DENABLE_UI=OFF'
|
||||
'-DENABLE_SCRIPTING=OFF'
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=$(Resolve-Path -Path "${ProjectRoot}/../obs-build-dependencies/${DepsPath}")"
|
||||
"-DCMAKE_PREFIX_PATH:PATH=$(Resolve-Path -Path "${ProjectRoot}/../obs-build-dependencies/${DepsPath}")"
|
||||
)
|
||||
|
||||
Log-Debug "Attempting to configure OBS with CMake arguments: $($CmakeArgs | Out-String)"
|
||||
Log-Information "Configuring OBS..."
|
||||
Invoke-External cmake -S . -B plugin_build_${script:Target} @CmakeArgs
|
||||
|
||||
Log-Information 'Building libobs and obs-frontend-api...'
|
||||
$CmakeArgs = @(
|
||||
'--config', "$( if ( $script:Configuration -eq '' ) { 'RelWithDebInfo' } else { $script:Configuration })"
|
||||
)
|
||||
|
||||
if ( $VerbosePreference -eq 'Continue' ) {
|
||||
$CmakeArgs+=('--verbose')
|
||||
}
|
||||
|
||||
Invoke-External cmake --build plugin_build_${script:Target} @CmakeArgs -t obs-frontend-api
|
||||
Invoke-External cmake --install plugin_build_${script:Target} @CmakeArgs --component obs_libraries
|
||||
}
|
||||
Pop-Location -Stack BuildTemp
|
||||
}
|
||||
37
.github/scripts/utils.zsh/check_linux
vendored
Executable file → Normal file
37
.github/scripts/utils.zsh/check_linux
vendored
Executable file → Normal file
|
|
@ -1,4 +1,20 @@
|
|||
autoload -Uz log_info log_status log_error log_debug log_warning
|
||||
autoload -Uz log_info log_status log_error log_debug log_warning log_group
|
||||
|
||||
log_group 'Check Linux build requirements'
|
||||
log_debug 'Checking Linux distribution name and version...'
|
||||
|
||||
# Check for Ubuntu version 22.10 or later, which have srt and librist available via apt-get
|
||||
typeset -g -i UBUNTU_2210_OR_LATER=0
|
||||
if [[ -f /etc/os_release ]] {
|
||||
local dist_name
|
||||
local dist_version
|
||||
read -r dist_name dist_version <<< "$(source /etc/os_release; print "${NAME} ${VERSION_ID}")"
|
||||
|
||||
autoload -Uz is-at-least
|
||||
if [[ ${dist_name} == Ubuntu ]] && is-at-least 22.10 ${dist_version}; then
|
||||
typeset -g -i UBUNTU_2210_OR_LATER=1
|
||||
fi
|
||||
}
|
||||
|
||||
log_debug 'Checking for apt-get...'
|
||||
if (( ! ${+commands[apt-get]} )) {
|
||||
|
|
@ -8,12 +24,14 @@ if (( ! ${+commands[apt-get]} )) {
|
|||
log_debug "Apt-get located at ${commands[apt-get]}"
|
||||
}
|
||||
|
||||
local -a dependencies=("${(f)$(<${SCRIPT_HOME}/.Aptfile)}")
|
||||
local -a dependencies=("${(fA)$(<${SCRIPT_HOME}/.Aptfile)}")
|
||||
local -a install_list
|
||||
local binary
|
||||
|
||||
sudo apt-get update -qq
|
||||
|
||||
for dependency (${dependencies}) {
|
||||
local -a tokens=(${(s: :)dependency//(,|:|\')/})
|
||||
local -a tokens=(${=dependency//(,|:|\')/})
|
||||
|
||||
if [[ ! ${tokens[1]} == 'package' ]] continue
|
||||
|
||||
|
|
@ -26,11 +44,18 @@ for dependency (${dependencies}) {
|
|||
if (( ! ${+commands[${binary}]} )) install_list+=(${tokens[2]})
|
||||
}
|
||||
|
||||
local -a _quiet=('' '--quiet')
|
||||
|
||||
log_debug "List of dependencies to install: ${install_list}"
|
||||
if (( ${#install_list} )) {
|
||||
if (( ! ${+CI} )) log_warning 'Dependency installation via apt may require elevated privileges'
|
||||
|
||||
sudo apt-get -y install ${install_list} ${_quiet[(( (_loglevel == 0) + 1 ))]}
|
||||
local -a apt_args=(
|
||||
${CI:+-y}
|
||||
--no-install-recommends
|
||||
)
|
||||
if (( _loglevel == 0 )) apt_args+=(--quiet)
|
||||
|
||||
sudo apt-get ${apt_args} install ${install_list}
|
||||
}
|
||||
|
||||
rehash
|
||||
log_group
|
||||
|
|
|
|||
8
.github/scripts/utils.zsh/check_macos
vendored
Executable file → Normal file
8
.github/scripts/utils.zsh/check_macos
vendored
Executable file → Normal file
|
|
@ -1,9 +1,10 @@
|
|||
autoload -Uz is-at-least log_info log_error log_status read_codesign
|
||||
autoload -Uz is-at-least log_group log_info log_error log_status read_codesign
|
||||
|
||||
local macos_version=$(sw_vers -productVersion)
|
||||
|
||||
log_group 'Install macOS build requirements'
|
||||
log_info 'Checking macOS version...'
|
||||
if ! is-at-least 11.0 "${macos_version}"; then
|
||||
if ! is-at-least 11.0 ${macos_version}; then
|
||||
log_error "Minimum required macOS version is 11.0, but running on macOS ${macos_version}"
|
||||
return 2
|
||||
else
|
||||
|
|
@ -16,5 +17,6 @@ if (( ! ${+commands[brew]} )) {
|
|||
return 2
|
||||
}
|
||||
|
||||
brew bundle --file "${SCRIPT_HOME}/.Brewfile"
|
||||
brew bundle --file ${SCRIPT_HOME}/.Brewfile
|
||||
rehash
|
||||
log_group
|
||||
|
|
|
|||
52
.github/scripts/utils.zsh/check_packages
vendored
52
.github/scripts/utils.zsh/check_packages
vendored
|
|
@ -1,52 +0,0 @@
|
|||
if (( ! ${+commands[packagesbuild]} )) {
|
||||
autoload -Uz log_info log_status mkcd
|
||||
|
||||
if (( ! ${+commands[curl]} )) {
|
||||
log_error 'curl not found. Please install curl.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+project_root} )) {
|
||||
log_error "'project_root' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
local -a curl_opts=()
|
||||
if (( ! ${+CI} )) {
|
||||
curl_opts+=(--progress-bar)
|
||||
} else {
|
||||
curl_opts+=(--show-error --silent)
|
||||
}
|
||||
curl_opts+=(--location -O ${@})
|
||||
|
||||
log_info 'Installing Packages.app...'
|
||||
|
||||
pushd
|
||||
mkcd ${project_root:h}/obs-build-dependencies
|
||||
|
||||
local packages_url='https://web.archive.org/web/20230727054218/http://s.sudre.free.fr/Software/files/Packages.dmg'
|
||||
local packages_hash='6afdd25386295974dad8f078b8f1e41cabebd08e72d970bf92f707c7e48b16c9'
|
||||
|
||||
if [[ ! -f Packages.dmg ]] {
|
||||
log_status 'Download Packages.app'
|
||||
curl ${curl_opts} ${packages_url}
|
||||
}
|
||||
|
||||
local image_checksum
|
||||
read -r image_checksum _ <<< "$(sha256sum Packages.dmg)"
|
||||
|
||||
if [[ ${packages_hash} != ${image_checksum} ]] {
|
||||
log_error "Checksum mismatch of Packages.app download.
|
||||
Expected : ${packages_hash}
|
||||
Actual : ${image_checksum}"
|
||||
return 2
|
||||
}
|
||||
|
||||
hdiutil attach -noverify Packages.dmg &> /dev/null && log_status 'Packages.dmg image mounted.'
|
||||
|
||||
log_info 'Installing Packages.app...'
|
||||
packages_volume=$(hdiutil info -plist | grep '<string>/Volumes/Packages' | sed 's/.*<string>\(\/Volumes\/[^<]*\)<\/string>/\1/')
|
||||
|
||||
sudo installer -pkg "${packages_volume}/packages/Packages.pkg" -target / && rehash
|
||||
hdiutil detach ${packages_volume} &> /dev/null && log_status 'Packages.dmg image unmounted.'
|
||||
}
|
||||
2
.github/scripts/utils.zsh/log_debug
vendored
Executable file → Normal file
2
.github/scripts/utils.zsh/log_debug
vendored
Executable file → Normal file
|
|
@ -1,3 +1,3 @@
|
|||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 2 )) print -PR -e -- "%F{220}DEBUG: ${@}%f"
|
||||
if (( _loglevel > 2 )) print -PR -e -- "${CI:+::debug::}%F{220}DEBUG: ${@}%f"
|
||||
|
|
|
|||
2
.github/scripts/utils.zsh/log_error
vendored
Executable file → Normal file
2
.github/scripts/utils.zsh/log_error
vendored
Executable file → Normal file
|
|
@ -1,3 +1,3 @@
|
|||
local icon=' ✖︎ '
|
||||
|
||||
print -u2 -PR "%F{1} ${icon} %f ${@}"
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ${icon} %f ${@}"
|
||||
|
|
|
|||
16
.github/scripts/utils.zsh/log_group
vendored
Normal file
16
.github/scripts/utils.zsh/log_group
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
autoload -Uz log_info
|
||||
|
||||
if (( ! ${+_log_group} )) typeset -g _log_group=0
|
||||
|
||||
if (( ${+CI} )) {
|
||||
if (( _log_group )) {
|
||||
print "::endgroup::"
|
||||
typeset -g _log_group=0
|
||||
}
|
||||
if (( # )) {
|
||||
print "::group::${@}"
|
||||
typeset -g _log_group=1
|
||||
}
|
||||
} else {
|
||||
if (( # )) log_info ${@}
|
||||
}
|
||||
0
.github/scripts/utils.zsh/log_info
vendored
Executable file → Normal file
0
.github/scripts/utils.zsh/log_info
vendored
Executable file → Normal file
0
.github/scripts/utils.zsh/log_output
vendored
Executable file → Normal file
0
.github/scripts/utils.zsh/log_output
vendored
Executable file → Normal file
0
.github/scripts/utils.zsh/log_status
vendored
Executable file → Normal file
0
.github/scripts/utils.zsh/log_status
vendored
Executable file → Normal file
2
.github/scripts/utils.zsh/log_warning
vendored
Executable file → Normal file
2
.github/scripts/utils.zsh/log_warning
vendored
Executable file → Normal file
|
|
@ -1,5 +1,5 @@
|
|||
if (( _loglevel > 0 )) {
|
||||
local icon=' =>'
|
||||
|
||||
print -PR "%F{3} ${(r:5:)icon} ${@}%f"
|
||||
print -PR "${CI:+::warning::}%F{3} ${(r:5:)icon} ${@}%f"
|
||||
}
|
||||
|
|
|
|||
0
.github/scripts/utils.zsh/mkcd
vendored
Executable file → Normal file
0
.github/scripts/utils.zsh/mkcd
vendored
Executable file → Normal file
4
.github/scripts/utils.zsh/read_codesign
vendored
Executable file → Normal file
4
.github/scripts/utils.zsh/read_codesign
vendored
Executable file → Normal file
|
|
@ -2,6 +2,8 @@ autoload -Uz log_info
|
|||
|
||||
if (( ! ${+CODESIGN_IDENT} )) {
|
||||
typeset -g CODESIGN_IDENT
|
||||
log_info 'Setting up identity for application codesigning...'
|
||||
log_info 'Setting up Apple Developer ID for application codesigning...'
|
||||
read CODESIGN_IDENT'?Apple Developer Application ID: '
|
||||
}
|
||||
|
||||
typeset -g CODESIGN_TEAM=$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')
|
||||
|
|
|
|||
2
.github/scripts/utils.zsh/read_codesign_installer
vendored
Executable file → Normal file
2
.github/scripts/utils.zsh/read_codesign_installer
vendored
Executable file → Normal file
|
|
@ -2,6 +2,6 @@ autoload -Uz log_info
|
|||
|
||||
if (( ! ${+CODESIGN_IDENT_INSTALLER} )) {
|
||||
typeset -g CODESIGN_IDENT_INSTALLER
|
||||
log_info 'Setting up identity for installer package codesigning...'
|
||||
log_info 'Setting up Apple Developer Installer ID for installer package codesigning...'
|
||||
read CODESIGN_IDENT_INSTALLER'?Apple Developer Installer ID: '
|
||||
}
|
||||
|
|
|
|||
13
.github/scripts/utils.zsh/read_codesign_pass
vendored
Executable file → Normal file
13
.github/scripts/utils.zsh/read_codesign_pass
vendored
Executable file → Normal file
|
|
@ -11,14 +11,12 @@
|
|||
# 'OBS-Codesign-Password'with access Apple's 'altool' only.
|
||||
##############################################################################
|
||||
|
||||
autoload -Uz read_codesign read_codesign_user log_info
|
||||
autoload -Uz read_codesign read_codesign_user log_info log_warning
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT} )) {
|
||||
read_codesign
|
||||
}
|
||||
|
||||
local codesign_ident_short=$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT_USER} )) {
|
||||
read_codesign_user
|
||||
}
|
||||
|
|
@ -30,4 +28,11 @@ if (( ! ${+CODESIGN_IDENT_PASS} )) {
|
|||
|
||||
print ''
|
||||
log_info 'Setting up notarization keychain...'
|
||||
xcrun notarytool store-credentials 'OBS-Codesign-Password' --apple-id "${CODESIGN_IDENT_USER}" --team-id "${codesign_ident_short}" --password "${CODESIGN_IDENT_PASS}"
|
||||
log_warning "
|
||||
+ Your Apple ID and an app-specific password is necessary for notarization from CLI
|
||||
+ This password will be stored in your macOS keychain under the identifier
|
||||
'OBS-Codesign-Password' with access Apple's 'altool' only.
|
||||
|
||||
"
|
||||
xcrun notarytool store-credentials 'OBS-Codesign-Password' --apple-id "${CODESIGN_IDENT_USER}" --team-id "${CODESIGN_TEAM}" --password "${CODESIGN_IDENT_PASS}"
|
||||
|
||||
|
|
|
|||
7
.github/scripts/utils.zsh/read_codesign_team
vendored
Normal file
7
.github/scripts/utils.zsh/read_codesign_team
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
autoload -Uz log_info
|
||||
|
||||
if (( ! ${+CODESIGN_TEAM} )) {
|
||||
typeset -g CODESIGN_TEAM
|
||||
log_info 'Setting up Apple Developer Team ID for codesigning...'
|
||||
read CODESIGN_TEAM'?Apple Developer Team ID (leave empty to use Apple Developer ID instead): '
|
||||
}
|
||||
4
.github/scripts/utils.zsh/read_codesign_user
vendored
Executable file → Normal file
4
.github/scripts/utils.zsh/read_codesign_user
vendored
Executable file → Normal file
|
|
@ -2,6 +2,6 @@ autoload -Uz log_info
|
|||
|
||||
if (( ! ${+CODESIGN_IDENT_USER} )) {
|
||||
typeset -g CODESIGN_IDENT_USER
|
||||
log_info 'Setting up developer id for codesigning...'
|
||||
read CODESIGN_IDENT_USER'?Apple Developer ID: '
|
||||
log_info 'Setting up Apple ID for notarization...'
|
||||
read CODESIGN_IDENT_USER'?Apple ID: '
|
||||
}
|
||||
|
|
|
|||
0
.github/scripts/utils.zsh/set_loglevel
vendored
Executable file → Normal file
0
.github/scripts/utils.zsh/set_loglevel
vendored
Executable file → Normal file
32
.github/scripts/utils.zsh/setup_ccache
vendored
Executable file → Normal file
32
.github/scripts/utils.zsh/setup_ccache
vendored
Executable file → Normal file
|
|
@ -1,12 +1,40 @@
|
|||
autoload -Uz log_debug log_warning
|
||||
|
||||
if (( ! ${+project_root} )) {
|
||||
log_error "'project_root' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ${+commands[ccache]} )) {
|
||||
log_debug "Found ccache at ${commands[ccache]}"
|
||||
|
||||
typeset -gx CCACHE_CONFIGPATH="${project_root}/.ccache.conf"
|
||||
|
||||
ccache --set-config=run_second_cpp=true
|
||||
ccache --set-config=direct_mode=true
|
||||
ccache --set-config=inode_cache=true
|
||||
ccache --set-config=compiler_check=content
|
||||
ccache --set-config=file_clone=true
|
||||
|
||||
local -a sloppiness=(
|
||||
include_file_mtime
|
||||
include_file_ctime
|
||||
file_stat_matches
|
||||
system_headers
|
||||
)
|
||||
|
||||
if [[ ${host_os} == macos ]] {
|
||||
sloppiness+=(
|
||||
modules
|
||||
clang_index_store
|
||||
)
|
||||
|
||||
ccache --set-config=sloppiness=${(j:,:)sloppiness}
|
||||
}
|
||||
|
||||
if (( ${+CI} )) {
|
||||
ccache --set-config=cache_dir="${GITHUB_WORKSPACE:-${HOME}}/.ccache"
|
||||
ccache --set-config=max_size="${CCACHE_SIZE:-500M}"
|
||||
ccache --set-config=compression=true
|
||||
ccache --set-config=max_size="${CCACHE_SIZE:-1G}"
|
||||
ccache -z > /dev/null
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
69
.github/scripts/utils.zsh/setup_linux
vendored
Executable file → Normal file
69
.github/scripts/utils.zsh/setup_linux
vendored
Executable file → Normal file
|
|
@ -13,52 +13,53 @@ if (( ! ${+target} )) {
|
|||
pushd ${project_root}
|
||||
|
||||
typeset -g QT_VERSION
|
||||
read -r QT_VERSION <<< \
|
||||
"$(jq -r --arg target "${target}" \
|
||||
'.platformConfig[$target] | { qtVersion } | join(" ")' \
|
||||
${project_root}/buildspec.json)"
|
||||
|
||||
local -a apt_args=(
|
||||
${CI:+-y}
|
||||
--no-install-recommends
|
||||
)
|
||||
if (( _loglevel == 0 )) apt_args+=(--quiet)
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
log_info 'Installing obs build dependencies...'
|
||||
log_group 'Installing obs-studio build dependencies...'
|
||||
|
||||
sudo apt-get install -y \
|
||||
local suffix
|
||||
if [[ ${CPUTYPE} != "${target##*-}" ]] {
|
||||
local -A arch_mappings=(
|
||||
aarch64 arm64
|
||||
x86_64 amd64
|
||||
)
|
||||
|
||||
suffix=":${arch_mappings[${target##*-}]}"
|
||||
|
||||
sudo apt-get install ${apt_args} gcc-${${target##*-}//_/-}-linux-gnu g++-${${target##*-}//_/-}-linux-gnu
|
||||
}
|
||||
|
||||
sudo add-apt-repository --yes ppa:obsproject/obs-studio
|
||||
sudo apt update
|
||||
|
||||
sudo apt-get install ${apt_args} \
|
||||
build-essential \
|
||||
libcurl4-openssl-dev \
|
||||
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \
|
||||
libswresample-dev libswscale-dev \
|
||||
libjansson-dev \
|
||||
libx11-xcb-dev \
|
||||
libgles2-mesa-dev \
|
||||
libwayland-dev \
|
||||
libpulse-dev
|
||||
|
||||
log_info 'Installing obs plugin dependencies...'
|
||||
obs-studio
|
||||
|
||||
local -a _qt_packages=()
|
||||
|
||||
if (( QT_VERSION == 5 )) {
|
||||
_qt_packages+=(
|
||||
qtbase5-dev
|
||||
libqt5svg5-dev
|
||||
qtbase5-private-dev
|
||||
libqt5x11extras5-dev
|
||||
)
|
||||
} elif (( QT_VERSION == 6 )) {
|
||||
_qt_packages+=(
|
||||
qt6-base-dev
|
||||
libqt6svg6-dev
|
||||
qt6-base-private-dev
|
||||
qtbase5-dev${suffix}
|
||||
libqt5svg5-dev${suffix}
|
||||
qtbase5-private-dev${suffix}
|
||||
libqt5x11extras5-dev${suffix}
|
||||
)
|
||||
} else {
|
||||
log_error "Unsupported Qt version '${QT_VERSION}' specified."
|
||||
return 2
|
||||
_qt_packages+=(
|
||||
qt6-base-dev${suffix}
|
||||
libqt6svg6-dev${suffix}
|
||||
qt6-base-private-dev${suffix}
|
||||
)
|
||||
}
|
||||
|
||||
sudo apt-get install -y ${_qt_packages}
|
||||
sudo apt-get install ${apt_args} ${_qt_packages}
|
||||
log_group
|
||||
}
|
||||
|
||||
local deps_version
|
||||
read -r deps_version <<< \
|
||||
"$(jq -r '.dependencies.prebuilt.version' ${buildspec_file})"
|
||||
|
||||
typeset -g OBS_DEPS_VERSION=${deps_version}
|
||||
|
|
|
|||
127
.github/scripts/utils.zsh/setup_macos
vendored
127
.github/scripts/utils.zsh/setup_macos
vendored
|
|
@ -1,127 +0,0 @@
|
|||
autoload -Uz log_error log_status log_info mkcd
|
||||
|
||||
if (( ! ${+commands[curl]} )) {
|
||||
log_error 'curl not found. Please install curl.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+commands[jq]} )) {
|
||||
log_error 'jq not found. Please install jq.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+project_root} )) {
|
||||
log_error "'project_root' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+target} )) {
|
||||
log_error "'target' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
local -a curl_opts=()
|
||||
if (( ! ${+CI} )) {
|
||||
curl_opts+=(--progress-bar)
|
||||
} else {
|
||||
curl_opts+=(--show-error --silent)
|
||||
}
|
||||
curl_opts+=(--location -O ${@})
|
||||
|
||||
pushd ${project_root}
|
||||
|
||||
local _qt_version
|
||||
local _deployment_target
|
||||
read -r _qt_version _deployment_target <<< \
|
||||
"$(jq -r --arg target "${target}" \
|
||||
'.platformConfig[$target] | { qtVersion, deploymentTarget } | join (" ")' \
|
||||
${buildspec_file})"
|
||||
|
||||
typeset -g QT_VERSION=${_qt_version}
|
||||
typeset -g DEPLOYMENT_TARGET=${_deployment_target}
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
mkdir -p ${project_root:h}/obs-build-dependencies
|
||||
|
||||
local dependency
|
||||
local deps_version
|
||||
local deps_baseurl
|
||||
local deps_label
|
||||
local deps_hash
|
||||
local _filename
|
||||
local _url
|
||||
local _target
|
||||
local artifact_checksum
|
||||
|
||||
for dependency ('prebuilt' "qt${QT_VERSION}") {
|
||||
IFS=';' read -r deps_version deps_baseurl deps_label deps_hash <<< \
|
||||
"$(jq -r --arg dependency "${dependency}" --arg target "${target}" \
|
||||
'.dependencies[$dependency] | {version, baseUrl, "label", "hash": .hashes[$target]} | join(";")' \
|
||||
${buildspec_file})"
|
||||
|
||||
if [[ -z "${deps_version}" ]] {
|
||||
log_error "No ${dependency} spec found in ${buildspec_file}."
|
||||
return 2
|
||||
}
|
||||
log_info "Setting up ${deps_label}..."
|
||||
|
||||
pushd ${project_root:h}/obs-build-dependencies
|
||||
|
||||
case ${dependency} {
|
||||
prebuilt)
|
||||
_filename="macos-deps-${deps_version}-${target##*-}.tar.xz"
|
||||
_url="${deps_baseurl}/${deps_version}/${_filename}"
|
||||
_target="plugin-deps-${deps_version}-qt${QT_VERSION}-${target##*-}"
|
||||
typeset -g OBS_DEPS_VERSION=${deps_version}
|
||||
;;
|
||||
qt*)
|
||||
if (( ${+CI} )) {
|
||||
_filename="macos-deps-qt${QT_VERSION}-${deps_version}-universal.tar.xz"
|
||||
deps_hash="$(jq -r --arg dependency "${dependency}" \
|
||||
'.dependencies[$dependency].hashes["macos-universal"]' \
|
||||
${buildspec_file})"
|
||||
} else {
|
||||
_filename="macos-deps-qt${QT_VERSION}-${deps_version}-${target##*-}.tar.xz"
|
||||
}
|
||||
_url="${deps_baseurl}/${deps_version}/${_filename}"
|
||||
_target="plugin-deps-${deps_version}-qt${QT_VERSION}-${target##*-}"
|
||||
;;
|
||||
}
|
||||
|
||||
if [[ ! -f ${_filename} ]] {
|
||||
log_debug "Running curl ${curl_opts} ${_url}"
|
||||
curl ${curl_opts} ${_url} && \
|
||||
log_status "Downloaded ${deps_label} for ${target}."
|
||||
} else {
|
||||
log_status "Found downloaded ${deps_label}"
|
||||
}
|
||||
|
||||
read -r artifact_checksum _ <<< "$(sha256sum ${_filename})"
|
||||
if [[ ${deps_hash} != ${artifact_checksum} ]] {
|
||||
log_error "Checksum of downloaded ${deps_label} does not match specification.
|
||||
Expected : ${deps_hash}
|
||||
Actual : ${artifact_checksum}"
|
||||
return 2
|
||||
}
|
||||
log_status "Checksum of downloaded ${deps_label} matches."
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)unpack]}) )) {
|
||||
mkdir -p ${_target} && pushd ${_target}
|
||||
|
||||
XZ_OPT=-T0 tar -xzf ../${_filename} && log_status "${deps_label} extracted."
|
||||
popd
|
||||
}
|
||||
}
|
||||
|
||||
popd
|
||||
pushd ${project_root:h}/obs-build-dependencies
|
||||
xattr -r -d com.apple.quarantine *
|
||||
log_status 'Removed quarantine flag from downloaded dependencies...'
|
||||
popd
|
||||
} else {
|
||||
local deps_version
|
||||
read -r deps_version <<< \
|
||||
"$(jq -r '.dependencies.prebuilt.version' ${buildspec_file})"
|
||||
|
||||
typeset -g OBS_DEPS_VERSION=${deps_version}
|
||||
}
|
||||
122
.github/scripts/utils.zsh/setup_obs
vendored
122
.github/scripts/utils.zsh/setup_obs
vendored
|
|
@ -1,122 +0,0 @@
|
|||
autoload -Uz log_error log_info log_status
|
||||
|
||||
if (( ! ${+buildspec_file} )) {
|
||||
log_error "'buildspec_file' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+commands[git]} )) {
|
||||
log_error 'git not found. Please install git.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+commands[jq]} )) {
|
||||
log_error 'jq not found. Please install jq.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+project_root} )) {
|
||||
log_error "'project_root' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+target} )) {
|
||||
log_error "'target' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
log_info 'Setting up OBS-Studio...'
|
||||
|
||||
local obs_version
|
||||
local obs_repo
|
||||
local obs_branch
|
||||
local obs_hash
|
||||
|
||||
read -r obs_version obs_repo obs_branch obs_hash <<< \
|
||||
"$(jq -r --arg key "obs-studio" \
|
||||
'.dependencies[$key] | {version, repository, branch, hash} | join(" ")' \
|
||||
${buildspec_file})"
|
||||
|
||||
if [[ -z ${obs_version} ]] {
|
||||
log_error "No obs-studio version found in buildspec.json"
|
||||
return 2
|
||||
}
|
||||
|
||||
pushd
|
||||
mkcd ${project_root:h}/obs-studio
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)unpack]}) )) {
|
||||
if [[ -d .git ]] {
|
||||
git config advice.detachedHead false
|
||||
git config remote.pluginbuild.url "${obs_repo:-https://github.com/obsproject/obs-studio.git}"
|
||||
git config remote.pluginbuild.fetch "+refs/heads/${obs_branch:-master}:refs/remotes/origin/${obs_branch:-master}"
|
||||
|
||||
git rev-parse -q --verify "${obs_hash}^{commit}" > /dev/null || git fetch pluginbuild
|
||||
git checkout ${obs_branch:-master} -B ${product_name}
|
||||
git reset --hard "${obs_hash}"
|
||||
log_status 'Found existing obs-studio repository.'
|
||||
} else {
|
||||
git clone "${obs_repo:-https://github.com/obsproject/obs-studio.git}" "${PWD}"
|
||||
git config advice.detachedHead false
|
||||
git checkout -f "${obs_hash}" --
|
||||
git checkout ${obs_branch:-master} -b ${product_name}
|
||||
log_status 'obs-studio checked out.'
|
||||
}
|
||||
|
||||
git submodule foreach --recursive git submodule sync
|
||||
git submodule update --init --recursive
|
||||
}
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
|
||||
log_info 'Configuring obs-studio...'
|
||||
|
||||
local -a cmake_args=(
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG:-Release}
|
||||
-DQT_VERSION=${QT_VERSION}
|
||||
-DENABLE_PLUGINS=OFF
|
||||
-DENABLE_UI=OFF
|
||||
-DENABLE_SCRIPTING=OFF
|
||||
-DCMAKE_INSTALL_PREFIX="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
|
||||
-DCMAKE_PREFIX_PATH="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
|
||||
)
|
||||
|
||||
if (( _loglevel == 0 )) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR)
|
||||
if (( _loglevel > 2 )) cmake_args+=(--debug-output)
|
||||
|
||||
local num_procs
|
||||
|
||||
case ${target} {
|
||||
macos-*)
|
||||
autoload -Uz read_codesign
|
||||
if (( ${+CODESIGN} )) {
|
||||
read_codesign
|
||||
}
|
||||
|
||||
cmake_args+=(
|
||||
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
||||
-DOBS_CODESIGN_LINKER=ON
|
||||
-DOBS_BUNDLE_CODESIGN_IDENTITY="${CODESIGN_IDENT:--}"
|
||||
)
|
||||
num_procs=$(( $(sysctl -n hw.ncpu) + 1 ))
|
||||
;;
|
||||
linux-*)
|
||||
cmake_args+=(
|
||||
-DENABLE_PIPEWIRE=OFF
|
||||
)
|
||||
num_procs=$(( $(nproc) + 1 ))
|
||||
;;
|
||||
}
|
||||
|
||||
log_debug "Attempting to configure OBS with CMake arguments: ${cmake_args}"
|
||||
cmake -S . -B plugin_build_${target##*-} -G ${generator} ${cmake_args}
|
||||
|
||||
log_info 'Building libobs and obs-frontend-api...'
|
||||
local -a cmake_args=()
|
||||
if (( _loglevel > 1 )) cmake_args+=(--verbose)
|
||||
if [[ ${generator} == 'Unix Makefiles' ]] cmake_args+=(--parallel ${num_procs})
|
||||
cmake --build plugin_build_${target##*-} --config ${BUILD_CONFIG:-Release} ${cmake_args} -t obs-frontend-api
|
||||
cmake --install plugin_build_${target##*-} --config ${BUILD_CONFIG:-Release} --component obs_libraries ${cmake_args}
|
||||
}
|
||||
|
||||
popd
|
||||
4
.github/workflows/build-debian.yml
vendored
4
.github/workflows/build-debian.yml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
- name: check_libobs_revision
|
||||
|
|
@ -37,7 +37,7 @@ jobs:
|
|||
tar --exclude=.git -cvzf obs-scene-switcher_0.1+testonly.orig.tar.gz SceneSwitcher
|
||||
- name: create_debian_dir
|
||||
run: |
|
||||
cp -a CI/linux/debian .
|
||||
cp -a build-aux/CI/linux/debian .
|
||||
- name: install_dependencies
|
||||
run: |
|
||||
# devscripts and libobs-dev are needed but they were already installed
|
||||
|
|
|
|||
301
.github/workflows/build-project.yaml
vendored
Normal file
301
.github/workflows/build-project.yaml
vendored
Normal file
|
|
@ -0,0 +1,301 @@
|
|||
name: Build Project
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
pluginName:
|
||||
description: 'Project name detected by parsing build spec file'
|
||||
value: ${{ jobs.check-event.outputs.pluginName }}
|
||||
env:
|
||||
DEP_DIR: .deps/advss-build-dependencies
|
||||
jobs:
|
||||
check-event:
|
||||
name: Check GitHub Event Data 🔎
|
||||
runs-on: ubuntu-22.04
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
outputs:
|
||||
package: ${{ steps.setup.outputs.package }}
|
||||
codesign: ${{ steps.setup.outputs.codesign }}
|
||||
notarize: ${{ steps.setup.outputs.notarize }}
|
||||
config: ${{ steps.setup.outputs.config }}
|
||||
commitHash: ${{ steps.setup.outputs.commitHash }}
|
||||
pluginName: ${{ steps.setup.outputs.pluginName }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Check Event Data ☑️
|
||||
id: setup
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
: Check Event Data ☑️
|
||||
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
||||
|
||||
case "${GITHUB_EVENT_NAME}" in
|
||||
pull_request)
|
||||
config_data=('codesign:false' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
|
||||
if gh pr view ${{ github.event.number }} --json labels \
|
||||
| jq -e -r '.labels[] | select(.name == "Seeking Testers")' > /dev/null; then
|
||||
config_data[0]='codesign:true'
|
||||
config_data[2]='package:true'
|
||||
fi
|
||||
;;
|
||||
push)
|
||||
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
|
||||
if [[ ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]]; then
|
||||
config_data[1]='notarize:true'
|
||||
config_data[3]='config:Release'
|
||||
fi
|
||||
;;
|
||||
workflow_dispatch)
|
||||
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
|
||||
;;
|
||||
schedule)
|
||||
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
for config in "${config_data[@]}"; do
|
||||
IFS=':' read -r key value <<< "${config}"
|
||||
echo "${key}=${value}" >> $GITHUB_OUTPUT
|
||||
done
|
||||
echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
|
||||
|
||||
plugin_name="$(grep 'name' buildspec.json | sed -E -e 's/^.+"name":[^"]+"(.+)",?$/\1/g')"
|
||||
plugin_display_name="$(grep 'displayName' buildspec.json | sed -E -e 's/^.+"displayName":[^"]+"(.+)",?$/\1/g' || echo "")"
|
||||
|
||||
if [[ "${plugin_display_name}" ]]; then
|
||||
echo "pluginName=${plugin_display_name}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "pluginName=${plugin_name}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
macos-build:
|
||||
name: Build for macOS 🍏
|
||||
runs-on: macos-13
|
||||
needs: check-event
|
||||
defaults:
|
||||
run:
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set Up Environment 🔧
|
||||
id: setup
|
||||
run: |
|
||||
: Set Up Environment 🔧
|
||||
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
||||
|
||||
print '::group::Clean Homebrew Environment'
|
||||
local -a to_remove=()
|
||||
|
||||
if (( #to_remove )) brew uninstall --ignore-dependencies ${to_remove}
|
||||
print '::endgroup::'
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
|
||||
local git_tag="$(git describe --tags)"
|
||||
|
||||
print "pluginName=${product_name}" >> $GITHUB_OUTPUT
|
||||
print "pluginVersion=${git_tag}" >> $GITHUB_OUTPUT
|
||||
|
||||
print '::group::Select Xcode version'
|
||||
sudo xcode-select --switch /Applications/Xcode_14.3.1.app
|
||||
print '::endgroup::'
|
||||
|
||||
|
||||
- uses: actions/cache@v4
|
||||
id: ccache-cache
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
key: ${{ runner.os }}-ccache-${{ needs.check-event.outputs.config }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-
|
||||
|
||||
- name: Build Dependencies 🏗️
|
||||
uses: ./.github/actions/build-dependencies
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: macos-universal
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
|
||||
- name: Set Up Codesigning 🔑
|
||||
uses: ./.github/actions/setup-macos-codesigning
|
||||
if: fromJSON(needs.check-event.outputs.codesign)
|
||||
id: codesign
|
||||
with:
|
||||
codesignIdentity: ${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}
|
||||
installerIdentity: ${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}
|
||||
codesignCertificate: ${{ secrets.MACOS_SIGNING_CERT }}
|
||||
certificatePassword: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
|
||||
keychainPassword: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
|
||||
provisioningProfile: ${{ secrets.MACOS_SIGNING_PROVISIONING_PROFILE }}
|
||||
notarizationUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
|
||||
notarizationPassword: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
|
||||
|
||||
- name: Build Plugin 🧱
|
||||
uses: ./.github/actions/build-plugin
|
||||
with:
|
||||
target: macos-universal
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) }}
|
||||
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
|
||||
|
||||
- name: Package Plugin 📀
|
||||
uses: ./.github/actions/package-plugin
|
||||
with:
|
||||
target: macos-universal
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
package: ${{ fromJSON(needs.check-event.outputs.package) }}
|
||||
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) && fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
|
||||
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
|
||||
installerIdent: ${{ steps.codesign.outputs.installerIdent }}
|
||||
codesignTeam: ${{ steps.codesign.outputs.codesignTeam }}
|
||||
notarize: ${{ fromJSON(needs.check-event.outputs.notarize) && fromJSON(steps.codesign.outputs.haveNotarizationUser) }}
|
||||
codesignUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
|
||||
codesignPass: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
|
||||
|
||||
- name: Upload Artifacts 📡
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-${{ needs.check-event.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-macos-universal.*
|
||||
|
||||
- name: Upload Debug Symbol Artifacts 🪲
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ needs.check-event.outputs.config == 'Release' }}
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-${{ needs.check-event.outputs.commitHash }}-dSYMs
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-macos-universal-dSYMs.*
|
||||
|
||||
ubuntu-build:
|
||||
name: Build for Ubuntu 🐧
|
||||
runs-on: ubuntu-22.04
|
||||
needs: check-event
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set Up Environment 🔧
|
||||
id: setup
|
||||
run: |
|
||||
: Set Up Environment 🔧
|
||||
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
||||
|
||||
git_tag="$(git describe --tags)"
|
||||
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
|
||||
|
||||
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
|
||||
echo "pluginVersion=${git_tag}" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v4
|
||||
id: ccache-cache
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
key: ${{ runner.os }}-ccache-x86_64-${{ needs.check-event.outputs.config }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-x86_64-
|
||||
|
||||
- name: Set up Homebrew 🍺
|
||||
uses: Homebrew/actions/setup-homebrew@master
|
||||
|
||||
- name: Build Plugin 🧱
|
||||
uses: ./.github/actions/build-plugin
|
||||
with:
|
||||
target: x86_64
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
|
||||
- name: Package Plugin 📀
|
||||
uses: ./.github/actions/package-plugin
|
||||
with:
|
||||
package: ${{ fromJSON(needs.check-event.outputs.package) }}
|
||||
target: x86_64
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
|
||||
- name: Upload Source Tarball 🗜️
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-sources-${{ needs.check-event.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-source.*
|
||||
|
||||
- name: Upload Artifacts 📡
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-x86_64*.*
|
||||
|
||||
- name: Upload debug symbol artifacts 🪲
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ fromJSON(needs.check-event.outputs.package) }}
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}-dbgsym
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-x86_64*-dbgsym.ddeb
|
||||
|
||||
windows-build:
|
||||
name: Build for Windows 🪟
|
||||
runs-on: windows-2022
|
||||
needs: check-event
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set Up Environment 🔧
|
||||
id: setup
|
||||
run: |
|
||||
# Set Up Environment 🔧
|
||||
if ( $Env:RUNNER_DEBUG -ne $null ) {
|
||||
Set-PSDebug -Trace 1
|
||||
}
|
||||
|
||||
$BuildSpec = Get-Content -Path buildspec.json -Raw | ConvertFrom-Json
|
||||
$ProductName = $BuildSpec.name
|
||||
$GitOutput = git describe --tags
|
||||
|
||||
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
|
||||
"pluginVersion=${GitOutput}" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Build Dependencies 🏗️
|
||||
uses: ./.github/actions/build-dependencies
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: x64
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
|
||||
- name: Build Plugin 🧱
|
||||
uses: ./.github/actions/build-plugin
|
||||
with:
|
||||
target: x64
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
|
||||
- name: Package Plugin 📀
|
||||
uses: ./.github/actions/package-plugin
|
||||
with:
|
||||
target: x64
|
||||
config: ${{ needs.check-event.outputs.config }}
|
||||
package: ${{ fromJSON(needs.check-event.outputs.package) }}
|
||||
|
||||
- name: Upload Artifacts 📡
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ needs.check-event.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-windows-x64*.*
|
||||
27
.github/workflows/check-format.yaml
vendored
Normal file
27
.github/workflows/check-format.yaml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: Check Code Formatting 🛠️
|
||||
on:
|
||||
workflow_call:
|
||||
jobs:
|
||||
clang-format:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: clang-format check 🐉
|
||||
id: clang-format
|
||||
uses: ./.github/actions/run-clang-format
|
||||
with:
|
||||
failCondition: error
|
||||
|
||||
cmake-format:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: cmake-format check 🎛️
|
||||
id: cmake-format
|
||||
uses: ./.github/actions/run-cmake-format
|
||||
with:
|
||||
failCondition: error
|
||||
18
.github/workflows/dispatch.yaml
vendored
Normal file
18
.github/workflows/dispatch.yaml
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
name: Dispatch
|
||||
run-name: Dispatched Repository Actions - ${{ inputs.job }} ⌛️
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
job:
|
||||
description: Dispatch job to run
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- build
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
check-and-build:
|
||||
if: inputs.job == 'build'
|
||||
uses: ./.github/workflows/build-project.yaml
|
||||
secrets: inherit
|
||||
4
.github/workflows/locale-check.yml
vendored
4
.github/workflows/locale-check.yml
vendored
|
|
@ -19,8 +19,8 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check locale files
|
||||
run: |
|
||||
python3 ./CI/checkLocale.py -p data/locale/
|
||||
python3 ./build-aux/CI/check-locale.py -p data/locale/
|
||||
|
|
|
|||
460
.github/workflows/main.yml
vendored
460
.github/workflows/main.yml
vendored
|
|
@ -1,460 +0,0 @@
|
|||
name: Plugin Build
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
PLUGIN_NAME: SceneSwitcher
|
||||
LIB_NAME: advanced-scene-switcher
|
||||
DEP_DIR: advss-build-dependencies-1
|
||||
|
||||
jobs:
|
||||
clang_check:
|
||||
name: 01 - Code Format Check
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install clang-format
|
||||
run: sudo apt-get install -y clang-format-13
|
||||
|
||||
- name: Run clang-format
|
||||
run: ./.github/scripts/check-format.sh && ./.github/scripts/check-changes.sh
|
||||
|
||||
- name: Install cmake-format
|
||||
run: sudo pip install cmakelang
|
||||
|
||||
- name: Run cmake-format
|
||||
run: ./.github/scripts/check-cmake.sh
|
||||
|
||||
macos_build:
|
||||
name: 02 - macOS
|
||||
runs-on: macos-12
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
arch: [x86_64, arm64, universal]
|
||||
if: always()
|
||||
needs: [clang_check]
|
||||
outputs:
|
||||
commitHash: ${{ steps.setup.outputs.commitHash }}
|
||||
env:
|
||||
CODESIGN_IDENT: '-'
|
||||
CODESIGN_IDENT_INSTALLER: ''
|
||||
MACOSX_DEPLOYMENT_TARGET: '10.15'
|
||||
defaults:
|
||||
run:
|
||||
shell: zsh {0}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: plugin
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout obs-studio
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'obsproject/obs-studio'
|
||||
path: obs-studio
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Environment
|
||||
id: setup
|
||||
working-directory: ${{ github.workspace }}/plugin
|
||||
run: |
|
||||
## SETUP ENVIRONMENT SCRIPT
|
||||
print '::group::Clean Homebrew Environment'
|
||||
typeset -a to_remove=()
|
||||
|
||||
for formula (speexdsp curl php) {
|
||||
if [[ -d ${HOMEBREW_PREFIX}/opt/${formula} ]] to_remove+=(${formula})
|
||||
}
|
||||
|
||||
if (( #to_remove > 0 )) brew uninstall --ignore-dependencies ${to_remove}
|
||||
print '::endgroup::'
|
||||
|
||||
print '::group::Set up code signing'
|
||||
if [[ '${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' != '' && \
|
||||
'${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}' != '' && \
|
||||
'${{ secrets.MACOS_SIGNING_CERT }}' != '' ]] {
|
||||
print 'haveCodesignIdent=true' >> $GITHUB_OUTPUT
|
||||
} else {
|
||||
print 'haveCodesignIdent=false' >> $GITHUB_OUTPUT
|
||||
}
|
||||
|
||||
if [[ '${{ secrets.MACOS_NOTARIZATION_USERNAME }}' != '' && \
|
||||
'${{ secrets.MACOS_NOTARIZATION_PASSWORD }}' != '' ]] {
|
||||
print 'haveNotarizationUser=true' >> $GITHUB_OUTPUT
|
||||
} else {
|
||||
print 'haveNotarizationUser=false' >> $GITHUB_OUTPUT
|
||||
}
|
||||
print '::endgroup::'
|
||||
|
||||
print "ccacheDate=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
|
||||
print "commitHash=${"$(git rev-parse HEAD)"[0,9]}" >> $GITHUB_OUTPUT
|
||||
echo "$PWD/.github/scripts" >> $GITHUB_PATH
|
||||
|
||||
- name: Restore Compilation Cache
|
||||
id: ccache-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/.ccache
|
||||
key: macos-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
|
||||
restore-keys: |
|
||||
macos-${{ matrix.arch }}-ccache-plugin-
|
||||
|
||||
- name: Check for GitHub Labels
|
||||
id: seekingTesters
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
run: |
|
||||
if [[ -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')" ]] {
|
||||
print 'found=true' >> $GITHUB_OUTPUT
|
||||
} else {
|
||||
print 'found=false' >> $GITHUB_OUTPUT
|
||||
}
|
||||
|
||||
- name: Install Apple Developer Certificate
|
||||
if: ${{ steps.setup.outputs.haveCodesignIdent == 'true' }}
|
||||
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
|
||||
with:
|
||||
keychain-password: ${{ github.run_id }}
|
||||
p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
|
||||
p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
|
||||
|
||||
- name: Set Signing Identity
|
||||
if: ${{ steps.setup.outputs.haveCodesignIdent == 'true' }}
|
||||
run: |
|
||||
print "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" >> $GITHUB_ENV
|
||||
print "CODESIGN_IDENT_INSTALLER=${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build Dependencies
|
||||
uses: ./plugin/.github/actions/build-dependencies
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
|
||||
- name: Build Plugin
|
||||
uses: ./plugin/.github/actions/build-plugin
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
codesign: 'true'
|
||||
codesignIdent: ${{ env.CODESIGN_IDENT }}
|
||||
|
||||
- name: Run tests
|
||||
uses: ./plugin/.github/actions/run-tests
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
|
||||
- name: Package Plugin
|
||||
uses: ./plugin/.github/actions/package-plugin
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
codesign: ${{ steps.setup.outputs.haveCodesignIdent == 'true' }}
|
||||
notarize: ${{ startsWith(github.ref, 'refs/tags/') && steps.setup.outputs.haveNotarizationUser == 'true' }}
|
||||
codesignIdent: ${{ env.CODESIGN_IDENT }}
|
||||
installerIdent: ${{ env.CODESIGN_IDENT_INSTALLER }}
|
||||
codesignUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
|
||||
codesignPass: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
|
||||
|
||||
- name: Upload Installer Artifact
|
||||
if: ${{ success() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_NAME }}-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}-installer
|
||||
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}*-macos-${{ matrix.arch }}.pkg
|
||||
|
||||
- name: Upload Build Artifact
|
||||
if: ${{ success() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_NAME }}-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}-*.zip
|
||||
|
||||
linux_build:
|
||||
name: 02 - Linux
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
portable: [true, false]
|
||||
if: always()
|
||||
needs: [clang_check]
|
||||
outputs:
|
||||
commitHash: ${{ steps.setup.outputs.commitHash }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: plugin
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout obs-studio
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'obsproject/obs-studio'
|
||||
path: obs-studio
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Environment
|
||||
working-directory: ${{ github.workspace }}/plugin
|
||||
id: setup
|
||||
run: |
|
||||
## SETUP ENVIRONMENT SCRIPT
|
||||
echo "ccacheDate=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
|
||||
echo "commitHash=$(git rev-parse HEAD | cut -c1-9)" >> $GITHUB_OUTPUT
|
||||
echo "$PWD/.github/scripts" >> $GITHUB_PATH
|
||||
|
||||
- name: Restore Compilation Cache
|
||||
id: ccache-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/.ccache
|
||||
key: linux-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
|
||||
restore-keys: |
|
||||
linux-${{ matrix.arch }}-ccache-plugin-
|
||||
|
||||
- name: Check for GitHub Labels
|
||||
id: seekingTesters
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
run: |
|
||||
## GITHUB LABEL SCRIPT
|
||||
if [[ -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')" ]]; then
|
||||
echo 'found=true' >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo 'found=false' >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Build Dependencies
|
||||
uses: ./plugin/.github/actions/build-dependencies
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
|
||||
- name: Build Plugin
|
||||
uses: ./plugin/.github/actions/build-plugin
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
portable: ${{ matrix.portable }}
|
||||
|
||||
- name: Run tests
|
||||
uses: ./plugin/.github/actions/run-tests
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
|
||||
- name: Package Plugin
|
||||
uses: ./plugin/.github/actions/package-plugin
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
portable: ${{ matrix.portable }}
|
||||
|
||||
- name: Upload Package Artifact
|
||||
if: ${{ matrix.portable }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_NAME }}-linux-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}-portable
|
||||
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}*-linux-${{ matrix.arch }}.*
|
||||
|
||||
- name: Upload Build Artifact
|
||||
if: ${{ ! matrix.portable }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_NAME }}-linux-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}*-linux-${{ matrix.arch }}.*
|
||||
|
||||
windows_build:
|
||||
name: 02 - Windows
|
||||
runs-on: windows-2022
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
arch: [x64]
|
||||
if: always()
|
||||
needs: [clang_check]
|
||||
outputs:
|
||||
commitHash: ${{ steps.setup.outputs.commitHash }}
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: plugin
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout obs-studio
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'obsproject/obs-studio'
|
||||
path: obs-studio
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Environment
|
||||
working-directory: ${{ github.workspace }}/plugin
|
||||
id: setup
|
||||
run: |
|
||||
## SETUP ENVIRONMENT SCRIPT
|
||||
$CcacheDate = (Get-Date -Format "yyyy-M-d")
|
||||
"ccacheDate=${CcacheDate}" >> $env:GITHUB_OUTPUT
|
||||
$CommitHash = (git rev-parse HEAD)[0..8] -join ''
|
||||
"commitHash=${CommitHash}" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Restore Compilation Cache
|
||||
id: ccache-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/.ccache
|
||||
key: windows-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
|
||||
restore-keys: |
|
||||
windows-${{ matrix.arch }}-ccache-plugin-
|
||||
|
||||
- name: Check for GitHub Labels
|
||||
id: seekingTesters
|
||||
working-directory: ${{ github.workspace }}/plugin
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
run: |
|
||||
## GITHUB LABEL SCRIPT
|
||||
$LabelFound = try {
|
||||
$Params = @{
|
||||
Authentication = 'Bearer'
|
||||
Token = (ConvertTo-SecureString '${{ secrets.GITHUB_TOKEN }}' -AsPlainText)
|
||||
Uri = '${{ github.event.pull_request.url }}'
|
||||
UseBasicParsing = $true
|
||||
}
|
||||
|
||||
(Invoke-RestMethod @Params).labels.name.contains('Seeking Testers')
|
||||
} catch {
|
||||
$false
|
||||
}
|
||||
|
||||
"found=$(([string]${LabelFound}).ToLower())" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Build Dependencies
|
||||
uses: ./plugin/.github/actions/build-dependencies
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
visualStudio: 'Visual Studio 17 2022'
|
||||
|
||||
- name: Build Plugin
|
||||
uses: ./plugin/.github/actions/build-plugin
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
visualStudio: 'Visual Studio 17 2022'
|
||||
|
||||
- name: Run tests
|
||||
uses: ./plugin/.github/actions/run-tests
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
|
||||
- name: Package Plugin
|
||||
uses: ./plugin/.github/actions/package-plugin
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
|
||||
- name: Upload Build Artifact
|
||||
if: ${{ success() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_NAME }}-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}-*.zip
|
||||
|
||||
- name: Package Plugin Installer
|
||||
uses: ./plugin/.github/actions/package-plugin
|
||||
with:
|
||||
workingDirectory: ${{ github.workspace }}/plugin
|
||||
target: ${{ matrix.arch }}
|
||||
config: RelWithDebInfo
|
||||
createInstaller: true
|
||||
|
||||
- name: Upload Installer Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PLUGIN_NAME }}-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}-installer
|
||||
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}-*.exe
|
||||
|
||||
make-release:
|
||||
name: 03 - Create and upload release
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||
needs: [macos_build, linux_build, windows_build]
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Get Metadata
|
||||
id: metadata
|
||||
run: |
|
||||
## METADATA SCRIPT
|
||||
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
- name: Generate Checksums
|
||||
run: |
|
||||
## CHECKSUM GENERATION SCRIPT
|
||||
shopt -s extglob
|
||||
echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
|
||||
for file in ${{ github.workspace }}/**/@(*.pkg|*.exe|*.deb|*.zip); do
|
||||
echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
|
||||
done
|
||||
cat ${{ github.workspace }}/CHECKSUMS.txt
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
draft: true
|
||||
prerelease: true
|
||||
tag_name: ${{ steps.metadata.outputs.version }}
|
||||
name: "${{ env.PLUGIN_NAME }} ${{ steps.metadata.outputs.version }}"
|
||||
body_path: ${{ github.workspace }}/CHECKSUMS.txt
|
||||
files: |
|
||||
${{ github.workspace }}/**/*.zip
|
||||
${{ github.workspace }}/**/*.exe
|
||||
${{ github.workspace }}/**/*.deb
|
||||
${{ github.workspace }}/**/*.pkg
|
||||
27
.github/workflows/pr-pull.yaml
vendored
Normal file
27
.github/workflows/pr-pull.yaml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: Pull Request
|
||||
run-name: ${{ github.event.pull_request.title }} pull request run 🚀
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
branches: [master, main]
|
||||
types: [ opened, synchronize, reopened ]
|
||||
permissions:
|
||||
contents: read
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
check-format:
|
||||
name: Check Formatting 🔍
|
||||
uses: ./.github/workflows/check-format.yaml
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
build-project:
|
||||
name: Build Project 🧱
|
||||
uses: ./.github/workflows/build-project.yaml
|
||||
secrets: inherit
|
||||
permissions:
|
||||
contents: read
|
||||
122
.github/workflows/push.yaml
vendored
Normal file
122
.github/workflows/push.yaml
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
name: Push to master
|
||||
run-name: ${{ github.ref_name }} push run 🚀
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- 'release/**'
|
||||
tags:
|
||||
- '*'
|
||||
permissions:
|
||||
contents: write
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.ref }}'
|
||||
cancel-in-progress: ${{ github.ref_type == 'tag' }}
|
||||
jobs:
|
||||
check-format:
|
||||
name: Check Formatting 🔍
|
||||
if: github.ref_name == 'master'
|
||||
uses: ./.github/workflows/check-format.yaml
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
build-project:
|
||||
name: Build Project 🧱
|
||||
uses: ./.github/workflows/build-project.yaml
|
||||
secrets: inherit
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
create-release:
|
||||
name: Create Release 🛫
|
||||
if: github.ref_type == 'tag'
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build-project
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Check Release Tag ☑️
|
||||
id: check
|
||||
run: |
|
||||
: Check Release Tag ☑️
|
||||
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
||||
shopt -s extglob
|
||||
|
||||
case "${GITHUB_REF_NAME}" in
|
||||
+([0-9]).+([0-9]).+([0-9]) )
|
||||
echo 'validTag=true' >> $GITHUB_OUTPUT
|
||||
echo 'prerelease=false' >> $GITHUB_OUTPUT
|
||||
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
|
||||
;;
|
||||
+([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
|
||||
echo 'validTag=true' >> $GITHUB_OUTPUT
|
||||
echo 'prerelease=true' >> $GITHUB_OUTPUT
|
||||
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
|
||||
;;
|
||||
*) echo 'validTag=false' >> $GITHUB_OUTPUT ;;
|
||||
esac
|
||||
|
||||
- name: Download Build Artifacts 📥
|
||||
uses: actions/download-artifact@v4
|
||||
if: fromJSON(steps.check.outputs.validTag)
|
||||
id: download
|
||||
|
||||
- name: Rename Files 🏷️
|
||||
if: fromJSON(steps.check.outputs.validTag)
|
||||
run: |
|
||||
: Rename Files 🏷️
|
||||
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
||||
shopt -s extglob
|
||||
shopt -s nullglob
|
||||
|
||||
root_dir="$(pwd)"
|
||||
commit_hash="${GITHUB_SHA:0:9}"
|
||||
|
||||
variants=(
|
||||
'windows-x64;zip|exe'
|
||||
'macos-universal;tar.xz|pkg'
|
||||
'ubuntu-22.04-x86_64;tar.xz|deb|ddeb'
|
||||
'sources;tar.xz'
|
||||
)
|
||||
|
||||
for variant_data in "${variants[@]}"; do
|
||||
IFS=';' read -r variant suffix <<< "${variant_data}"
|
||||
|
||||
candidates=(*-${variant}-${commit_hash}/@(*|*-dbgsym).@(${suffix}))
|
||||
|
||||
for candidate in "${candidates[@]}"; do
|
||||
mv "${candidate}" "${root_dir}"
|
||||
done
|
||||
done
|
||||
|
||||
- name: Generate Checksums 🪪
|
||||
if: fromJSON(steps.check.outputs.validTag)
|
||||
run: |
|
||||
: Generate Checksums 🪪
|
||||
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
||||
shopt -s extglob
|
||||
|
||||
echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
|
||||
for file in ${{ github.workspace }}/@(*.exe|*.deb|*.ddeb|*.pkg|*.tar.xz|*.zip); do
|
||||
echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
|
||||
done
|
||||
|
||||
- name: Create Release 🛫
|
||||
if: fromJSON(steps.check.outputs.validTag)
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b
|
||||
with:
|
||||
draft: true
|
||||
prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }}
|
||||
tag_name: ${{ steps.check.outputs.version }}
|
||||
name: ${{ needs.build-project.outputs.pluginName }} ${{ steps.check.outputs.version }}
|
||||
body_path: ${{ github.workspace }}/CHECKSUMS.txt
|
||||
files: |
|
||||
${{ github.workspace }}/*.exe
|
||||
${{ github.workspace }}/*.zip
|
||||
${{ github.workspace }}/*.pkg
|
||||
${{ github.workspace }}/*.deb
|
||||
${{ github.workspace }}/*.ddeb
|
||||
${{ github.workspace }}/*.tar.xz
|
||||
Loading…
Reference in New Issue
Block a user