Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
4a7a220af8 | |||
a43243ca3f | |||
5d30a56e22 | |||
51e044065a | |||
b0caeded2a | |||
585d37b31b | |||
4cd258bcb6 |
13 changed files with 96 additions and 33 deletions
51
.drone.yml
51
.drone.yml
|
@ -87,3 +87,54 @@ steps:
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/static_analysis/clang_format.sh
|
- ./tools/ci/static_analysis/clang_format.sh
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: documentation — development
|
||||||
|
node:
|
||||||
|
environment: ryali
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build and deploy
|
||||||
|
image: documentation:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- pwd
|
||||||
|
- cd docs
|
||||||
|
- mkdir generated
|
||||||
|
- touch generated/changelogs.rst
|
||||||
|
- touch generated/api.rst
|
||||||
|
- sphinx-build -M html . .
|
||||||
|
|
||||||
|
- rm -rf /light_docs_dev/*
|
||||||
|
- mv ./html/* /light_docs_dev/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: documentation — production
|
||||||
|
node:
|
||||||
|
environment: ryali
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build and deploy
|
||||||
|
image: documentation:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- pwd
|
||||||
|
- cd docs
|
||||||
|
- mkdir generated
|
||||||
|
- touch generated/changelogs.rst
|
||||||
|
- touch generated/api.rst
|
||||||
|
- sphinx-build -M html . .
|
||||||
|
|
||||||
|
- rm -rf /light_docs/*
|
||||||
|
- mv ./html/* /light_docs/
|
||||||
|
|
|
@ -8,7 +8,8 @@ include(${CMAKE_DIR}/functions.cmake)
|
||||||
include(${CMAKE_DIR}/definitions.cmake)
|
include(${CMAKE_DIR}/definitions.cmake)
|
||||||
include(${CMAKE_DIR}/dependencies.cmake)
|
include(${CMAKE_DIR}/dependencies.cmake)
|
||||||
|
|
||||||
add_option(ENABLE_TESTS "Enables the building of the test modules")
|
add_option(ENABLE_UNIT_TESTS "Enables the building of the unit test modules")
|
||||||
|
add_option(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules")
|
||||||
|
|
||||||
add_option(ENABLE_STATIC_ANALYSIS "Makes clang-tidy checks mandatory for compilation")
|
add_option(ENABLE_STATIC_ANALYSIS "Makes clang-tidy checks mandatory for compilation")
|
||||||
if (ENABLE_STATIC_ANALYSIS)
|
if (ENABLE_STATIC_ANALYSIS)
|
||||||
|
|
|
@ -11,7 +11,8 @@ class LightRecipe(ConanFile):
|
||||||
generators = "CMakeDeps"
|
generators = "CMakeDeps"
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
"enable_tests": [True, False],
|
"enable_unit_tests": [True, False],
|
||||||
|
"enable_fuzz_tests": [True, False],
|
||||||
"enable_llvm_coverage": [True, False],
|
"enable_llvm_coverage": [True, False],
|
||||||
"enable_static_analysis": [True, False],
|
"enable_static_analysis": [True, False],
|
||||||
"use_mold": [True, False],
|
"use_mold": [True, False],
|
||||||
|
@ -19,7 +20,8 @@ class LightRecipe(ConanFile):
|
||||||
}
|
}
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
"enable_tests": True,
|
"enable_unit_tests": True,
|
||||||
|
"enable_fuzz_tests": False,
|
||||||
"enable_llvm_coverage": False,
|
"enable_llvm_coverage": False,
|
||||||
"enable_static_analysis": False,
|
"enable_static_analysis": False,
|
||||||
"use_mold": False,
|
"use_mold": False,
|
||||||
|
@ -46,7 +48,8 @@ class LightRecipe(ConanFile):
|
||||||
tc.cache_variables["CMAKE_LINKER_TYPE"] = "MOLD"
|
tc.cache_variables["CMAKE_LINKER_TYPE"] = "MOLD"
|
||||||
|
|
||||||
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = self.options.export_compile_commands
|
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = self.options.export_compile_commands
|
||||||
tc.cache_variables["ENABLE_TESTS"] = self.options.enable_tests
|
tc.cache_variables["ENABLE_UNIT_TESTS"] = self.options.enable_unit_tests
|
||||||
|
tc.cache_variables["ENABLE_FUZZ_TESTS"] = self.options.enable_fuzz_tests
|
||||||
tc.cache_variables["ENABLE_LLVM_COVERAGE"] = self.options.enable_llvm_coverage
|
tc.cache_variables["ENABLE_LLVM_COVERAGE"] = self.options.enable_llvm_coverage
|
||||||
tc.cache_variables["ENABLE_STATIC_ANALYSIS"] = self.options.enable_static_analysis
|
tc.cache_variables["ENABLE_STATIC_ANALYSIS"] = self.options.enable_static_analysis
|
||||||
|
|
||||||
|
|
1
modules/surface/private/fuzz_seeds/a
Normal file
1
modules/surface/private/fuzz_seeds/a
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1484824981238913982498139812098u24
|
|
@ -22,8 +22,8 @@ void create_surface_component(test::FuzzDataProvider &provider, ecs::Registry &r
|
||||||
const auto title = provider.consume_string(length).value_or("");
|
const auto title = provider.consume_string(length).value_or("");
|
||||||
|
|
||||||
const auto resolution = math::uvec2 {
|
const auto resolution = math::uvec2 {
|
||||||
provider.consume<uint32_t>().value_or({ 32 }),
|
provider.consume<uint32_t>().value_or(32u),
|
||||||
provider.consume<uint32_t>().value_or({ 64 }),
|
provider.consume<uint32_t>().value_or(64u),
|
||||||
};
|
};
|
||||||
const auto visible = provider.consume<bool>().value_or(false);
|
const auto visible = provider.consume<bool>().value_or(false);
|
||||||
const auto vsync = provider.consume<bool>().value_or(false);
|
const auto vsync = provider.consume<bool>().value_or(false);
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
namespace lt::test {
|
namespace lt::test {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Printable = requires(std::ostream &os, T t) {
|
concept Printable = requires(std::ostream &stream, T value) {
|
||||||
{ os << t } -> std::same_as<std::ostream &>;
|
{ stream << value } -> std::same_as<std::ostream &>;
|
||||||
|
} || requires(std::ostream &stream, T value) {
|
||||||
|
{ stream << std::to_underlying<T>(value) } -> std::same_as<std::ostream &>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -58,7 +60,25 @@ constexpr void expect_eq(
|
||||||
std::source_location source_location = std::source_location::current()
|
std::source_location source_location = std::source_location::current()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (lhs != rhs)
|
if constexpr (std::is_enum_v<decltype(lhs)>)
|
||||||
|
{
|
||||||
|
if (lhs != rhs)
|
||||||
|
{
|
||||||
|
throw std::runtime_error {
|
||||||
|
std::format(
|
||||||
|
"Failed equality expectation:\n"
|
||||||
|
"\tactual: {}\n"
|
||||||
|
"\texpected: {}\n"
|
||||||
|
"\tlocation: {}:{}",
|
||||||
|
std::to_underlying<decltype(lhs)>(lhs),
|
||||||
|
std::to_underlying<decltype(rhs)>(rhs),
|
||||||
|
source_location.file_name(),
|
||||||
|
source_location.line()
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (lhs != rhs)
|
||||||
{
|
{
|
||||||
throw std::runtime_error {
|
throw std::runtime_error {
|
||||||
std::format(
|
std::format(
|
||||||
|
|
|
@ -5,23 +5,6 @@
|
||||||
|
|
||||||
namespace lt::test {
|
namespace lt::test {
|
||||||
|
|
||||||
namespace concepts {
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
concept printable = requires(std::ostream &os, T t) {
|
|
||||||
{ os << t } -> std::same_as<std::ostream &>;
|
|
||||||
};
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
template<class T, auto expr = []{}>
|
|
||||||
concept test = requires(T test) {
|
|
||||||
{ test.name } -> printable;
|
|
||||||
{ test = expr } -> std::same_as<void>;
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
} // namespace concepts
|
|
||||||
|
|
||||||
namespace details {
|
namespace details {
|
||||||
|
|
||||||
class Registry
|
class Registry
|
||||||
|
|
|
@ -21,7 +21,8 @@ RUN pacman -S --noconfirm --disable-download-timeout \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
zlib \
|
zlib \
|
||||||
libc++
|
libc++ \
|
||||||
|
libinput
|
||||||
|
|
||||||
RUN pip install --no-cache-dir --break-system-packages conan gitpython \
|
RUN pip install --no-cache-dir --break-system-packages conan gitpython \
|
||||||
&& conan profile detect
|
&& conan profile detect
|
||||||
|
@ -37,7 +38,7 @@ RUN pip --version \
|
||||||
&& llvm-cov --version
|
&& llvm-cov --version
|
||||||
|
|
||||||
RUN git clone 'https://git.light7734.com/light7734/light.git' \
|
RUN git clone 'https://git.light7734.com/light7734/light.git' \
|
||||||
&& cd light; git checkout 'ci/code_cov' \
|
&& cd light \
|
||||||
&& conan build . \
|
&& conan build . \
|
||||||
-c tools.system.package_manager:mode=install \
|
-c tools.system.package_manager:mode=install \
|
||||||
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
export DISPLAY=':0'
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
cd $(git rev-parse --show-toplevel)/
|
cd $(git rev-parse --show-toplevel)/
|
||||||
rm -rf ./build
|
rm -rf ./build
|
||||||
|
|
|
@ -8,7 +8,7 @@ conan build . \
|
||||||
-c tools.system.package_manager:mode=install \
|
-c tools.system.package_manager:mode=install \
|
||||||
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
||||||
-s build_type=Release \
|
-s build_type=Release \
|
||||||
-o enable_tests=True \
|
-o enable_unit_tests=True \
|
||||||
-o use_mold=True \
|
-o use_mold=True \
|
||||||
--build=missing
|
--build=missing
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ conan build . \
|
||||||
-c tools.system.package_manager:mode=install \
|
-c tools.system.package_manager:mode=install \
|
||||||
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
||||||
-s build_type=Release \
|
-s build_type=Release \
|
||||||
-o enable_tests=True \
|
-o enable_unit_tests=True \
|
||||||
-o use_mold=True \
|
-o use_mold=True \
|
||||||
--build=missing
|
--build=missing
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ conan build . \
|
||||||
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
||||||
-s build_type=Release \
|
-s build_type=Release \
|
||||||
-o enable_static_analysis=True \
|
-o enable_static_analysis=True \
|
||||||
-o enable_tests=True \
|
-o enable_unit_tests=True \
|
||||||
|
-o enable_fuzz_tests=True \
|
||||||
-o use_mold=True \
|
-o use_mold=True \
|
||||||
--build=missing
|
--build=missing
|
||||||
|
|
|
@ -78,7 +78,7 @@ function (add_executable_module exename)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
function (add_test_module target_lib_name)
|
function (add_test_module target_lib_name)
|
||||||
if (NOT ${ENABLE_TESTS})
|
if (NOT ${ENABLE_UNIT_TESTS})
|
||||||
return()
|
return()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ function (add_test_module target_lib_name)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
function (add_fuzz_module target_lib_name)
|
function (add_fuzz_module target_lib_name)
|
||||||
if (NOT ${ENABLE_TESTS})
|
if (NOT ${ENABLE_FUZZ_TESTS})
|
||||||
return()
|
return()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue