Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clang-format to 17 #120

Merged
merged 1 commit into from
Apr 12, 2024
Merged
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
8 changes: 4 additions & 4 deletions .github/actions/run-clang-format/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ runs:
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
echo "/home/linuxbrew/.linuxbrew/opt/clang-format@17/bin" >> $GITHUB_PATH
brew install --quiet zsh
echo ::endgroup::

Expand All @@ -51,11 +51,11 @@ runs:
}

if (( ${changes[(I)(*.c|*.h|*.cpp|*.hpp|*.m|*.mm)]} )) {
echo ::group::Install clang-format-16
brew install --quiet obsproject/tools/clang-format@16
echo ::group::Install clang-format-17
brew install --quiet obsproject/tools/clang-format@17
echo ::endgroup::

echo ::group::Run clang-format-16
echo ::group::Run clang-format-17
./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check
echo ::endgroup::
}
14 changes: 7 additions & 7 deletions build-aux/.run-format.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ invoke_formatter() {

case ${1} {
clang)
if (( ${+commands[clang-format-16]} )) {
local formatter=clang-format-16
if (( ${+commands[clang-format-17]} )) {
local formatter=clang-format-17
} elif (( ${+commands[clang-format]} )) {
local formatter=clang-format
local -a formatter_version=($(clang-format --version))

if ! is-at-least 16.0.5 ${formatter_version[-1]}; then
log_error "clang-format is not version 16.0.5 or above (found ${formatter_version[-1]}."
if ! is-at-least 17.0.3 ${formatter_version[-1]}; then
log_error "clang-format is not version 17.0.3 or above (found ${formatter_version[-1]}."
exit 2
fi

if ! is-at-least ${formatter_version[-1]} 16.0.5; then
log_error "clang-format is more recent than version 16.0.5 (found ${formatter_version[-1]})."
if ! is-at-least ${formatter_version[-1]} 17.0.3; then
log_error "clang-format is more recent than version 17.0.3 (found ${formatter_version[-1]})."
exit 2
fi
} else {
log_error "No viable clang-format version found (required 16.0.5)"
log_error "No viable clang-format version found (required 17.0.3)"
exit 2
}

Expand Down