Skip to content
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
6 changes: 6 additions & 0 deletions .github/workflows/build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ on:
type: string
build_docs:
type: string
clang_format:
type: string
generator:
type: string
ctest_args:
Expand Down Expand Up @@ -144,6 +146,10 @@ jobs:
if: inputs.skip_tests != '1'
shell: bash
run: src/build-scripts/ci-test.bash
- name: clang-format
if: inputs.clang_format == '1'
shell: bash
run: src/build-scripts/run-clang-format.bash
- name: Code coverage
if: inputs.coverage == '1'
run: src/build-scripts/ci-coverage.bash
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ jobs:
skip_tests: ${{ matrix.skip_tests }}
abi_check: ${{ matrix.abi_check }}
build_docs: ${{ matrix.build_docs }}
clang_format: ${{ matrix.clang_format }}
generator: ${{ matrix.generator }}
ctest_args: ${{ matrix.ctest_args }}
ctest_test_timeout: ${{ matrix.ctest_test_timeout }}
Expand Down Expand Up @@ -367,25 +368,25 @@ jobs:
setenvs: export OIIO_CMAKE_FLAGS="-DOIIO_BUILD_TOOLS=0 -DOIIO_BUILD_TESTS=0 -DUSE_PYTHON=0"
USE_OPENCV=0 USE_FFMPEG=0 USE_PYTHON=0 USE_FREETYPE=0

# Test formatting. This test entry doesn't do a full build, it
# Test formatting. This test entry doesn't build at all, it
# just runs clang-format on everything, and passes if nothing is
# misformatted. Upon failure, the build artifact will be the full
# source code with the formatting fixed (diffs will also appear in
# the console output).
- desc: "clang-format"
nametag: clang-format
runner: ubuntu-latest
runner: ubuntu-24.04
cxx_std: 17
extra_artifacts: "src/*.*"
openexr_ver: v3.1.13
python_ver: "3.10"
pybind11_ver: "0"
clang_format: 1
skip_build: 1
skip_tests: 1
setenvs: export BUILDTARGET=clang-format
OIIO_CMAKE_FLAGS=-DUSE_PYTHON=0
LLVM_VERSION=17.0.6 LLVM_DISTRO_NAME=ubuntu-22.04
SKIP_SYSTEM_DEPS_INSTALL=1 QT_VERSION=0
OpenImageIO_OPTIONAL_DEPS=ALL
EXTRA_DEP_PACKAGES="git cmake ninja-build g++"
setenvs: export SKIP_SYSTEM_DEPS_INSTALL=1 SKIP_APT_GET_UPDATE=1
INSTALL_OPENCV=0 QT_VERSION=0 USE_LIBHEIF=0
EXTRA_DEP_PACKAGES="clang-format-17"
CLANG_FORMAT_EXE=clang-format-17

- desc: latest releases gcc13 C++20 py3.12 avx2 exr3.3 ocio2.4
nametag: linux-latest-releases
Expand Down
4 changes: 3 additions & 1 deletion src/build-scripts/gh-installdeps.bash
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ else
time sudo apt-get -q install -y ${EXTRA_DEP_PACKAGES}
fi

time sudo apt-get -q install -y python3-numpy
if [[ "${USE_PYTHON}" != "0" ]] ; then
time sudo apt-get -q install -y python3-numpy
fi
if [[ "${PIP_INSTALLS}" != "" ]] ; then
time pip3 install ${PIP_INSTALLS}
fi
Expand Down
24 changes: 24 additions & 0 deletions src/build-scripts/run-clang-format.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -ex

CLANG_FORMAT_EXE=${CLANG_FORMAT_EXE:="clang-format"}
echo "Running " `which clang-format` " version " `${CLANG_FORMAT_EXE} --version`

files=`find ./{src,testsuite} \( -name '*.h' -o -name '*.cpp' \) -print \
| grep -Ev 'pugixml|SHA1|farmhash.cpp|libdpx|libcineon|bcdec.h|gif.h|stb_sprintf.h'`


${CLANG_FORMAT_EXE} -i -style=file $files
git diff --color
THEDIFF=`git diff`
if [[ "$THEDIFF" != "" ]] ; then
echo "git diff was not empty. Failing clang-format check."
exit 1
fi
2 changes: 1 addition & 1 deletion src/cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ endif ()
# is being built as a subproject.
if (PROJECT_IS_TOP_LEVEL)
set (CLANG_FORMAT_EXE_HINT "" CACHE PATH "clang-format executable's directory (will search if not specified")
set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp"
set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp testsuite/*.cpp testsuite/*.h"
CACHE STRING "Glob patterns to include for clang-format")
set (CLANG_FORMAT_EXCLUDES "*pugixml*" "*SHA1*" "*/farmhash.cpp"
"src/dpx.imageio/libdpx/*"
Expand Down
6 changes: 4 additions & 2 deletions testsuite/docs-examples-cpp/src/docs-examples-imagebuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#include <OpenImageIO/imageio.h>
using namespace OIIO;

void example1()
void
example1()
{
//
// Example code fragment from the docs goes here.
Expand All @@ -32,7 +33,8 @@ void example1()



int main(int /*argc*/, char** /*argv*/)
int
main(int /*argc*/, char** /*argv*/)
{
// Each example function needs to get called here, or it won't execute
// as part of the test.
Expand Down
Loading
Loading