Skip to content

Commit

Permalink
Update GA workflow jobs for ubuntu24.04 (#415)
Browse files Browse the repository at this point in the history
* use clang-tidy installed in ubuntu-24.04 runner image

* updated clang-format version to 18.1.3 (same as ubuntu-24.04)

* updated runner image tags for CI jobs in workflows/ubuntu.yml

* updated CONTRIBUTING.md regarding clang-format tool version

* fixed undefined reference link error and coverage loss

* [bot] run clang-format & amalgamation

* fixed coverage loss again
  • Loading branch information
fktn-k authored Oct 26, 2024
1 parent 31d3756 commit f2c4425
Show file tree
Hide file tree
Showing 45 changed files with 1,254 additions and 1,203 deletions.
103 changes: 47 additions & 56 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
Language: Cpp
# BasedOnStyle: Microsoft
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignArrayOfStructures: None
Expand All @@ -9,11 +8,12 @@ AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
Expand All @@ -30,45 +30,43 @@ BinPackArguments: false
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# BreakAfterAttributes: Never # since clang-format 16
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
# BreakArrays: true # since clang-format 16
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Custom
# BreakBeforeInlineASMColon: OnlyMultiline # since clang-format 16
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DeriveLineEnding: true
DisableFormat: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
Expand All @@ -79,20 +77,20 @@ ForEachMacros:
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
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
- 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
Expand All @@ -101,23 +99,19 @@ IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
# IndentRequiresClause: true # since clang-format 15
IndentWidth: 4
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
# InsertBraces: false # since clang-format 15
# InsertNewlineAtEOF: false # since clang-format 16
InsertBraces: false
InsertNewlineAtEOF: true
InsertTrailingCommas: None
# IntegerLiteralSeparator: # since clang-format 16
# Binary: 0
# Decimal: 0
# Hex: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
# LineEnding: DeriveLF # since clang-format 16
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
Expand All @@ -137,14 +131,13 @@ PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Left
PPIndentWidth: -1
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
# RemoveSemicolon: false # since clang-format 16
# RequiresClausePosition: OwnLine # since clang-format 15
# RequiresExpressionIndentation: OuterScope # since clang-format 16
RemoveSemicolon: false
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: Never
Expand All @@ -165,10 +158,8 @@ SpaceBeforeParensOptions:
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterIfMacros: true
AfterOverloadedOperator: false
# AfterRequiresInClause: false
# AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
Expand All @@ -180,18 +171,18 @@ SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
TabWidth: 4
UseTab: Never
UseCRLF: false
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
Expand Down
18 changes: 16 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,42 @@ Checks: '*,
-altera-id-dependent-backward-branch,
-altera-struct-pack-align,
-altera-unroll-loops,
-cert-dcl21-cpp,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-vararg,
-fuchsia-default-arguments-calls,
-fuchsia-default-arguments-declarations,
-fuchsia-overloaded-operator,
-google-explicit-constructor,
-google-readability-todo,
-hicpp-avoid-c-arrays,
-hicpp-explicit-conversions,
-hicpp-signed-bitwise,
-hicpp-uppercase-literal-suffix,
-hicpp-vararg,
-llvm-header-guard,
-llvm-include-order,
-llvmlibc-*,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,
-modernize-type-traits,
-modernize-use-trailing-return-type,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-redundant-access-specifiers'
-readability-redundant-access-specifiers,
-readability-simplify-boolean-expr,
-readability-uppercase-literal-suffix'
WarningsAsErrors: '*'
HeaderFilterRegex: ''
CheckOptions:
Expand All @@ -39,13 +53,13 @@ CheckOptions:
- { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
- { key: readability-identifier-naming.ClassMemberPrefix, value: s_ }
- { key: readability-identifier-naming.PrivateMemberCase, value: lower_case }
- { key: readability-identifier-naming.PrivateMemberPrefix, value: m_ }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
- { key: readability-identifier-naming.ConstantParameterCase, value: lower_case }
- { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.LocalConstantCase, value: lower_case }
- { key: readability-identifier-naming.ConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ConstexprVariableCase, value: lower_case }
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
- { key: readability-identifier-naming.TemplateParameter, value: CamelCase }
- { key: readability-identifier-naming.Namespace, value: lower_case }
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:
jobs:
coverage:
timeout-minutes: 10
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
pull-requests: write

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:

ci_test_clang_tidy:
timeout-minutes: 10
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand All @@ -73,7 +73,7 @@ jobs:

ci_test_iwyu:
timeout-minutes: 10
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ The commands above will automatically install all the dependencies using [Python

### 4. Format source files

[GitHub Actions](https://github.com/fktn-k/fkYAML/actions) will test the updated project with the [Clang-Format](https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormat.html) tool (14.0.0) once you open a PR or push commits afterwards which include changes in the source files under either [`include`](https://github.com/fktn-k/fkYAML/tree/develop/include) or [`test`](https://github.com/fktn-k/fkYAML/tree/develop/test) directories.
[GitHub Actions](https://github.com/fktn-k/fkYAML/actions) will test the updated project with the [Clang-Format](https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.3) tool (18.1.3) once you open a PR or push commits afterwards which include changes in the source files under either [`include`](https://github.com/fktn-k/fkYAML/tree/develop/include) or [`test`](https://github.com/fktn-k/fkYAML/tree/develop/test) directories.
Although code formatting is automatically executed in the GitHub Actions workflows, you can run the script files ([`run_clang_format.bat`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.bat) for Windows, [`run_clang_format.sh`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.sh) otherwise) to check if your changes follow the rules defined in the [`.clang-format`](https://github.com/fktn-k/fkYAML/tree/develop/.clang-format) file on your local environment in advance.
Note that, since the Clang-Format tool does not gurantee backward compatibility especially in its edge cases and its behaviors might therefore vary from version to version, it's highly recommended that you use the above script files to avoid unnecessary confusion for that kind of reason.
The scripts uses [the Clang-Format Python distribution](https://pypi.org/project/clang-format/14.0.0/) and installs it using [the Python venv module](https://docs.python.org/3/library/venv.html) if it's not been installed yet.
The scripts uses [the Clang-Format Python distribution](https://pypi.org/project/clang-format/18.1.3/) and installs it using [the Python venv module](https://docs.python.org/3/library/venv.html) if it's not been installed yet.
You can run the scripts with the following commands:

**Windows (Command Prompt)**
Expand Down
6 changes: 3 additions & 3 deletions include/fkYAML/detail/conversions/from_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ inline void from_node(const BasicNodeType& n, IntegerType& i) {

// under/overflow check.
using node_int_type = typename BasicNodeType::integer_type;
node_int_type tmp_int = n.template get_value_ref<const node_int_type&>();
const node_int_type tmp_int = n.template get_value_ref<const node_int_type&>();
if FK_YAML_UNLIKELY (tmp_int < static_cast<node_int_type>(std::numeric_limits<IntegerType>::min())) {
throw exception("Integer value underflow detected.");
}
Expand Down Expand Up @@ -271,8 +271,8 @@ struct from_node_fn {
/// @param val A target object assigned from the basic_node object.
/// @return decltype(from_node(n, std::forward<T>(val))) void by default. User can set it to some other type.
template <typename BasicNodeType, typename T>
auto operator()(const BasicNodeType& n, T&& val) const noexcept(noexcept(from_node(n, std::forward<T>(val))))
-> decltype(from_node(n, std::forward<T>(val))) {
auto operator()(const BasicNodeType& n, T&& val) const
noexcept(noexcept(from_node(n, std::forward<T>(val)))) -> decltype(from_node(n, std::forward<T>(val))) {
return from_node(n, std::forward<T>(val));
}
};
Expand Down
Loading

0 comments on commit f2c4425

Please sign in to comment.