Skip to content

Commit

Permalink
Merge branch 'master' of github.com:OpenChemistry/avogadrolibs into c…
Browse files Browse the repository at this point in the history
…lang-tidy-fixes

Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed May 10, 2023
2 parents ae8e8fb + 25ce01a commit 929825b
Show file tree
Hide file tree
Showing 69 changed files with 567 additions and 275 deletions.
40 changes: 16 additions & 24 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
Checks: 'clang-analyzer*,
Checks: 'bugprone*,
clang-analyzer*,
cppcoreguidelines*,
misc-uniqueptr-reset-release,
misc-unused*,
misc-redundant-expression,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-loop-convert,
modernize-macro-to-enum,
modernize-pass-by-value
modernize-raw-string-literal,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-emplace,
modernize-use-nullptr,
modernize-use-override,
modernize-avoid-bind,modernize-concat-nested-namespaces,
modernize-loop-convert,modernize-macro-to-enum,modernize-use-bool-literals,
modernize-use-auto,modernize-use-nullptr,modernize-use-override,
modernize-raw-string-literal,modernize-use-emplace,modernize-pass-by-value,
modernize-use-using,
performance-avoid-endl,
performance-faster*,
performance-for-range-copy,
performance-inefficient*,
performance-move-const-arg,
performance-type-promotion*,
performance-inefficient*,performance-type-promotion*,
performance-unnecessary-copy-initialization,
readability-container-data-pointer,
readability-container-size-empty,
performance-move-const-arg,
readability-const-return-type,
readability-delete-null-pointer,
readability-container*,
readability-duplicate-include,
readability-delete-null-pointer,
readability-qualified-auto,
readability-redundant-access-specifiers,
readability-redundant-declaration,
readability-redundant-string-cstr,
readability-redundant-string-init,
readability-simplify*
-bugprone-easily-swappable-parameters,
readability-redundant*,
readability-simplify*,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-owning-memory,
-readability-else-after-return,
Expand Down
95 changes: 0 additions & 95 deletions .github/workflows/add_clang_tidy.yml

This file was deleted.

44 changes: 26 additions & 18 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ env:
# we set MACOSX_DEPLOYMENT_TARGET later
MACOS_TARGET: 10.12
FEATURES: -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF -DUSE_VTK=ON
CACHE: -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
SCCACHE_GHA_ENABLED: "true"

jobs:
build:
Expand All @@ -26,15 +28,15 @@ jobs:
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
build_type: "Release",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF -DCMAKE_BUILD_TYPE=Release",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
cpack: "",
}
- {
name: "Ubuntu AppImage", artifact: "Avogadro2.AppImage",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "Release",
cmake_flags: "-G Ninja -DINSTALL_BUNDLE_FILES=ON -DCMAKE_BUILD_TYPE=Release",
cmake_flags: "-G Ninja -DINSTALL_BUNDLE_FILES=ON -USE_SYSTEM_ZLIB=ON",
cpack: "",
}
- {
Expand All @@ -50,7 +52,7 @@ jobs:
os: windows-latest,
cc: "cl", cxx: "cl",
build_type: "Release",
cmake_flags: "",
cmake_flags: "-DOPENSSL_ROOT_DIR=D:\\a\\Tools\\OpenSSL\\Win_x64",
build_flags: "-j 2",
cpack_flags: "-G NSIS",
}
Expand All @@ -59,31 +61,31 @@ jobs:
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "asan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
cpack: "",
}
- {
name: "Ubuntu Leak Sanitizer", artifact: "",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "lsan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
cpack: "",
}
- {
name: "Ubuntu Thread Sanitizer", artifact: "",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "tsan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
cpack: "",
}
- {
name: "Ubuntu Undefined Behavior Sanitizer", artifact: "",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "ubsan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
cpack: "",
}

Expand Down Expand Up @@ -124,18 +126,22 @@ jobs:
with:
path: avogadrolibs

- name: Cache Qt
id: cache-qt
uses: actions/cache@v3
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
path: ../Qt
key: ${{ runner.os }}-QtCache
cache: True
version: ${{ env.QT_VERSION }}

- name: Install Qt
- name: Install OpenSSL (Win64)
if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v3
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
cache: True
tools: 'tools_openssl_x64'
version: ${{ env.QT_VERSION }}
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'

- name: Configure MSVC Command Prompt
if: runner.os == 'Windows'
Expand All @@ -148,22 +154,24 @@ jobs:
if: runner.os != 'Windows'
with:
path: |
${{ runner.workspace }}/build/thirdparty
${{ runner.workspace }}/build/Downloads
key: ${{ matrix.config.name }}-thirdparty
key: ${{ matrix.config.name }}-downloads

- name: Run sccache-cache
uses: mozilla-actions/sccache-action@main

- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
# won't have any effect except on Mac
echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} ${{env.CACHE}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash

- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} CMAKE_C_COMPILER_LAUNCHER=sccache CMAKE_CXX_COMPILER_LAUNCHER=sccache cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
shell: bash
working-directory: ${{ runner.workspace }}/build

Expand Down
35 changes: 23 additions & 12 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Static Analysis
name: Clang-Tidy Static Analysis

on:
pull_request:
workflow_dispatch:

env:
FEATURES: -DUSE_VTK=OFF -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF
FEATURES: -DUSE_VTK=ON -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF -DUSE_YAEHMOP=ON
BUILD_TYPE: RelWithDebInfo
QT_VERSION: 5.15.2

Expand Down Expand Up @@ -59,6 +58,15 @@ jobs:
path: avogadrolibs
fetch-depth: 2

- name: Grab cache files
uses: actions/cache@v3
if: runner.os != 'Windows'
with:
path: |
${{ runner.workspace }}/build/thirdparty
${{ runner.workspace }}/build/Downloads
key: ${{ matrix.config.name }}-thirdparty

- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
Expand All @@ -77,25 +85,28 @@ jobs:

- name: Create results directory
run: |
mkdir clang-tidy-result
mkdir ${{ runner.workspace }}/clang-tidy-result
- name: Analyze
run: |
git fetch
pip install pyyaml
git diff -U0 HEAD^ | clang-tidy-diff -p1 -path ../build -export-fixes ../clang-tidy-result/fixes.yml
# generate the fixes and we'll make a diff
run-clang-tidy -p ../build -fix
cd avogadrolibs
pwd
echo "Generating diff"
git diff >${{ runner.workspace }}/clang-tidy-result/tidy.patch
working-directory: ${{ runner.workspace }}/avogadrolibs

- name: Save PR metadata
run: |
echo ${{ github.event.number }} > clang-tidy-result/pr-id.txt
echo ${{ github.event.pull_request.head.repo.full_name }} > clang-tidy-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.ref }} > clang-tidy-result/pr-head-ref.txt
echo ${{ github.event.number }} > ${{ runner.workspace }}/clang-tidy-result/pr-id.txt
echo ${{ github.event.pull_request.head.repo.full_name }} > ${{ runner.workspace }}/clang-tidy-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.ref }} > ${{ runner.workspace }}/clang-tidy-result/pr-head-ref.txt
- uses: actions/upload-artifact@v3
with:
name: clang-tidy-result
path: clang-tidy-result/
path: ${{ runner.workspace }}/clang-tidy-result/

- name: Setup tmate session
if: ${{ failure() }}
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,10 @@ jobs:
sudo apt-get -qq install ninja-build libeigen3-dev libboost-all-dev libglew-dev libxml2-dev
sudo apt-get -qq install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5x11extras5-dev libqt5svg5-dev
- name: Cache Qt
id: cache-qt
uses: actions/cache@v3
with:
path: ../Qt
key: ${{ runner.os }}-QtCache

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
cache: True
version: ${{ env.QT_VERSION }}

- name: Grab cache files
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.23 FATAL_ERROR)
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)

project(AvogadroLibs)

Expand Down Expand Up @@ -54,15 +54,18 @@ option(USE_LIBMSYM "Enable optional features using libmsym" ON)
option(USE_SPGLIB "Enable optional features using spglib" ON)
option(USE_MMTF "Enable optional features using mmtf" ON)
option(USE_PYTHON "Use Python to wrap some of our API" OFF)
option(USE_EXTERNAL_NLOHMANN "Use an externally-provided version of the nlohmann JSON library" OFF)
option(USE_EXTERNAL_PUGIXML "Use an externally-provided version of pugixml" OFF)
option(USE_EXTERNAL_STRUCT "Use an externally-provided version of the struct binary data formatting library" OFF)
set(QT_VERSION "5" CACHE STRING "What major version of Qt")
set(QT_VERSIONS_SUPPORTED 5 6)
set_property(CACHE QT_VERSION PROPERTY STRINGS 5 6)
if(NOT QT_VERSION IN_LIST QT_VERSIONS_SUPPORTED)
message(FATAL_ERROR "Qt version must be one of ${QT_VERSIONS_SUPPORTED}")
endif()

add_subdirectory(utilities)
add_subdirectory(thirdparty)
add_subdirectory(utilities)
add_subdirectory(avogadro)

if(ENABLE_TESTING)
Expand Down Expand Up @@ -114,7 +117,6 @@ if (NOT SKBUILD)
"${AvogadroLibs_BINARY_DIR}/AvogadroLibsConfig.cmake"
"${AvogadroLibs_BINARY_DIR}/AvogadroLibsConfigVersion.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindEigen3.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLIBARCHIVE.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findlibmsym.cmake"
DESTINATION "${INSTALL_LIBRARY_DIR}/cmake/avogadrolibs")
install(EXPORT "AvogadroLibsTargets"
Expand Down
Loading

0 comments on commit 929825b

Please sign in to comment.