Skip to content
Closed
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
119 changes: 119 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: C++ CI

on:
push:
branches: [main, develop, cpp-migration]
paths:
- "auv_cpp/**"
- ".github/workflows/cpp.yml"
pull_request:
branches: [main, develop, cpp-migration]
paths:
- "auv_cpp/**"

jobs:
format-check:
name: Format Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t auv-cpp auv_cpp/

- name: Check clang-format
run: |
docker run --rm auv-cpp bash -c "
find src include tests -name '*.cpp' -o -name '*.hpp' -o -name '*.h' 2>/dev/null | \
xargs -r clang-format --dry-run --Werror
"

lint:
name: Static Analysis
runs-on: ubuntu-latest
needs: format-check

steps:
- uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t auv-cpp auv_cpp/

- name: Run clang-tidy
run: |
docker run --rm auv-cpp bash -c "
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_TESTS=ON && \
find src -name '*.cpp' 2>/dev/null | xargs -r clang-tidy -p build --quiet
"
continue-on-error: true

build-test:
name: Build & Test (${{ matrix.build_type }})
runs-on: ubuntu-latest
needs: format-check

strategy:
matrix:
build_type: [Debug, Release]

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: auv_cpp
load: true
tags: auv-cpp:${{ matrix.build_type }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and Test
run: |
docker run --rm auv-cpp:${{ matrix.build_type }} bash -c "
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DBUILD_TESTS=ON \
${{ matrix.build_type == 'Debug' && '-DCMAKE_CXX_FLAGS=--coverage' || '' }} && \
cmake --build build && \
ctest --test-dir build --output-on-failure
"

coverage:
name: Code Coverage
runs-on: ubuntu-latest
needs: build-test

steps:
- uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t auv-cpp auv_cpp/

- name: Build with coverage and run tests
run: |
docker run --rm -v ${{ github.workspace }}/coverage:/coverage auv-cpp bash -c "
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DCMAKE_CXX_FLAGS='--coverage' && \
cmake --build build && \
ctest --test-dir build --output-on-failure && \
lcov --capture --directory build \
--output-file /coverage/coverage.info --ignore-errors mismatch && \
lcov --remove /coverage/coverage.info '/usr/*' '*/tests/*' \
--output-file /coverage/coverage.info --ignore-errors unused
"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage/coverage.info
flags: cpp
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
103 changes: 103 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Frontend CI

on:
push:
branches: [main, develop]
paths:
- "web_app/frontend_gui/**"
- ".github/workflows/frontend.yml"
pull_request:
branches: [main, develop]
paths:
- "web_app/frontend_gui/**"

jobs:
lint:
name: Lint & Format Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: web_app/frontend_gui
load: true
tags: frontend:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: ESLint check
run: docker run --rm frontend npm run lint
continue-on-error: true # Don't block until existing issues are fixed

- name: Prettier check
run: docker run --rm frontend npm run format:check
continue-on-error: true # Don't block until existing issues are fixed

typecheck:
name: Type Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t frontend web_app/frontend_gui/

- name: TypeScript type check
run: docker run --rm frontend npm run typecheck
continue-on-error: true # Don't block until existing issues are fixed

build:
name: Build
runs-on: ubuntu-latest
# Removed dependency on lint/typecheck so build runs even if they fail

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: web_app/frontend_gui
load: true
tags: frontend:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build production bundle
run: docker run --rm frontend npm run build

test:
name: Tests
runs-on: ubuntu-latest
needs: lint

steps:
- uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t frontend web_app/frontend_gui/

- name: Run Vitest with coverage
run: |
docker run --rm -v ${{ github.workspace }}/coverage:/app/coverage frontend \
npm run test:coverage
continue-on-error: true

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: coverage/coverage-final.json
flags: frontend
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Pre-commit hooks for Neptune repository (C++ and Frontend only)
# Install: pip install pre-commit && pre-commit install
# Run manually: pre-commit run --all-files

repos:
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: check-merge-conflict

# C++ - clang-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
files: ^auv_cpp/.*\.(cpp|hpp|h)$
args: [--style=file]

# TypeScript/JavaScript - ESLint + Prettier
# NOTE: Disabled locally - CI will run these checks
# To lint manually: cd web_app/frontend_gui && npm run lint
# To format: cd web_app/frontend_gui && npm run format

# YAML validation
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: [-c, .yamllint.yml]
files: \.(yaml|yml)$

ci:
autofix_commit_msg: "style: auto-fix by pre-commit hooks"
autoupdate_commit_msg: "chore: update pre-commit hooks"
15 changes: 15 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extends: default

rules:
line-length:
max: 120
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
truthy:
allowed-values: ["true", "false", "on", "off", "yes", "no"]
comments:
min-spaces-from-content: 1
document-start: disable
indentation:
spaces: 2
indent-sequences: true
30 changes: 30 additions & 0 deletions auv_cpp/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
Checks: >
-*,
bugprone-*,
clang-analyzer-*,
cppcoreguidelines-*,
modernize-*,
performance-*,
readability-*,
-modernize-use-trailing-return-type,
-readability-magic-numbers,
-cppcoreguidelines-avoid-magic-numbers,
-readability-identifier-length,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay

WarningsAsErrors: ''

HeaderFilterRegex: '.*'

CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.ConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.NamespaceCase
value: lower_case
13 changes: 13 additions & 0 deletions auv_cpp/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Ignore build artifacts
build/
cmake-build-*/

# IDE files
.idea/
.vscode/
*.swp
*.swo

# Git
.git/
.gitignore
25 changes: 25 additions & 0 deletions auv_cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM debian:bookworm-slim

# Install build tools and C++ dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
git \
clang-format \
clang-tidy \
# C++ dependencies (from CLAUDE.md section 5.5)
libeigen3-dev \
libboost-all-dev \
libyaml-cpp-dev \
# Testing & coverage
lcov \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy source code
COPY . .

# Default command: build and test
CMD ["bash", "-c", "cmake -B build -G Ninja -DBUILD_TESTS=ON && cmake --build build && ctest --test-dir build --output-on-failure"]
9 changes: 9 additions & 0 deletions auv_cpp/src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
add_library(auv_core INTERFACE)

target_include_directories(auv_core INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/..
)

target_link_libraries(auv_core INTERFACE
Eigen3::Eigen
)
Loading
Loading