Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/actions/run-clang-format/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ runs:
working-directory: ${{ inputs.workingDirectory }}
env:
CHANGED_FILES: ${{ steps.checks.outputs.changedFiles }}
FAIL_MODE: ${{ inputs.failCondition }}
run: |
: Run clang-format 🐉
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
Expand All @@ -59,5 +60,11 @@ runs:

print ::group::Run clang-format-22
local -a changes=(${(s:,:)CHANGED_FILES//[\[\]\'\"]/})
./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check ${changes}

if [[ "${FAIL_MODE:-never}" == 'never' ]] {
setopt NO_ERR_EXIT
setopt NO_ERR_RETURN
}

./build-aux/run-clang-format --check --github ${changes}
print ::endgroup::
11 changes: 8 additions & 3 deletions .github/actions/run-gersemi/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,22 @@ runs:
working-directory: ${{ github.workspace }}
env:
CHANGED_FILES: ${{ steps.checks.outputs.changedFiles }}
FAIL_MODE: ${{ inputs.failCondition }}
run: |
: Run gersemi 🎛️
if (( ${+RUNNER_DEBUG} )) setopt XTRACE

print ::group::Install gersemi
brew update
brew trust obsproject/tools
brew install --quiet obsproject/tools/gersemi@0.25
brew install --quiet gersemi
print ::endgroup::

if [[ "${FAIL_MODE:-never}" == 'never' ]] {
setopt NO_ERR_EXIT
setopt NO_ERR_RETURN
}

print ::group::Run gersemi
local -a changes=(${(s:,:)CHANGED_FILES//[\[\]\'\"]/})
./build-aux/run-gersemi --fail-${{ inputs.failCondition }} --check ${changes}
./build-aux/run-gersemi --check --github ${changes}
print ::endgroup::
8 changes: 7 additions & 1 deletion .github/actions/run-swift-format/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ runs:
working-directory: ${{ github.workspace }}
env:
CHANGED_FILES: ${{ steps.checks.outputs.changedFiles }}
FAIL_MODE: ${{ inputs.failCondition }}
run: |
: Run swift-format 🔥
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
Expand All @@ -55,7 +56,12 @@ runs:
brew install --quiet swift-format
print ::endgroup::

if [[ "${FAIL_MODE:-never}" == 'never' ]] {
setopt NO_ERR_EXIT
setopt NO_ERR_RETURN
}

print ::group::Run swift-format
local -a changes=(${(s:,:)CHANGED_FILES//[\[\]\'\"]/})
./build-aux/run-swift-format --fail-${{ inputs.failCondition }} --check ${changes}
./build-aux/run-swift-format --check --github ${changes}
print ::endgroup::
38 changes: 38 additions & 0 deletions build-aux/.run-format-launcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env sh

# Combined POSIX Csh/Powershell entry point script
# Based on StackOverflow answer by Jeff Hykin
# https://stackoverflow.com/a/67292076
#
# In Csh the first line will echo "--%" to /dev/null, followed by the colon built-in
# (using the semi-colon to create a command list). This built-in does nothing apart
# from variable expansions, and is given a multi-line string.
#
# In Powershell the line uses the '--%' token to stop parsing, which will also send the
# 'echo'. output to Powershell's null output, and will then encounter the declaration
# of a multiline comment, which extends until after the "exit" command.
#
# Thus Powershell will execute the code below "exit" in earnest, whereas Csh will ignore
# anything past that "exit".
#

echo --% >/dev/null;: ' | out-null
<#'
host_os="$(uname)"
script_location="$(dirname "${0}")"
linter_name="$(basename "${0}")"
linter_name="${linter_name#*-}"

if [ "${host_os}" = 'Darwin' ]; then
exec zsh "${script_location}/.run-format.zsh" --linter "${linter_name}" "${@}"
elif command -v zsh > /dev/null; then
exec zsh "${script_location}/.run-format.zsh" --linter "${linter_name}" "${@}"
else
exec bash "${script_location}/.run-format.bash" --linter "${linter_name}" "${@}"
fi
exit #>

$ScriptLocation = $PSScriptRoot
$LinterName = ($MyInvocation.MyCommand.Name) -replace 'run-(.+).ps1','$1'

. ${ScriptLocation}/.run-format.ps1 -Linter "${LinterName}" @Args
Loading
Loading