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
155 changes: 155 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
release:
types: [ published ]

jobs:
test:
name: Test on ${{ matrix.os }} with ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
compiler: [gcc, clang, msvc]
exclude:
- os: windows-latest
compiler: gcc
- os: windows-latest
compiler: clang
- os: ubuntu-latest
compiler: msvc
- os: macos-latest
compiler: msvc

steps:
- uses: actions/checkout@v4

- name: Setup GCC
if: matrix.compiler == 'gcc'
uses: egor-tensin/setup-gcc@v1
with:
version: 14

- name: Setup Clang
if: matrix.compiler == 'clang'
uses: egor-tensin/setup-clang@v1
with:
version: 19

- name: Setup MSVC
if: matrix.compiler == 'msvc'
uses: microsoft/setup-msbuild@v1.3

- name: Configure CMake (Unix)
if: runner.os != 'Windows'
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}

- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: cmake -B build -DCMAKE_BUILD_TYPE=Release

- name: Build
run: cmake --build build --config Release

- name: Run Tests
run: cmake --build build --target test --config Release

static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y cppcheck clang-tidy

- name: Run cppcheck
run: |
cppcheck --enable=all --std=c++20 --suppress=missingIncludeSystem \
--error-exitcode=1 CatalystCX.hpp

- name: Configure for clang-tidy
run: cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Run clang-tidy
run: |
clang-tidy CatalystCX.hpp -p build --checks='-*,readability-*,performance-*,modernize-*'

sanitizers:
name: Sanitizer Tests
runs-on: ubuntu-latest
strategy:
matrix:
sanitizer: [address, thread, undefined]
steps:
- uses: actions/checkout@v4

- name: Configure with Sanitizers
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }} -g -O1"

- name: Build
run: cmake --build build

- name: Run Tests with Sanitizer
run: cmake --build build --target test

package:
name: Package Release
runs-on: ubuntu-latest
needs: [test, static-analysis]
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4

- name: Create Package
run: |
mkdir -p catalystcx-${{ github.ref_name }}
cp CatalystCX.hpp catalystcx-${{ github.ref_name }}/
cp README.md catalystcx-${{ github.ref_name }}/
cp CMakeLists.txt catalystcx-${{ github.ref_name }}/
tar -czf catalystcx-${{ github.ref_name }}.tar.gz catalystcx-${{ github.ref_name }}/

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./catalystcx-${{ github.ref_name }}.tar.gz
asset_name: catalystcx-${{ github.ref_name }}.tar.gz
asset_content_type: application/gzip

benchmark:
name: Performance Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Configure Optimized Build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-O3 -march=native -DNDEBUG"

- name: Build
run: cmake --build build

- name: Run Benchmarks
run: |
echo "=== Performance Test ==="
time ctest --test-dir build --output-on-failure
echo "=== Memory Usage Test ==="
sudo apt-get update && sudo apt-get install -y valgrind
valgrind --tool=massif --massif-out-file=massif.out \
./build/cxtest 2>/dev/null || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*build*
.amazonq
27 changes: 13 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
cmake_minimum_required(VERSION 3.10)
project(CatalystCX VERSION 0.0.1)
project(CatalystCX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g0")
# Compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O2")

add_executable(CatalystCX
CatalystCX.cpp
)
# Test suite executable
add_executable(cxtest Evaluate.cpp CatalystCX.hpp)

# --- Run Target ---
add_custom_target(run
COMMAND ${CMAKE_COMMAND} -E env "PATH=$ENV{PATH}" ./CatalystCX
DEPENDS CatalystCX
# Custom target to run tests
add_custom_target(test
COMMAND cxtest
DEPENDS cxtest
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

# --- Install Target ---
include(GNUInstallDirs)
# Install header
install(FILES CatalystCX.hpp DESTINATION include)

install(FILES CatalystCX.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
find_package(Threads REQUIRED)
target_link_libraries(cxtest PRIVATE Threads::Threads)
48 changes: 0 additions & 48 deletions CatalystCX.cpp

This file was deleted.

Loading
Loading