Skip to content
Merged
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
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 🛠️ CI

on: [pull_request]

jobs:
clang-format:
uses: ./.github/workflows/clang-format.yml
secrets: inherit
clang-tidy:
uses: ./.github/workflows/clang-tidy.yml
secrets: inherit
windows:
uses: ./.github/workflows/windows.yml
secrets: inherit
linux:
uses: ./.github/workflows/linux.yml
secrets: inherit
mac-armv8:
uses: ./.github/workflows/mac.yml
secrets: inherit

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: clang-format Check
on: [pull_request]
name: Clang Formatting Check
on: [workflow_call]

jobs:
formatting-check:
name: Formatting Check
Expand Down
48 changes: 28 additions & 20 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
name: C++ Linter
name: cpp-linter

on: [workflow_call]

on: [pull_request]

jobs:
linux-build:
name: "Linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
cpp-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: cpp-linter/cpp-linter-action@main
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: '.clang-format' # Use .clang-format config file
version: 19 # Using clang-tidy19
tidy-checks: '.clang-tidy' # Use .clang-tidy config file
# only 'update' a single comment in a pull request thread.
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: '' # Disables clang-format so it strictly runs clang-tidy
# tidy-checks: '.clang-tidy'
extensions: 'cpp,cppm,h,hpp' # common C++ file extensions
# files-changed-only: true
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
# Ensure clang-tidy knows how to parse modern C++ headers/modules without a compile_commands.json
extra-args: '-Wall -Wextra -Werror -std=c++23 --config-file=.clang-tidy'

- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: exit 1
- name: Failed fast?!
# Does a check if any of the given clang-tidy checks failed!
if: steps.linter.outputs.checks-failed != '0'
run: |
echo "Failed clang-tidy linters check"
echo "Total violations reported: ${{ steps.linter.outputs.checks-failed }}"
exit 1
7 changes: 3 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Linux Platform Build
name: Linux

on: [pull_request]
on: [workflow_call]

jobs:
linux-build:
name: "Linux-Build"
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Macos Platform Build
name: MacOS

on: [pull_request]
on: [workflow_call]

jobs:
macos-build:
name: "M1 Mac Build"
armv8:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Windows Platform Build
name: Windows

on: [pull_request, workflow_dispatch]
on: [workflow_call]

jobs:
windows-build:
name: "Windows-Build"
x86_64:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
Expand Down
29 changes: 18 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,27 @@ add_library(${PROJECT_NAME} STATIC)
# add_subdirectory(editor)

