init commit

This commit is contained in:
SILCHENKO
2026-05-24 18:06:03 +03:00
commit 2cc6b72b6b
4 changed files with 64 additions and 0 deletions

36
.github/workflow/ci.yaml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: C++ CI/CD Pipeline
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake cppcheck build-essential
- name: Run Static Analysis (Cppcheck)
run: |
cppcheck --enable=all --language=c++ --error-exitcode=1 main.cpp test.cpp
# Флаг --error-exitcode=1 остановит пайплайн, если найдутся критические ошибки
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build build --config Release
- name: Run Tests (CTest)
run: |
cd build
ctest --output-on-failure

15
CMakeLists.txt Normal file
View File

@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.10)
project(HelloWorldProject VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Главная программа
add_executable(hello_world main.cpp)
# Включение поддержки тестирования
enable_testing()
# Тестовый исполняемый файл и регистрация в CTest
add_executable(run_tests test.cpp)
add_test(NAME SimpleTest COMMAND run_tests)

6
main.cpp Normal file
View File

@@ -0,0 +1,6 @@
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}

7
test.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include <iostream>
int main() {
// Тест проходит успешно, если возвращает 0
std::cout << "Running simple test..." << std::endl;
return 0;
}