Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Jul 26, 2024
0 parents commit 156ef57
Show file tree
Hide file tree
Showing 24 changed files with 1,342 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: false
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
JavaScriptQuotes: Leave
...
21 changes: 21 additions & 0 deletions .github/scripts/clang-format-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Thin wrapper around clang-format for easier to parse output from the
# pre-commit hook.
#
# Needs to work with multiple input files as pre-commit passes multiple files to
# the "executables"

# Make sure that diff is actually recent enough (diffutils >= 3.4) to support
# colored output
COLOR_OUTPUT=$(diff --color=always <(echo) <(echo) > /dev/null 2>&1 && echo "--color=always")

success=0
for file in ${@}; do
if ! $(clang-format --style=file --Werror --dry-run ${file} > /dev/null 2>&1); then
echo "Necessary changes for: '${file}' (run 'clang-format --style=file -i ${file}' to fix it)"
diff ${COLOR_OUTPUT} -u ${file} <(clang-format --style=file ${file}) | tail -n +3
success=1
fi
done
exit ${success}
16 changes: 16 additions & 0 deletions .github/templates/apache-2.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Copyright (c) ${years} ${owner}.

This file is part of ${projectname}.
See ${projecturl} for further info.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
21 changes: 21 additions & 0 deletions .github/workflows/downstream-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Do not edit this file, it will be overwritten!
# The template file can be found in
# https://github.com/key4hep/key4hep-actions/blob/main/workflows/downstream-build.yaml
name: downstream-build

on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
downstream-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: key4hep/key4hep-actions/downstream-build@main
32 changes: 32 additions & 0 deletions .github/workflows/key4hep-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Do not edit this file, it will be overwritten!
# The template file can be found in
# https://github.com/key4hep/key4hep-actions/blob/main/workflows/key4hep-build.yaml
name: Key4hep build

on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: '16 5 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
matrix:
build_type: ["release", "nightly"]
image: ["alma9", "ubuntu22"]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: key4hep/key4hep-actions/key4hep-build@main
with:
build_type: ${{ matrix.build_type }}
image: ${{ matrix.image }}
17 changes: 17 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: pre-commit

on: [push, pull_request]

jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: cvmfs-contrib/github-action-cvmfs@v3
- name: Run pre-commit
run: |
source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh
cd ${GITHUB_WORKSPACE}
pre-commit run --show-diff-on-failure \
--color=always \
--all-files
Loading

0 comments on commit 156ef57

Please sign in to comment.