Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eacc9c88e8 | ||
| 4efbea085d | |||
| e08c4aeb61 | |||
| fb2289214f | |||
| a6862e77e4 | |||
| 1e4648aa21 | |||
| 065a073866 | |||
| 53d1693a1c | |||
| b97560c3a6 | |||
| 33063dcff9 | |||
| 017b48f6e8 | |||
| 50d47529f8 | |||
|
|
a0e2003e01 |
60
.gitea/workflows/ci.yml
Normal file
60
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
name: CI Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install cppcheck
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y cppcheck
|
||||||
|
|
||||||
|
- name: Run cppcheck
|
||||||
|
run: |
|
||||||
|
cppcheck --enable=all -I include/ --suppress=missingIncludeSystem src/ tests/ --error-exitcode=1
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: lint
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y cmake build-essential
|
||||||
|
|
||||||
|
- name: Build and test
|
||||||
|
run: |
|
||||||
|
cmake -B build
|
||||||
|
cmake --build build
|
||||||
|
cd build && ctest --output-on-failure
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: test
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y cmake build-essential
|
||||||
|
|
||||||
|
- name: Build Release
|
||||||
|
run: |
|
||||||
|
cmake -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build build
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(Calculator VERSION 1.0 LANGUAGES C)
|
project(Calculator C)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
@@ -9,14 +9,10 @@ enable_testing()
|
|||||||
add_library(calculator src/calculator.c)
|
add_library(calculator src/calculator.c)
|
||||||
target_include_directories(calculator PUBLIC include)
|
target_include_directories(calculator PUBLIC include)
|
||||||
|
|
||||||
add_executable(main src/calculator.c)
|
|
||||||
target_include_directories(main PUBLIC include)
|
|
||||||
|
|
||||||
add_executable(test_calculator tests/test_calculator.c)
|
add_executable(test_calculator tests/test_calculator.c)
|
||||||
target_link_libraries(test_calculator calculator m)
|
target_link_libraries(test_calculator calculator m)
|
||||||
target_include_directories(test_calculator PRIVATE include)
|
target_include_directories(test_calculator PRIVATE include)
|
||||||
|
|
||||||
add_test(NAME CalculatorTests COMMAND test_calculator)
|
add_test(NAME CalculatorTests COMMAND test_calculator)
|
||||||
|
|
||||||
install(TARGETS calculator main DESTINATION bin)
|
install(TARGETS calculator test_calculator DESTINATION bin)
|
||||||
install(FILES include/calculator.h DESTINATION include)
|
|
||||||
@@ -18,4 +18,3 @@ double divide(int a, int b) {
|
|||||||
}
|
}
|
||||||
return (double)a / b;
|
return (double)a / b;
|
||||||
}
|
}
|
||||||
EOF
|
|
||||||
|
|||||||
Reference in New Issue
Block a user