From aaa099714d4b0d6ce4ae7ff44c6925ec276f149a Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Tue, 28 Jan 2025 15:14:36 -0600 Subject: [PATCH] ENH: Update cookie cutter package versions Update various package versions to match the recent minimums and recommendations. --- .github/workflows/build-test-package.yml | 72 ++--- .github/workflows/clang-format-linter.yml | 2 +- {{cookiecutter.project_name}}/.clang-format | 249 +++++++++++++++--- .../.github/workflows/build-test-package.yml | 4 +- {{cookiecutter.project_name}}/CMakeLists.txt | 2 +- .../examples/CMakeLists.txt | 2 +- 6 files changed, 251 insertions(+), 80 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 6ac1cc1..4d794ca 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -9,11 +9,11 @@ on: - main env: - # v5.4.0 + additional patches on the release-5.4 branch - itk-git-tag: "49413c3a9e8ecf0f912534e7c13f4c7bc3799d60" - itk-wheel-tag: "v5.4.0" - # v5.4.0 + fixes - itk-python-package-tag: "830d14cc40199f438001ee493288139fb75bba92" + # v6.0a02 + itk-git-tag: "v6.0a02" + itk-wheel-tag: "v6.0a02" + # v6.0a02 + fixes + itk-python-package-tag: "v6.0a02" itk-python-package-org: "InsightSoftwareConsortium" jobs: @@ -22,9 +22,10 @@ jobs: strategy: max-parallel: 3 matrix: - os: [ubuntu-22.04, windows-2022, macos-13, macos-14] + # runners macos-13 is x86_64, macos-15 is arm64 by default + os: [ubuntu-24.04, windows-2022, macos-13, macos-15] include: - - os: ubuntu-22.04 + - os: ubuntu-24.04 c-compiler: "gcc" cxx-compiler: "g++" cmake-build-type: "MinSizeRel" @@ -36,22 +37,24 @@ jobs: c-compiler: "clang" cxx-compiler: "clang++" cmake-build-type: "MinSizeRel" - - os: macos-14 + deployment_target: '10.9' + - os: macos-15 c-compiler: "clang" cxx-compiler: "clang++" cmake-build-type: "MinSizeRel" + deployment_target: '13.0' steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - name: Free Disk Space (Ubuntu) - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' uses: jlumbroso/free-disk-space@v1.3.1 with: large-packages: false - name: Set up Python 3.11 - uses: actions/setup-python@v5 + uses: actions/setup-python@v5.4.0 with: python-version: "3.11" @@ -62,17 +65,17 @@ jobs: python -m pip install cookiecutter - name: Get specific version of CMake, Ninja - uses: lukka/get-cmake@v3.29.0 + uses: lukka/get-cmake@v3.31.5 - - name: 'Specific XCode version' + - name: 'Specific XCode version 14.3.1' if: matrix.os == 'macos-13' run: | sudo xcode-select -s "/Applications/Xcode_14.3.1.app" - - name: 'Specific XCode version' - if: matrix.os == 'macos-14' + - name: 'Specific XCode version 16.2' + if: matrix.os == 'macos-15' run: | - sudo xcode-select -s "/Applications/Xcode_15.0.1.app" + sudo xcode-select -s "/Applications/Xcode_16.2.app" - name: Download ITK run: | @@ -170,14 +173,14 @@ jobs: ctest --output-on-failure -j 2 -V -S dashboard.cmake build-linux-python-packages: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: max-parallel: 2 matrix: - python-version: ["39", "310", "311"] + python-version: ["39", "310", "311","312","313"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - name: 'Free up disk space' run: | @@ -195,12 +198,12 @@ jobs: unzstd --version - name: Set up Python 3.11 - uses: actions/setup-python@v5 + uses: actions/setup-python@v5.4.0 with: python-version: "3.11" - name: Get specific version of CMake, Ninja - uses: lukka/get-cmake@v3.29.0 + uses: lukka/get-cmake@v3.31.5 - name: Evaluate template shell: bash @@ -227,7 +230,7 @@ jobs: done - name: Publish Python package as GitHub Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4.6.0 with: name: LinuxWheel3${{ matrix.python-version }} path: Evaluated/ITKModuleTemplate/dist @@ -237,17 +240,17 @@ jobs: strategy: max-parallel: 2 matrix: - python3-minor-version: ["9", "10", "11"] + python3-minor-version: ["9", "10", "11", "12", "13"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - name: 'Specific XCode version' run: | sudo xcode-select -s "/Applications/Xcode_14.3.1.app" - name: Get specific version of CMake, Ninja - uses: lukka/get-cmake@v3.29.0 + uses: lukka/get-cmake@v3.31.5 - name: 'Fetch build script' run: | @@ -255,7 +258,7 @@ jobs: chmod u+x macpython-download-cache-and-build-module-wheels.sh - name: Set up Python 3.11 - uses: actions/setup-python@v5 + uses: actions/setup-python@v5.4.0 with: python-version: "3.11" @@ -272,11 +275,12 @@ jobs: export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }} export ITKPYTHONPACKAGE_TAG=${{ env.itk-python-package-tag }} export ITKPYTHONPACKAGE_ORG=${{ env.itk-python-package-org }} - export MACOSX_DEPLOYMENT_TARGET=10.9 + # For Xcode 16.2, the recommended "MACOSX_DEPLOYMENT_TARGET" is "13.0"; this means your application should be built to run on macOS Ventura (version 13.0) or later. + export MACOSX_DEPLOYMENT_TARGET=${{ matrix.deployment_target || '13.0' }} ../../macpython-download-cache-and-build-module-wheels.sh "3.${{ matrix.python3-minor-version }}" - name: Publish Python package as GitHub Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4.6.0 with: name: MacOSWheel3${{ matrix.python3-minor-version }} path: Evaluated/ITKModuleTemplate/dist @@ -289,7 +293,7 @@ jobs: python-version-minor: ["9", "10", "11"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - name: 'Install Python' run: | @@ -297,15 +301,15 @@ jobs: $pythonVersion = "3.${{ matrix.python-version-minor }}" iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1')) - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v5.4.0 with: python-version: '3.x' - name: Get specific version of CMake, Ninja - uses: lukka/get-cmake@v3.29.0 + uses: lukka/get-cmake@v3.31.5 - - name: Set up Python 3.11 - uses: actions/setup-python@v5 + - name: Set up Python 3.11/ + uses: actions/setup-python@v5.4.0 with: python-version: "3.11" @@ -347,7 +351,7 @@ jobs: C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" - name: Publish Python package as GitHub Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4.6.0 with: name: WindowsWheel3.${{ matrix.python-version-minor }} path: Evaluated/ITKModuleTemplate/dist diff --git a/.github/workflows/clang-format-linter.yml b/.github/workflows/clang-format-linter.yml index edfc71e..306c0ec 100644 --- a/.github/workflows/clang-format-linter.yml +++ b/.github/workflows/clang-format-linter.yml @@ -7,6 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master diff --git a/{{cookiecutter.project_name}}/.clang-format b/{{cookiecutter.project_name}}/.clang-format index 92c5002..45b9502 100644 --- a/{{cookiecutter.project_name}}/.clang-format +++ b/{{cookiecutter.project_name}}/.clang-format @@ -1,4 +1,4 @@ -## This config file is only relevant for clang-format version 8.0.0 +## This config file is only relevant for clang-format version 19.1.4 ## ## Examples of each format style can be found on the in the clang-format documentation ## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option @@ -10,142 +10,309 @@ ## maintaining a consistent code style. ## ## EXAMPLE apply code style enforcement before commit: -# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --modified +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --modified ## EXAMPLE apply code style enforcement after commit: -# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --last +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --last --- -# This configuration requires clang-format version 8.0.0 exactly. -BasedOnStyle: Mozilla +# This configuration requires clang-format version 19.1.4 exactly. Language: Cpp AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: true +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseArrows: false + AlignCaseColons: false +AlignConsecutiveTableGenBreakingDAGArgColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenCondOperatorColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false AlignEscapedNewlines: Left -AlignOperands: true -AlignTrailingComments: true -# clang 9.0 AllowAllArgumentsOnNextLine: true -# clang 9.0 AllowAllConstructorInitializersOnNextLine: true +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: false +AllowBreakBeforeNoexceptSpecifier: Never +AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline -# clang 9.0 AllowShortLambdasOnASingleLine: All -# clang 9.0 features AllowShortIfStatementsOnASingleLine: Never -AllowShortIfStatementsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true +#AllowShortFunctionsOnASingleLine: Inline Only merge functions defined inside a class. Implies empty. +#AllowShortFunctionsOnASingleLine: None (in configuration: None) Never merge functions into a single line. +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: All AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: + - __capability BinPackArguments: false BinPackParameters: false -BreakBeforeBraces: Custom +BitFieldColonSpacing: Both BraceWrapping: - # clang 9.0 feature AfterCaseLabel: false + AfterCaseLabel: true AfterClass: true - AfterControlStatement: true + AfterControlStatement: Always AfterEnum: true + AfterExternBlock: true AfterFunction: true AfterNamespace: true AfterObjCDeclaration: true AfterStruct: true AfterUnion: true - AfterExternBlock: true BeforeCatch: true BeforeElse: true -## This is the big change from historical ITK formatting! -# Historically ITK used a style similar to https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style -# with indented braces, and not indented code. This style is very difficult to automatically -# maintain with code beautification tools. Not indenting braces is more common among -# formatting tools. + BeforeLambdaBody: false + BeforeWhile: false IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterJavaFieldAnnotations: false +BreakAfterReturnType: All +BreakArrays: true BreakBeforeBinaryOperators: None -#clang 6.0 BreakBeforeInheritanceComma: true -BreakInheritanceList: BeforeComma +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Custom +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -#clang 6.0 BreakConstructorInitializersBeforeComma: true BreakConstructorInitializers: BeforeComma -BreakAfterJavaFieldAnnotations: false +BreakFunctionDefinitionParameters: false +BreakInheritanceList: BeforeComma BreakStringLiterals: true +BreakTemplateDeclarations: Yes ## The following line allows larger lines in non-documentation code ColumnLimit: 120 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 Cpp11BracedListStyle: false DerivePointerAlignment: false DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE IncludeBlocks: Preserve IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 2 + SortPriority: 0 + CaseSensitive: false - Regex: '^(<|"(gtest|gmock|isl|json)/)' Priority: 3 + SortPriority: 0 + CaseSensitive: false - Regex: '.*' Priority: 1 + SortPriority: 0 + CaseSensitive: false IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false IndentCaseLabels: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true IndentPPDirectives: AfterHash +IndentRequiresClause: true IndentWidth: 2 IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: true + AtStartOfFile: true +LambdaBodyIndentation: Signature +LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' +MainIncludeChar: Quote MaxEmptyLinesToKeep: 2 NamespaceIndentation: None ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: false +PackConstructorInitializers: BinPack PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 ## The following line allows larger lines in non-documentation code PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Middle +PPIndentWidth: -1 +QualifierAlignment: Custom +QualifierOrder: + - friend + - static + - inline + - constexpr + - const + - type +ReferenceAlignment: Pointer ReflowComments: true +RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SkipMacroDefinitionBody: false # We may want to sort the includes as a separate pass -SortIncludes: false +SortIncludes: Never +SortJavaStaticImport: Before # We may want to revisit this later -SortUsingDeclarations: false +SortUsingDeclarations: Never SpaceAfterCStyleCast: false -# SpaceAfterLogicalNot: false +SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterPlacementOperator: true + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyParentheses: false +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false +SpacesInAngles: Never SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + ExceptDoubleParentheses: false + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false -Standard: Cpp11 +Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION + - ITK_GCC_PRAGMA_PUSH + - ITK_GCC_PRAGMA_POP + - ITK_GCC_SUPPRESS_Wfloat_equal + - ITK_GCC_SUPPRESS_Wformat_nonliteral + - ITK_GCC_SUPPRESS_Warray_bounds + - ITK_CLANG_PRAGMA_PUSH + - ITK_CLANG_PRAGMA_POP + - ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant + - CLANG_PRAGMA_PUSH + - CLANG_PRAGMA_POP + - CLANG_SUPPRESS_Wfloat_equal + - INTEL_PRAGMA_WARN_PUSH + - INTEL_PRAGMA_WARN_POP + - INTEL_SUPPRESS_warning_1292 + - itkTemplateFloatingToIntegerMacro + - itkLegacyMacro +TableGenBreakInsideDAGArg: DontBreak TabWidth: 2 UseTab: Never +VerilogBreakBetweenInstancePorts: true +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE ... diff --git a/{{cookiecutter.project_name}}/.github/workflows/build-test-package.yml b/{{cookiecutter.project_name}}/.github/workflows/build-test-package.yml index bb1efe9..5b46268 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/build-test-package.yml +++ b/{{cookiecutter.project_name}}/.github/workflows/build-test-package.yml @@ -12,9 +12,9 @@ on: jobs: cxx-build-workflow: - uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@v5.4.0 + uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@v5.4.2 python-build-workflow: - uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@v5.4.0 + uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@v5.4.2 secrets: pypi_password: ${{ "{{" }} secrets.pypi_password {{ "}}" }} diff --git a/{{cookiecutter.project_name}}/CMakeLists.txt b/{{cookiecutter.project_name}}/CMakeLists.txt index 93d2437..c06d3a0 100644 --- a/{{cookiecutter.project_name}}/CMakeLists.txt +++ b/{{cookiecutter.project_name}}/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16.3) +cmake_minimum_required(VERSION 3.22.1...3.29.0 FATAL_ERROR) project({{ cookiecutter.module_name }}) set({{ cookiecutter.module_name }}_LIBRARIES {{ cookiecutter.module_name }}) diff --git a/{{cookiecutter.project_name}}/examples/CMakeLists.txt b/{{cookiecutter.project_name}}/examples/CMakeLists.txt index 204c066..eb5c2c3 100644 --- a/{{cookiecutter.project_name}}/examples/CMakeLists.txt +++ b/{{cookiecutter.project_name}}/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16.3) +cmake_minimum_required(VERSION 3.22.1...3.29.0 FATAL_ERROR) project({{ cookiecutter.module_name }}Examples) set(ExampleSpecificComponents