From ff530bb0b59dd468c0d70522ab225835da68e021 Mon Sep 17 00:00:00 2001 From: Julian Lenz Date: Tue, 29 Oct 2024 07:48:18 +0100 Subject: [PATCH 1/4] Add .pre-commit-config.yaml --- .pre-commit-config.yaml | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..fdbcfc38 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,51 @@ +minimum_pre_commit_version: 3.2.0 # necessitated by Lucas-C's hooks +default_install_hook_types: [pre-commit, pre-push] +exclude: | + (?x)^( + alpaka/.*| + thirdParty/.* + )$ +repos: + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v18.1.8 + hooks: + - id: clang-format + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: no-commit-to-branch + args: [-b, dev] + - id: check-merge-conflict + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-toml + - id: check-yaml + args: ["--allow-multiple-documents"] + - id: mixed-line-ending + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.4 + hooks: + - id: forbid-tabs + - id: remove-tabs + - id: forbid-crlf + - id: remove-crlf + - repo: https://github.com/brutus/enforce-ascii + rev: v0.2.1 + hooks: + - id: enforce-ascii + types_or: [file] + exclude_types: [rst, tex, tsv, jupyter, markdown] + exclude: .zenodo.json + - repo: meta + hooks: + - id: check-useless-excludes + - repo: https://github.com/google/yamlfmt + rev: v0.13.0 + hooks: + - id: yamlfmt + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint From 85a1e480b1c5de6830d2c0f364abb1ca7706da07 Mon Sep 17 00:00:00 2001 From: Third Party Date: Tue, 29 Oct 2024 14:35:41 +0100 Subject: [PATCH 2/4] Run pre-commit --- .clang-format | 17 +++++-------- .clang-tidy | 5 ++-- .pre-commit-config.yaml | 1 + .travis.yml | 56 ----------------------------------------- .yamllint | 6 +++++ .zenodo.json | 1 - CHANGELOG.md | 4 +-- tests/verify_heap.cpp | 2 +- 8 files changed, 18 insertions(+), 74 deletions(-) delete mode 100644 .travis.yml create mode 100644 .yamllint diff --git a/.clang-format b/.clang-format index f13db6ff..63ec7485 100644 --- a/.clang-format +++ b/.clang-format @@ -1,9 +1,7 @@ ---- # General options Language: Cpp Standard: c++20 DisableFormat: false - AccessModifierOffset: -4 AlignAfterOpenBracket: AlwaysBreak AlignConsecutiveAssignments: false @@ -35,7 +33,7 @@ BreakConstructorInitializers: BeforeComma BreakInheritanceList: BeforeComma BreakStringLiterals: true ColumnLimit: 119 -CommentPragmas: '^ COMMENT pragma:' +CommentPragmas: "^ COMMENT pragma:" CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 @@ -46,8 +44,8 @@ DerivePointerAlignment: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true IncludeBlocks: Regroup -IncludeIsMainRegex: '(Test)?$' -IncludeIsMainSourceRegex: '' +IncludeIsMainRegex: "(Test)?$" +IncludeIsMainSourceRegex: "" IndentCaseBlocks: true IndentCaseLabels: false IndentExternBlock: AfterExternBlock @@ -56,8 +54,8 @@ IndentPPDirectives: AfterHash IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: '' -MacroBlockEnd: '' +MacroBlockBegin: "" +MacroBlockEnd: "" MaxEmptyLinesToKeep: 2 NamespaceIndentation: All PenaltyBreakAssignment: 2 @@ -84,7 +82,7 @@ SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false +SpacesInAngles: false SpacesInConditionalStatement: false SpacesInContainerLiterals: false SpacesInCStyleCastParentheses: false @@ -94,7 +92,6 @@ SpaceBeforeSquareBrackets: false TabWidth: 4 UseCRLF: false UseTab: Never - # Project specific options -- uncomment and modify as needed #IncludeCategories: # - Regex: '^"(llvm|llvm-c|clang|clang-c)/' @@ -110,5 +107,3 @@ UseTab: Never # Future options - not supported in clang-format 11 # BitFieldColonSpacing: Both # OperandAlignmentStyle: Align - -... diff --git a/.clang-tidy b/.clang-tidy index 3292a65b..fad3f751 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,3 +1,2 @@ ---- -Checks: '*,-llvm-header-guard,-fuchsia-default-arguments-declarations,-cppcoreguidelines-no-malloc,-cppcoreguidelines-owning-memory,-misc-non-private-member-variables-in-classes' -HeaderFilterRegex: '.*' +Checks: "*, -llvm-header-guard, -fuchsia-default-arguments-declarations, -cppcoreguidelines-no-malloc, -cppcoreguidelines-owning-memory, -misc-non-private-member-variables-in-classes" +HeaderFilterRegex: ".*" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fdbcfc38..5d15b78d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,7 @@ repos: rev: v18.1.8 hooks: - id: clang-format + files: \.(cpp|hpp) - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9f988a73..00000000 --- a/.travis.yml +++ /dev/null @@ -1,56 +0,0 @@ -language: cpp - -sudo: required - -dist: bionic - -cache: - apt: true - directories: - - $HOME/.cache/cmake-3.15.0 - -compiler: - - gcc - -env: - global: - - INSTALL_DIR=~/mylibs - - CXXFLAGS="-Werror" - - PATH: $HOME/.cache/cmake-3.15.0/bin:$PATH - -install: - if [ ! -f $HOME/.cache/cmake-3.15.0/bin/cmake ]; then - wget -O cmake.sh https://cmake.org/files/v3.15/cmake-3.15.0-Linux-x86_64.sh && - sh cmake.sh --skip-license --exclude-subdir --prefix=$HOME/.cache/cmake-3.15.0 && - rm cmake.sh; - fi; - -script: - - mkdir build_tmp && cd build_tmp - - CXX=g++-5 && CC=gcc-5 - - cmake -DALPAKA_ACC_GPU_CUDA_ENABLE=ON -DALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE=ON -DALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $TRAVIS_BUILD_DIR - - make - - make install - - make examples - - make tests - -before_script: - - cat /etc/apt/sources.list - - cat /etc/apt/sources.list.d/* - - sudo apt-add-repository multiverse - - sudo apt-get update -qq - - sudo dpkg --configure -a - - sudo apt-get install -f -qq - - sudo dpkg --get-selections | grep hold || { echo "All packages OK."; } - - sudo apt-get install -qq build-essential g++-5 - - gcc-5 --version && g++-5 --version # 5.5.0 - - apt-cache search nvidia-* - - sudo apt-get install -qq nvidia-common - - sudo apt-get install -qq nvidia-cuda-dev nvidia-cuda-toolkit # 9.1.85 - - sudo apt-get install -qq libboost-dev # 1.65.1 - - sudo find /usr/ -name libcuda*.so - - cmake --version - -after_script: - - ls -halR $INSTALL_DIR - diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..369e6ca9 --- /dev/null +++ b/.yamllint @@ -0,0 +1,6 @@ +extends: default +rules: + document-start: disable + truthy: disable + comments: disable + line-length: disable diff --git a/.zenodo.json b/.zenodo.json index fd42bd88..d18fdbea 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -49,4 +49,3 @@ } ] } - diff --git a/CHANGELOG.md b/CHANGELOG.md index dd06fcdb..fbfd5fd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Change Log / Release Log for mallocMC **Date:** 2021-02-18 This release removes the native usage of CUDA by alpaka. -Attention: This release depends on an unreleased [alpaka 0.5.0dev](https://github.com/alpaka-group/alpaka/commit/34870a73ecf702069465aa030fbdf301c4d22c61) +Attention: This release depends on an unreleased [alpaka 0.5.0dev](https://github.com/alpaka-group/alpaka/commit/34870a73ecf702069465aa030fbdf301c4d22c61) version before the heavy alpaka namespace refactoring. ### Changes to mallocMC 2.4.0crp @@ -41,7 +41,7 @@ This release removes the Boost dependency and switched to C++11. **Bug fixes** - Choose the value for the -arch nvcc flag depending on CUDA version #164 #165 - + **Misc:** - Travis CI: GCC 5.5.0 + CUDA 9.1.85 #170 - Adding headers to projects and applied clang-tidy #171 diff --git a/tests/verify_heap.cpp b/tests/verify_heap.cpp index 3639dbc7..b6f1a103 100644 --- a/tests/verify_heap.cpp +++ b/tests/verify_heap.cpp @@ -97,7 +97,7 @@ auto main(int argc, char** argv) -> int { if(correct) { - std::cout << "\033[0;32mverification successful ✔\033[0m\n"; + std::cout << "\033[0;32mverification successful \033[0m\n"; return 0; } else From 66a7d4191410a01bbabe59646b111db0fbfc458b Mon Sep 17 00:00:00 2001 From: Julian Lenz Date: Tue, 29 Oct 2024 14:41:07 +0100 Subject: [PATCH 3/4] Add pre-commit lite action --- .github/workflows/ci.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1a1a290..36a5a2cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,16 @@ -name: Continuous Integration -on: [push, pull_request] +name: Pre-commit +on: + pull_request: + push: + branches: [main, test-me-*] jobs: - clang-format: + main: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: DoozyX/clang-format-lint-action@v0.18.2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - exclude: "./thirdParty ./alpaka" - clangFormatVersion: 18 + python-version: 3.x + - uses: pre-commit/action@v3.0.0 + - uses: pre-commit-ci/lite-action@v1.0.1 + if: always() From bd28b52b3298b841a063ad0aac0455f5690956fe Mon Sep 17 00:00:00 2001 From: Julian Lenz Date: Tue, 29 Oct 2024 14:56:28 +0100 Subject: [PATCH 4/4] Remove outdated enforce-ascii from pre-commit config --- .pre-commit-config.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d15b78d..b5368f3f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,13 +32,6 @@ repos: - id: remove-tabs - id: forbid-crlf - id: remove-crlf - - repo: https://github.com/brutus/enforce-ascii - rev: v0.2.1 - hooks: - - id: enforce-ascii - types_or: [file] - exclude_types: [rst, tex, tsv, jupyter, markdown] - exclude: .zenodo.json - repo: meta hooks: - id: check-useless-excludes