Skip to content

Commit

Permalink
Merge pull request #8881 from PatTheMav/ci-update
Browse files Browse the repository at this point in the history
CI: Update GitHub Actions workflows with repository actions and updated build scripts
  • Loading branch information
RytoEX authored Jul 17, 2023
2 parents c33fa8b + 0993147 commit e70e493
Show file tree
Hide file tree
Showing 104 changed files with 4,539 additions and 3,369 deletions.
118 changes: 118 additions & 0 deletions .github/actions/build-obs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Set Up and Build obs-studio
description: Builds obs-studio for specified architecture and build config
inputs:
target:
description: Build target for obs-studio
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: '-'
codesignTeam:
description: Team 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 }}
--target macos-${{ inputs.target }}
)
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
if [[ '${{ inputs.codesign }}' == true ]] build_args+=(--codesign)
git fetch origin --no-tags --no-recurse-submodules -q
.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=(
--config ${{ inputs.config }}
--target linux-${{ inputs.target }}
--generator Ninja
)
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
git fetch origin --no-tags --no-recurse-submodules -q
.github/scripts/build-linux ${build_args}
- name: Run Windows Build
if: runner.os == 'Windows'
shell: pwsh
working-directory: ${{ inputs.workingDirectory }}
run: |
# Run Windows Build
$BuildArgs = @{
Target = '${{ inputs.target }}'
Configuration = '${{ inputs.config }}'
}
if ( $Env:RUNNER_DEBUG -ne $null ) {
$BuildArgs += @{ Debug = $true }
}
git fetch origin --no-tags --no-recurse-submodules -q
.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
57 changes: 57 additions & 0 deletions .github/actions/check-changes/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Check For Changed Files
description: Checks for changed files compared to specific git reference and glob expression
inputs:
baseRef:
description: Git reference to check against
required: true
ref:
description: Git reference to check with
required: false
default: HEAD
checkGlob:
description: Glob expression to limit check to specific files
required: false
useFallback:
description: Use fallback compare against prior commit
required: false
default: 'true'
outputs:
hasChangedFiles:
value: ${{ steps.checks.outputs.hasChangedFiles }}
description: True if specified files were changed in comparison to specified git reference
changedFiles:
value: ${{ toJSON(steps.checks.outputs.changedFiles) }}
description: List of changed files
runs:
using: composite
steps:
- name: Check For Changed Files ✅
shell: bash
id: checks
env:
GIT_BASE_REF: ${{ inputs.baseRef }}
GIT_REF: ${{ inputs.ref }}
USE_FALLBACK: ${{ inputs.useFallback }}
run: |
: Check for Changed Files ✅
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
shopt -s dotglob
if ! git cat-file -e ${GIT_BASE_REF}; then
echo "::warning::Provided base reference ${GIT_BASE_REF} is invalid"
if [[ "${USE_FALLBACK}" == 'true' ]]; then
GIT_BASE_REF='HEAD~1'
fi
fi
changes=($(git diff --name-only ${GIT_BASE_REF} ${GIT_REF} -- ${{ inputs.checkGlob }}))
if (( ${#changes[@]} )); then
file_string="${changes[*]}"
echo "hasChangedFiles=true" >> $GITHUB_OUTPUT
echo "changedFiles=[${file_string// /,}]" >> GITHUB_OUTPUT
else
echo "hasChangedFiles=false" >> $GITHUB_OUTPUT
echo "changedFiles=[]" >> GITHUB_OUTPUT
fi
58 changes: 58 additions & 0 deletions .github/actions/compatibility-validator/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Compatibility Data Validator
description: Checks Windows compatibility data files
inputs:
repositorySecret:
description: GitHub token for API access
required: true
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 "services-validation action requires a macOS-based or Linux-based runner."
exit 2
- name: Install and Configure Python 🐍
shell: bash
run: |
: Install and Configure Python 🐍
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
echo ::group::Python Set Up
if [[ "${RUNNER_OS}" == Linux ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
fi
brew install --quiet python3
python3 -m pip install jsonschema json_source_map
echo ::endgroup::
- name: Validate Compatibility Files JSON Schema 🕵️
shell: bash
working-directory: ${{ inputs.workingDirectory }}
run: |
: Validate services file JSON schema 🕵️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
echo ::group::Schema Validation
python3 -u \
.github/scripts/utils.py/check-jsonschema.py \
--loglevel INFO \
plugins/win-capture/data/@(compatibility|package).json
echo ::endgroup::
- name: Annotate Schema Validation Errors 🏷️
uses: yuzutech/[email protected]
if: failure()
with:
repo-token: ${{ inputs.repositorySecret }}
title: Compatibility JSON Errors
input: ${{ inputs.workingDirectory }}/validation_errors.json
38 changes: 38 additions & 0 deletions .github/actions/flatpak-manifest-validator/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Flatpak Manifest Validator
description: Checks order of Flatpak modules in manifest file
inputs:
manifestFile:
description: Flatpak manifest file to check
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 "services-validation action requires a macOS-based or Linux-based runner."
exit 2
- name: Validate Flatpak Manifest 🕵️
shell: bash
working-directory: ${{ inputs.workingDirectory }}
run: |
: Validate Flatpak Manifest 🕵️
echo ::group::Run Validation
if [[ '${{ inputs.failCondition }}' == 'never' ]]; then set +e; fi
python3 -u \
build-aux/format-manifest.py \
build-aux/com.obsproject.Studio.json \
--check \
--loglevel INFO
echo ::endgroup::
62 changes: 62 additions & 0 deletions .github/actions/generate-docs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Generate Documentation
description: Updates Sphinx-based documentation
inputs:
sourceDirectory:
description: Path to repository checkout
required: false
default: ${{ github.workspace }}
disableLinkExtensions:
description: Disable Sphinx link extensions
required: false
default: 'false'
runs:
using: composite
steps:
- name: Update Version Number and Copyright ↗️
id: setup
shell: bash
run: |
: Update Version Number and Copyright ↗️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
: "${major:=}"
: "${minor:=}"
: "${patch:=}"
read -r _ major _ minor _ patch _ <<< \
"$(grep -E -e "#define LIBOBS_API_(MAJOR|MINOR|PATCH)_VER *" libobs/obs-config.h \
| sed 's/#define //g' \
| tr -s ' ' \
| tr '\n' ' ')"
sed -i -E \
-e "s/version = '([0-9]+\.[0-9]+\.[0-9]+)'/version = '${major}.${minor}.${patch}'/g" \
-e "s/release = '([0-9]+\.[0-9]+\.[0-9]+)'/release = '${major}.${minor}.${patch}'/g" \
-e "s/copyright = '(2017-[0-9]+, Lain Bailey)'/copyright = '2017-$(date +"%Y"), Lain Bailey'/g" \
${{ inputs.sourceDirectory }}/docs/sphinx/conf.py
if [[ '${{ inputs.disableLinkExtensions }}' == 'true' ]]; then
sed -i -e "s/html_link_suffix = None/html_link_suffix = ''/g" \
${{ inputs.sourceDirectory }}/docs/sphinx/conf.py
echo "artifactName=OBS Studio Docs (No Extensions)" >> $GITHUB_OUTPUT
else
echo "artifactName=OBS Studio Docs" >> $GITHUB_OUTPUT
fi
echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
- name: Install Sphinx 📜
uses: totaldebug/[email protected]
with:
sphinx_src: ${{ inputs.sourceDirectory }}/docs/sphinx
build_only: true
target_branch: master
target_path: '../home/_build'
pre_build_commands: 'pip install -Iv sphinx==5.1.1'

- uses: actions/upload-artifact@v3
with:
name: ${{ steps.setup.outputs.artifactName }} ${{ steps.setup.outputs.commitHash }}
path: |
${{ runner.temp }}/_github_home/_build
!${{ runner.temp }}/_github_home/_build/.doctrees
Loading

0 comments on commit e70e493

Please sign in to comment.