Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# clang-tidy configuration for vv.
#
# Pragmatic check set for a Qt + VTK C++17 codebase: catch real bugs and obvious
# modernization/perf wins, but silence checks that fight the frameworks (VTK's
# vtkNew/raw-pointer idioms, Qt's parent-owned `new`, C-array VTK APIs).
Checks: >
clang-analyzer-*,
bugprone-*,
performance-*,
portability-*,
modernize-*,
readability-*,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,
-readability-magic-numbers,
-readability-identifier-length,
-readability-function-cognitive-complexity,
-readability-braces-around-statements,
-readability-implicit-bool-conversion,
-readability-named-parameter,
-readability-uppercase-literal-suffix,
-readability-math-missing-parentheses,
-portability-avoid-pragma-once,
-performance-enum-size,
-modernize-return-braced-init-list,
-modernize-use-emplace,
-modernize-use-equals-default,
-modernize-loop-convert,
-modernize-avoid-c-style-cast,
-modernize-use-auto,
-readability-isolate-declaration,
-readability-qualified-auto,
-readability-simplify-boolean-expr,
-readability-use-std-min-max,
-readability-container-size-empty,
-readability-use-concise-preprocessor-directives,
-readability-redundant-casting,
-bugprone-float-loop-counter,
-clang-analyzer-security.FloatLoopCounter,
-performance-inefficient-string-concatenation

# Only diagnose our own headers, not VTK/Qt system headers.
HeaderFilterRegex: 'src/include/.*\.h$'

# Real bug-class findings fail CI; modernize/readability stay advisory so a newer
# clang-tidy adding stricter style checks doesn't unexpectedly break the build.
WarningsAsErrors: 'bugprone-*,clang-analyzer-*,performance-*,portability-*'

FormatStyle: file
24 changes: 24 additions & 0 deletions .cppcheck-suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# cppcheck suppressions for vv.
# Format: <id>[:<file>[:<line>]] — see `cppcheck --help`.

# Generated Qt moc/autogen translation units live under build/ and are not our
# code. They trip preprocessorErrorDirective ("doesn't include <QObject>") and
# similar because cppcheck evaluates them without Qt's moc context.
*:build/*
*:*/build/*
*:*moc_*.cpp
*:*mocs_compilation.cpp

# Public widget/API methods (e.g. PlaybackBar::isPlaying) are intentionally part
# of the class surface even when the current callers don't use them all.
unusedFunction

# Third-party headers we cannot fix; not worth the noise.
missingIncludeSystem

# cppcheck's own informational notices.
checkersReport

# Subjective style rule: a short, clear raw loop is often more readable than an
# <algorithm> call with a lambda. We don't enforce this.
useStlAlgorithm
185 changes: 42 additions & 143 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,163 +14,62 @@ concurrency:
env:
CI: true

# Fast quality gate: format, a warnings-as-errors build, and cppcheck — all on a
# single Linux runner with ccache. Multi-OS packaging runs only on release tags
# (see release.yml), so PRs are not blocked on slow cross-platform builds.
jobs:
quality:
runs-on: ubuntu-22.04
name: Format + Warning-Clean Build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
clang-format \
qtbase5-dev \
libfmt-dev \
libcxxopts-dev \
libvtk9-dev \
libvtk9-qt-dev \
pkg-config \
bison \
flex \
libxmu-dev \
libxi-dev \
libgl-dev \
libxt-dev \
libsm-dev \
libice-dev \
libxext-dev \
libxrender-dev \
libxrandr-dev \
libxcursor-dev \
libxinerama-dev \
libx11-dev \
mesa-common-dev \
freeglut3-dev

- name: Configure CMake
run: |
cmake -Bbuild -S. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DVV_ENABLE_WARNINGS=ON \
-DVV_WARNINGS_AS_ERRORS=ON \
-GNinja

- name: Check formatting
run: |
cmake --build build --target format
git diff --exit-code

- name: Build
run: cmake --build build --config Release -j$(nproc)

- name: Test binary
run: |
file build/vv
ldd build/vv || true
./build/vv --help

release-os-build:
name: Release OS Build ${{ matrix.target }}
needs: quality
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: x86_64-w64-mingw32
os: windows-latest
- target: x86_64-apple-darwin
os: macos-15-intel
- target: aarch64-apple-darwin
os: macos-14

name: Format + Warnings + cppcheck
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Linux dependencies
if: runner.os == 'Linux'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
qtbase5-dev \
libvtk9-dev \
libvtk9-qt-dev \
libfmt-dev \
libcxxopts-dev

- name: Install macOS dependencies
if: runner.os == 'macOS'
run: |
brew update
for pkg in cmake ninja vtk qt fmt cxxopts; do
brew list --versions "$pkg" >/dev/null || brew install "$pkg"
done

- name: Set up MSYS2 (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build ccache clang-format clang-tidy cppcheck \
qtbase5-dev libfmt-dev libcxxopts-dev nlohmann-json3-dev \
libvtk9-dev libvtk9-qt-dev \
libgl-dev libglx-dev libxt-dev

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-qt6-base
mingw-w64-x86_64-vtk
mingw-w64-x86_64-nlohmann-json
key: ccache-${{ github.workflow }}-ubuntu-22.04
max-size: 500M

- name: Configure CMake (Linux)
if: runner.os == 'Linux'
- name: Configure
run: |
cmake -S . -B build \
-GNinja \
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DVV_ENABLE_WARNINGS=ON \
-DVV_WARNINGS_AS_ERRORS=ON

- name: Configure CMake (macOS)
if: runner.os == 'macOS'
run: |
QT_PREFIX="$(brew --prefix qt)"
VTK_PREFIX="$(brew --prefix vtk)"
cmake -S . -B build \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DVV_ENABLE_WARNINGS=ON \
-DVV_WARNINGS_AS_ERRORS=ON \
-DCMAKE_PREFIX_PATH="$QT_PREFIX;$VTK_PREFIX"

- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
- name: Check formatting
run: |
cmake -S . -B build \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DVV_ENABLE_WARNINGS=ON \
-DVV_WARNINGS_AS_ERRORS=ON \
-DCMAKE_PREFIX_PATH="/mingw64"

- name: Build (Linux/macOS)
if: runner.os != 'Windows'
run: cmake --build build --config Release -j4

- name: Build (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: cmake --build build --config Release -j4
cmake --build build --target format
git diff --exit-code

- name: Build (warnings as errors)
run: cmake --build build -j"$(nproc)"

# Static analysis via build.sh so local and CI share the exact same flags,
# suppressions, and version probes (build already done above; --no-build
# just regenerates compile_commands and runs the analyzer).
- name: cppcheck (gate)
run: ./build.sh --no-build --cppcheck

# clang-tidy is advisory in CI: the runner's clang-tidy version differs from
# developers' and can surface version-specific findings, so it reports
# without blocking the merge. `build.sh --analyze` gates it locally.
- name: clang-tidy (advisory)
continue-on-error: true
run: ./build.sh --no-build --clang-tidy

- name: Smoke test
run: ./build/vv --version
Loading
Loading