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
19 changes: 19 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
BasedOnStyle: LLVM
Standard: Latest
IndentWidth: 2
TabWidth: 2
UseTab: Never
ColumnLimit: 100
ContinuationIndentWidth: 4
PointerAlignment: Left
ReferenceAlignment: Left
BreakBeforeBraces: Attach
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
NamespaceIndentation: None
SortIncludes: true
IncludeBlocks: Preserve
ReflowComments: false
...
44 changes: 44 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
Checks: >
-*,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-inaccurate-erase,
bugprone-infinite-loop,
bugprone-macro-parentheses,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-memory-comparison,
bugprone-suspicious-memset-usage,
bugprone-unchecked-optional-access,
bugprone-undefined-memory-manipulation,
bugprone-use-after-move,
performance-for-range-copy,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-no-automatic-move,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
readability-const-return-type,
readability-duplicate-include,
readability-redundant-control-flow,
readability-simplify-boolean-expr
WarningsAsErrors: ""
HeaderFilterRegex: "^(.*(/include/igneous/|/src/).*)$"
FormatStyle: file
CheckOptions:
- key: modernize-use-nullptr.NullMacros
value: "NULL"
...
116 changes: 116 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,119 @@ jobs:
with:
name: compile-commands
path: build-debug/compile_commands.json

lint:
name: Lint (clang-tidy)
runs-on: ubuntu-latest

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

- name: Install lint tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y clang-tidy ripgrep

- name: Checkout vcpkg
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
path: vcpkg

- name: Restore vcpkg cache
uses: actions/cache@v4
with:
path: |
~/.cache/vcpkg/archives
${{ github.workspace }}/vcpkg/downloads
key: vcpkg-${{ runner.os }}-x64-linux-${{ hashFiles('vcpkg.json', 'CMakeLists.txt') }}

- name: Bootstrap vcpkg
shell: bash
run: ./vcpkg/bootstrap-vcpkg.sh

- name: Configure (Lint)
shell: bash
run: >-
cmake -S . -B build-lint -G Ninja
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=x64-linux
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Run clang-tidy (all)
shell: bash
run: IGNEOUS_LINT_SCOPE=all IGNEOUS_LINT_HEADERS=1 IGNEOUS_LINT_JOBS=4 ./scripts/dev/lint.sh build-lint

format-check:
name: Format Check (clang-format)
runs-on: ubuntu-latest

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

- name: Install format tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y python3-pip ripgrep
python3 -m pip install --user clang-format==20.1.3

- name: Run clang-format check
shell: bash
run: |
export IGNEOUS_CLANG_FORMAT_BIN="$HOME/.local/bin/clang-format"
"$IGNEOUS_CLANG_FORMAT_BIN" --version
./scripts/dev/format.sh --check

docs:
name: API Docs (doxygen)
runs-on: ubuntu-latest

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

- name: Install docs tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz

- name: Checkout vcpkg
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
path: vcpkg

- name: Restore vcpkg cache
uses: actions/cache@v4
with:
path: |
~/.cache/vcpkg/archives
${{ github.workspace }}/vcpkg/downloads
key: vcpkg-${{ runner.os }}-x64-linux-${{ hashFiles('vcpkg.json', 'CMakeLists.txt') }}

- name: Bootstrap vcpkg
shell: bash
run: ./vcpkg/bootstrap-vcpkg.sh

- name: Configure (Docs)
shell: bash
run: >-
cmake -S . -B build-docs -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=x64-linux
-DIGNEOUS_BUILD_DOCS=ON

- name: Build docs
shell: bash
run: cmake --build build-docs --target docs

- name: Verify docs output
shell: bash
run: test -f build-docs/docs/html/index.html
80 changes: 80 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Docs

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

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

jobs:
build-docs:
name: Build API Docs
runs-on: ubuntu-latest

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

- name: Install docs tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz

- name: Checkout vcpkg
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
path: vcpkg

- name: Restore vcpkg cache
uses: actions/cache@v4
with:
path: |
~/.cache/vcpkg/archives
${{ github.workspace }}/vcpkg/downloads
key: vcpkg-${{ runner.os }}-x64-linux-${{ hashFiles('vcpkg.json', 'CMakeLists.txt') }}

