Feature: Repository Infrastructure Scaffolding #1

Merged
homeburger merged 14 commits from feature/repo-setup into main 2026-05-08 14:41:39 -05:00
12 changed files with 243 additions and 5 deletions

View File

@@ -0,0 +1,59 @@
name: Build and Test verification
run-name: ${{ gitea.actor }}: Build & Test on ${{ gitea.ref_name }}
on: [push]
jobs:
build:
runs-on: debian12
container:
image: git.vxbard.net/homeburger/bard-cpp-builder:1.0
steps:
- name: clone
uses: actions/checkout@v3
- name: container-setup
run: container-setup.sh
- name: configure
run: cmake -S . -B build
- name: build
run: cmake --build build -j
- name: upload
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: build
test:
runs-on: debian12
container:
image: git.vxbard.net/homeburger/bard-cpp-builder:1.0
needs: build
steps:
- name: clone
uses: actions/checkout@v3
- name: container-setup
run: container-setup.sh
- name: download
uses: actions/download-artifact@v3
with:
name: build-artifact
path: build
- name: make_executable
run: chmod -R +x ./build
- name: run_unit_tests
run: |
cd build
ctest -T Test
- name: code_coverage
run: |
cd build
gcovr -r .. --filter "../src"

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
build/*
Testing/*

55
CMakeLists.txt Normal file
View File

@@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.23)
project(maiden)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
# gtest
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.17.x
)
FetchContent_MakeAvailable(googletest)
# add_subdirectory() to nest CMakeLists
add_executable(maiden
src/App.cpp
src/main.cpp
# include extra source files here
)
add_executable(maiden_test
src/App.cpp
test/TestApp.cpp
)
target_include_directories(maiden PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
# add additional include directories here
)
target_include_directories(maiden_test PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)
target_compile_options(maiden_test PRIVATE --coverage)
target_link_options(maiden_test PRIVATE --coverage)
# TODO: add option for disabling tests (like if target == DEBUG then tests on, otherwise tests off)
target_link_libraries(maiden_test PRIVATE
GTest::gmock
GTest::gmock_main
)
include(CTest)
enable_testing() # ctest is whatever
include(GoogleTest)
gtest_discover_tests(maiden_test)

View File

@@ -8,12 +8,46 @@ The maiden project is a GPU accelerated 3D rendering engine built with C++ based
## Getting Started
### git instructions here
### build instructions here
### Clone Repository
```bash
$ git clone https://git.vxbard.net/homeburger/maiden.git
# If there's any necessary submodules then:
$ git clone --recurse-submodules https://git.vxbard.net/homeburger/maiden.git
# If you have already cloned the repository and you need its submodules:
$ git submodule update --init --recursive
```
### Build
This app uses CMake and C++20, so a compatible compiler (gcc8, clang9, msvc16) are necessary.
Most library prerequisites are handled within CMake. Any others that need to be manually installed will be described below as the project grows.
To build the project (using default build directory "build"):
```bash
# configure
$ cmake -S . -B build # + any extra options
# build
$ cmake --build build -j
# execute
$ cd build
$ ./maiden
```
### Testing
This app uses GoogleTest for building unit tests. The below instructions use ctest and gcovr for test execution and code coverage:
```bash
# execute unit tests
$ ctest -T Test # + filter options
# analyze code coverage
$ cd build
$ gcovr -r .. --filter "../src"
```
### app troubleshooting here
### testing instructions here
## Development Roadmap
### lots of todo here

0
assets/.gitkeep Normal file
View File

0
config/.gitkeep Normal file
View File

0
lib/.gitkeep Normal file
View File

0
scripts/build.sh Normal file
View File

18
src/App.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include "App.hpp"
void App::run() {
std::cout << "im an app and im running !!" << std::endl;
(void)foo();
return;
}
int32_t App::foo() {
return 12;
}

19
src/App.hpp Normal file
View File

@@ -0,0 +1,19 @@
#pragma once
#include <iostream>
#include <cstdint>
class App {
public:
App() = default;
~App() = default;
void run();
private:
int32_t foo();
};

14
src/main.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include <iostream>
#include "App.hpp"
int main(int argc, char** argv) {
std::cout << "hi mom !" << std::endl;
App app;
app.run();
return 0;
}

36
test/TestApp.cpp Normal file
View File

@@ -0,0 +1,36 @@
#include <gmock/gmock.h>
#include <memory>
#define private public
#include <App.hpp>
#undef private
class TestApp : public testing::Test {
protected:
void createUut() {
uut_ = std::make_unique<App>();
}
std::unique_ptr<App> uut_;
};
TEST_F(TestApp, TestApp_run_nominal) {
createUut();
uut_->run();
// no expect here
}
TEST_F(TestApp, TestApp_foo_nominal) {
createUut();
EXPECT_EQ(uut_->foo(), 12);
}