36 lines
808 B
YAML
36 lines
808 B
YAML
name: CI/CD
|
|
|
|
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
|
|
|
|
- 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
|