- name: Bootstrap vcpkg
shell: bash
run: ./vcpkg/bootstrap-vcpkg.sh

- name: Configure (Docs)
shell: bash
run: >-
cmake -S . -B build-docs -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=x64-linux
-DIGNEOUS_BUILD_DOCS=ON

- name: Build docs
shell: bash
run: cmake --build build-docs --target docs

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: build-docs/docs/html

deploy:
name: Deploy to GitHub Pages
needs: build-docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
34 changes: 29 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-Wall -Wextra -Wpedantic)
option(IGNEOUS_BUILD_DOCS "Build Doxygen API documentation target" ON)

if(APPLE)
enable_language(OBJCXX)
Expand Down Expand Up @@ -43,6 +44,28 @@ target_link_libraries(
Spectra::Spectra
igneous_runtime)

if(IGNEOUS_BUILD_DOCS)
find_package(Doxygen QUIET)
if(DOXYGEN_FOUND)
set(IGNEOUS_DOXYFILE_IN ${CMAKE_SOURCE_DIR}/docs/Doxyfile.in)
set(IGNEOUS_DOXYFILE_OUT ${CMAKE_BINARY_DIR}/Doxyfile)
configure_file(${IGNEOUS_DOXYFILE_IN} ${IGNEOUS_DOXYFILE_OUT} @ONLY)
add_custom_target(
docs
COMMAND ${DOXYGEN_EXECUTABLE} ${IGNEOUS_DOXYFILE_OUT}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else()
message(STATUS "Doxygen not found; 'docs' target will print install guidance")
add_custom_target(
docs
COMMAND ${CMAKE_COMMAND} -E echo "Doxygen not found. Install doxygen (and graphviz optionally), then re-run CMake configure."
COMMENT "API docs unavailable: Doxygen not installed"
VERBATIM)
endif()
endif()

enable_testing()

function(add_igneous_test name source)
Expand All @@ -52,8 +75,9 @@ function(add_igneous_test name source)
endfunction()

add_igneous_test(test_algebra tests/test_algebra.cpp)
add_igneous_test(test_topology_triangle tests/test_topology_triangle.cpp)
add_igneous_test(test_topology_diffusion tests/test_topology_diffusion.cpp)
add_igneous_test(test_structure_dec tests/test_structure_dec.cpp)
add_igneous_test(test_structure_diffusion_geometry
tests/test_structure_diffusion_geometry.cpp)
add_igneous_test(test_ops_curvature_flow tests/test_ops_curvature_flow.cpp)
add_igneous_test(test_ops_spectral_geometry tests/test_ops_spectral_geometry.cpp)
add_igneous_test(test_ops_hodge tests/test_ops_hodge.cpp)
Expand Down Expand Up @@ -89,8 +113,8 @@ target_link_libraries(igneous-spectral PRIVATE igneous fmt::fmt)
add_executable(igneous-hodge src/main_hodge.cpp)
target_link_libraries(igneous-hodge PRIVATE igneous fmt::fmt)

add_executable(igneous-diffusion-topology src/main_diffusion_topology.cpp)
target_link_libraries(igneous-diffusion-topology PRIVATE igneous fmt::fmt)
add_executable(igneous-diffusion-geometry src/main_diffusion_geometry.cpp)
target_link_libraries(igneous-diffusion-geometry PRIVATE igneous fmt::fmt)

add_test(
NAME test_hodge_cli_outputs
Expand All @@ -106,7 +130,7 @@ set_tests_properties(test_hodge_parity_optional PROPERTIES LABELS "hodge;parity"
add_test(
NAME test_diffgeo_cli_outputs
COMMAND bash ${CMAKE_SOURCE_DIR}/tests/test_diffgeo_cli_outputs.sh
$<TARGET_FILE:igneous-diffusion-topology>)
$<TARGET_FILE:igneous-diffusion-geometry>)
set_tests_properties(test_diffgeo_cli_outputs PROPERTIES LABELS "diffgeo;cli")

add_test(
Expand Down
Loading