Skip to content
Open
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
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Сообщение об ошибке
about: Создайте сообщение об ошибке, чтобы помочь нам улучшить проект
title: '[BUG] Краткое описание ошибки'
labels: bug
assignees: ''

---

**Опишите ошибку**
Четкое и краткое описание того, что представляет собой ошибка.

**Как воспроизвести**
Шаги для воспроизведения поведения:
1. Перейдите к '...'
2. Нажмите на '....'
3. Прокрутите вниз до '....'
4. Смотрите ошибку

**Ожидаемое поведение**
Четкое и краткое описание того, что вы ожидали произойти.

**Скриншоты**
Если применимо, добавьте скриншоты, чтобы объяснить вашу проблему.

**Окружение:**
- ОС: [например, Ubuntu 20.04]
- Компилятор: [например, g++ 9.3.0]
- Версия проекта: [например, 1.0.0]

**Дополнительный контекст**
Добавьте сюда любой другой контекст о проблеме.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Запрос новой функции
about: Предложите идею для этого проекта
title: '[FEATURE] Краткое описание функции'
labels: enhancement
assignees: ''

---

**Ваш запрос связан с проблемой? Пожалуйста, опишите.**
Четкое и краткое описание проблемы. Например: Я всегда расстраиваюсь, когда [...]

**Опишите решение, которое вы хотели бы**
Четкое и краткое описание того, что вы хотите, чтобы произошло.

**Опишите альтернативы, которые вы рассматривали**
Четкое и краткое описание любых альтернативных решений или функций, которые вы рассматривали.

**Дополнительный контекст**
Добавьте сюда любой другой контекст или скриншоты о запросе функции.
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Описание изменений
[Опишите, какие изменения были внесены]

## Связанные задачи
- [ ] Задача #1
- [ ] Задача #2

## Тип изменений
- [ ] Исправление ошибок
- [ ] Улучшение кода
- [ ] Новая функциональность
- [ ] Документация
- [ ] Тесты

## Проверка
- [ ] Код соответствует стилю Google
- [ ] Все тесты проходят
- [ ] Добавлены новые тесты (если необходимо)
- [ ] Документация обновлена (если необходимо)

## Дополнительная информация
[Добавьте любую дополнительную информацию, которая может быть полезна для ревью]
173 changes: 173 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: CI/CD Pipeline

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format cppcheck valgrind ccache

- name: Cache ccache files
uses: actions/cache@v3
with:
path: ~/.ccache
key: ccache-${{ github.sha }}
restore-keys: ccache-

- name: Style Check
run: |
find . -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \) \
-not -path "./build/*" \
-not -path "./.git/*" \
-exec clang-format --style=Google --dry-run --Werror {} \;

- name: Static Analysis
run: |
cppcheck --enable=all --error-exitcode=1 \
--suppress=missingInclude \
--suppress=unmatchedSuppression \
--suppress=unusedFunction \
--suppress=noExplicitConstructor \
--suppress=useInitializationList \
*/src/*.cpp */include/*.hpp

build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Debug, Release]
compiler: [gcc, clang]

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential clang valgrind ccache

- name: Cache ccache files
uses: actions/cache@v3
with:
path: ~/.ccache
key: ccache-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ github.sha }}
restore-keys: ccache-${{ matrix.compiler }}-${{ matrix.build_type }}-

- name: Configure CMake
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
export CC=gcc CXX=g++
else
export CC=clang CXX=clang++
fi
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build build --config ${{ matrix.build_type }}

- name: Run Tests
working-directory: build
run: ctest --output-on-failure

- name: Memory Check
if: matrix.build_type == 'Debug'
working-directory: build
run: |
for test in test_task_*; do
if [ -x "$test" ]; then
valgrind --leak-check=full --error-exitcode=1 ./"$test"
fi
done

- name: Run Benchmarks
if: matrix.build_type == 'Release'
working-directory: build
run: |
for bench in benchmark_task_*; do
if [ -x "$bench" ]; then
./"$bench" --benchmark_min_time=0.1
fi
done

sanitizers:
runs-on: ubuntu-latest
strategy:
matrix:
sanitizer: [address, undefined, thread]

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential clang

- name: Configure CMake with Sanitizer
run: |
export CC=clang CXX=clang++
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }}"

- name: Build
run: cmake --build build

- name: Run Tests with Sanitizer
working-directory: build
run: |
for test in test_task_*; do
if [ -x "$test" ]; then
./"$test"
fi
done

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential lcov

- name: Configure CMake with Coverage
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="--coverage"

- name: Build
run: cmake --build build

- name: Run Tests for Coverage
working-directory: build
run: |
for test in test_task_*; do
if [ -x "$test" ]; then
./"$test"
fi
done

- name: Generate Coverage Report
run: |
lcov --capture --directory build --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info

- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage.info
41 changes: 41 additions & 0 deletions scripts/check_style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Проверяем наличие clang-format
if ! command -v clang-format &> /dev/null; then
echo "Error: clang-format is not installed"
exit 1
fi

# Создаем временный файл для хранения списка файлов
TMP_FILE=$(mktemp)

# Находим все C++ файлы в проекте
find . -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \) \
-not -path "./build/*" \
-not -path "./.git/*" \
-not -path "./googletest/*" \
> "$TMP_FILE"

# Проверяем стиль каждого файла
ERRORS=0
while IFS= read -r file; do
echo "Checking $file..."
if ! clang-format --style=Google --dry-run --Werror "$file" &> /dev/null; then
echo "Style issues found in $file"
clang-format --style=Google "$file" > "${file}.formatted"
diff -u "$file" "${file}.formatted"
rm "${file}.formatted"
ERRORS=$((ERRORS + 1))
fi
done < "$TMP_FILE"

# Удаляем временный файл
rm "$TMP_FILE"

if [ $ERRORS -gt 0 ]; then
echo "Found $ERRORS files with style issues"
exit 1
else
echo "All files follow Google style guide"
exit 0
fi
Loading
Loading