mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-28 03:12:02 -04:00
CI: Replace cmake-format with gersemi for CMake file format checks
This commit is contained in:
59
.github/actions/run-gersemi/action.yaml
vendored
Normal file
59
.github/actions/run-gersemi/action.yaml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: Run gersemi
|
||||
description: Runs gersemi 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-gersemi action requires a macOS-based or Linux-based runner."
|
||||
exit 2
|
||||
|
||||
- name: Check for Changed Files ✅
|
||||
uses: ./.github/actions/check-changes
|
||||
id: checks
|
||||
with:
|
||||
checkGlob: "'*.cmake' '*CMakeLists.txt'"
|
||||
diffFilter: 'ACM'
|
||||
|
||||
- name: Install Dependencies 🛍️
|
||||
if: runner.os == 'Linux' && fromJSON(steps.checks.outputs.hasChangedFiles)
|
||||
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 gersemi 🎛️
|
||||
if: fromJSON(steps.checks.outputs.hasChangedFiles)
|
||||
id: result
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
CHANGED_FILES: ${{ steps.checks.outputs.changedFiles }}
|
||||
run: |
|
||||
: Run gersemi 🎛️
|
||||
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
||||
|
||||
print ::group::Install gersemi
|
||||
brew install --quiet obsproject/tools/gersemi
|
||||
print ::endgroup::
|
||||
|
||||
print ::group::Run gersemi
|
||||
local -a changes=(${(s:,:)CHANGED_FILES//[\[\]\'\"]/})
|
||||
./build-aux/run-gersemi --fail-${{ inputs.failCondition }} --check ${changes}
|
||||
print ::endgroup::
|
||||
8
.github/workflows/check-format.yaml
vendored
8
.github/workflows/check-format.yaml
vendored
@@ -26,15 +26,15 @@ jobs:
|
||||
with:
|
||||
failCondition: error
|
||||
|
||||
cmake-format:
|
||||
gersemi:
|
||||
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
|
||||
- name: gersemi Check 🎛️
|
||||
id: gersemi
|
||||
uses: ./.github/actions/run-gersemi
|
||||
with:
|
||||
failCondition: error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user