if(${ENABLE_TESTS_ONLY})
build_unit_test(
TEST_SOURCES
add_executable(
unit_test
tests/main.test.cpp
tests/basic_add.test.cpp
tests/entity_component_system.test.cpp
tests/math.test.cpp
tests/scene.test.cpp
)

LINK_PACKAGES
atlas
find_package(ut REQUIRED)
target_link_libraries(unit_test PRIVATE boost-ext-ut::ut atlas)

target_sources(unit_test PUBLIC
FILE_SET CXX_MODULES
TYPE CXX_MODULES
FILES
tests/tests.cppm
tests/basic_add.test.cppm
tests/entity_component_system.test.cppm
tests/math.test.cppm
tests/scene.test.cppm
)

add_custom_target(run_tests ALL DEPENDS unit_test COMMAND unit_test)

endif()

set_packages(
Expand Down Expand Up @@ -200,8 +210,6 @@ target_sources(${PROJECT_NAME} PUBLIC
atlas/drivers/jolt_cpp/context.cppm

# drivers
# atlas/drivers/window_context.cppm
# atlas/drivers/vulkan/vulkan.cppm
atlas/drivers/vulkan/utilities.cppm
atlas/drivers/vulkan/instance_context.cppm
atlas/drivers/vulkan/window_context.cppm
Expand All @@ -219,7 +227,6 @@ target_sources(${PROJECT_NAME} PUBLIC

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_23)

# install(TARGETS ${PROJECT_NAME})
install(
TARGETS ${PROJECT_NAME}
EXPORT atlas_targets
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Atlas Engine
<!-- [![C++](https://img.shields.io/badge/C%2B%2B-20%2F23-blue)]() -->
[![✅CI](https://github.com/engine3d-dev/TheAtlasEngine/actions/workflows/clang-format-deploy.yml/badge.svg)](https://github.com/engine3d-dev/TheAtlasEngine/actions/workflows/clang-format-deploy.yml)
[![✅CI](https://github.com/engine3d-dev/TheAtlasEngine/actions/workflows/ci.yml/badge.svg)](https://github.com/engine3d-dev/TheAtlasEngine/actions/workflows/ci.yml)
[![GitHub stars](https://img.shields.io/github/stars/engine3d-dev/TheAtlasEngine.svg)](https://github.com/engine3d-dev/TheAtlasEngine/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/engine3d-dev/TheAtlasEngine.svg)](https://github.com/engine3d-dev/TheAtlasEngine/network)
[![GitHub issues](https://img.shields.io/github/issues/engine3d-dev/TheAtlasEngine.svg)](https://github.com/engine3d-dev/TheAtlasEngine/issues)
Expand Down
3 changes: 2 additions & 1 deletion atlas/core/entry_point/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import atlas.core.event;

int
main() {
// We should not have our core system start up during testing environment
// execution
atlas::console_log_manager manager = atlas::console_log_manager();

if (!glfwInit()) {
console_log_fatal("GLFW: Initialization failed!!");
return -1;
Expand Down
4 changes: 3 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def requirements(self):

self.requires("nfd/3.0")
self.requires("watcher/0.12.0")
self.requires("boost-ext-ut/2.3.1")

if self.options.enable_tests_only:
self.requires("boost-ext-ut/2.3.1")

def config_options(self):
if self.settings.os == "Windows":
Expand Down
13 changes: 0 additions & 13 deletions tests/basic_add.test.cpp

This file was deleted.

18 changes: 18 additions & 0 deletions tests/basic_add.test.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module;
#include <boost/ut.hpp>
export module atlas.tests:basic_add;

export void
test_basic_add() {
boost::ut::suite<"basic_add"> add_test = []() {
using namespace boost::ut;

"unit1"_test = []() {
int x = 10;
int y = 30;
int z = (x + y);

expect(z == 40);
};
};
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,19 @@
module;
#include <boost/ut.hpp>
// #include <core/math/types.hpp>
#include <flecs.h>

#include <Jolt/Jolt.h>
#include <Jolt/Math/Vec4.h>
// #include <core/scene/scene.hpp>
#include <glm/glm.hpp>
export module atlas.tests:entity_component_system;

import atlas.core.scene;
import atlas.core.scene.game_object;
import atlas.core.math.types;
import atlas.core.event;

#include <glm/glm.hpp>
import atlas.drivers.jolt_cpp.types;

namespace atlas {

template<>
struct vector3<JPH::Vec3> {
vector3() = default;

vector3(const JPH::Vec3& p_other) {
m_value = { p_other.GetX(), p_other.GetY(), p_other.GetZ() };
}

operator glm::vec3() { return m_value; }

glm::vec3 operator=(const JPH::Vec3& p_other) {
return { p_other.GetX(), p_other.GetY(), p_other.GetZ() };
}

bool operator==(const glm::vec3& p_other) {
return (m_value.x == p_other.x and m_value.y == p_other.y and
m_value.z == p_other.z);
}

private:
glm::vec3 m_value;
};

/**
* @name Mock Projectile Missle Test
* @note Essentially an active component
Expand Down Expand Up @@ -82,7 +59,10 @@ namespace atlas {
struct test_velocity {
glm::vec3 position;
};
};

export void
test_entity_component_system() {
boost::ut::suite<"ecs::component"> ecs_test = []() {
using namespace boost::ut;

Expand All @@ -97,30 +77,30 @@ namespace atlas {

// expect(entity.is_alive());

entity.add<test_tag_component>();
expect(entity.has<test_tag_component>());
entity.add<atlas::test_tag_component>();
expect(entity.has<atlas::test_tag_component>());
};

"create_entity::get"_test = [&test_scene]() {
atlas::game_object entity = test_scene.entity("Mock Entity 2");
entity.add<test_tag_component>();
entity.add<atlas::test_tag_component>();
// flecs requires reading only operations are through the get<T> API
// to write or set new parameters you can use get_mut<T> or
// set<T>(T&&); in this case, I use set<T> in this test case
entity.set<test_tag_component>({ .tag = "New Entity" });
entity.set<atlas::test_tag_component>({ .tag = "New Entity" });

const test_tag_component* get_tag =
entity.get<test_tag_component>();
const atlas::test_tag_component* get_tag =
entity.get<atlas::test_tag_component>();
expect(get_tag->tag == "New Entity");
};

"create_entity::set"_test = [&test_scene]() {
atlas::game_object entity = test_scene.entity("New Entity");
mock_projectile projectile;
atlas::mock_projectile projectile;
projectile.on_update();
entity.set<mock_projectile>(projectile);
entity.set<atlas::mock_projectile>(projectile);

expect(entity.has<mock_projectile>());
expect(entity.has<atlas::mock_projectile>());

// test_transform transform;
// transform.position = projectile.position();
Expand All @@ -134,4 +114,4 @@ namespace atlas {
// entity.get<test_velocity>().position);
};
};
}; // namespace atlas
}
7 changes: 5 additions & 2 deletions tests/main.test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include <boost/ut.hpp>

namespace engine3d {};
import atlas.tests;

int
main() {}
main() {
initialize_tests();
}
Loading
Loading