Compare commits
2 commits
main
...
ci/amd64-c
Author | SHA1 | Date | |
---|---|---|---|
5dba19b9a4 | |||
0396303f62 |
10 changed files with 83 additions and 70 deletions
66
.drone.yml
66
.drone.yml
|
@ -1,3 +1,18 @@
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: daily — amd64 — clang
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: fuzz
|
||||||
|
image: amd64_clang_fuzz:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- ./tools/ci/amd64/clang/fuzz.sh
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: exec
|
type: exec
|
||||||
|
@ -87,54 +102,3 @@ 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,8 +8,7 @@ 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_UNIT_TESTS "Enables the building of the unit test modules")
|
add_option(ENABLE_TESTS "Enables the building of the 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,8 +11,7 @@ class LightRecipe(ConanFile):
|
||||||
generators = "CMakeDeps"
|
generators = "CMakeDeps"
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
"enable_unit_tests": [True, False],
|
"enable_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],
|
||||||
|
@ -20,8 +19,7 @@ class LightRecipe(ConanFile):
|
||||||
}
|
}
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
"enable_unit_tests": True,
|
"enable_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,
|
||||||
|
@ -48,8 +46,7 @@ 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_UNIT_TESTS"] = self.options.enable_unit_tests
|
tc.cache_variables["ENABLE_TESTS"] = self.options.enable_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
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ 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
|
||||||
|
@ -38,7 +37,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 \
|
&& cd light; git checkout 'ci/code_cov' \
|
||||||
&& 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,7 +1,5 @@
|
||||||
#!/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
|
||||||
|
|
57
tools/ci/amd64/clang/fuzz.sh
Executable file
57
tools/ci/amd64/clang/fuzz.sh
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd $(git rev-parse --show-toplevel)/
|
||||||
|
# rm -rf ./build
|
||||||
|
|
||||||
|
export CC=$(which afl-clang-lto)
|
||||||
|
export CXX=$(which afl-clang-lto++)
|
||||||
|
export AR=$(which llvm-ar)
|
||||||
|
export RANLIB=$(which llvm-ranlib)
|
||||||
|
export AS=$(which llvm-as)
|
||||||
|
|
||||||
|
conan build . \
|
||||||
|
-c tools.system.package_manager:mode=install \
|
||||||
|
-c tools.cmake.cmaketoolchain:generator=Ninja \
|
||||||
|
-c tools.build:compiler_executables='{"c": "afl-clang-lto", "cpp": "afl-clang-lto++"}' \
|
||||||
|
-s build_type=Release \
|
||||||
|
-s compiler=clang \
|
||||||
|
-s compiler.version=20 \
|
||||||
|
-s compiler.libcxx=libc++ \
|
||||||
|
-o use_mold=True \
|
||||||
|
--build=missing \
|
||||||
|
--build=missing
|
||||||
|
|
||||||
|
fuzz_test_count=$(find ./build -type f -name '*_fuzz' -executable | wc -l)
|
||||||
|
total_fuzz_time=60 # in seconds
|
||||||
|
|
||||||
|
time_per_fuzz=$((total_fuzz_time / fuzz_test_count))
|
||||||
|
|
||||||
|
echo "Fuzz test count: ${fuzz_test_count}"
|
||||||
|
echo "Total fuzz time: ${total_fuzz_time}"
|
||||||
|
echo "Time per fuzz: ${time_per_fuzz}"
|
||||||
|
|
||||||
|
export AFL_SKIP_CPUFREQ=1
|
||||||
|
export AFL_NO_UI=1
|
||||||
|
|
||||||
|
for fuzz_name in $(find ./build -type f -name '*_fuzz' -executable); do
|
||||||
|
base_name=$(basename $fuzz_name)
|
||||||
|
out_path="/fuzz/${base_name}_out"
|
||||||
|
in_path="/fuzz/${base_name}_in"
|
||||||
|
|
||||||
|
echo "Running ${fuzz_name} for ${time_per_fuzz} seconds..."
|
||||||
|
echo "base_name: ${base_name}"
|
||||||
|
echo "out_path: ${out_path}"
|
||||||
|
echo "in_path: ${in_path}"
|
||||||
|
|
||||||
|
if [[ ! -e $dir ]]; then
|
||||||
|
echo "No directories detected for ${base_name}"
|
||||||
|
echo "Creating dummy files..."
|
||||||
|
mkdir -p ${in_path}
|
||||||
|
mkdir -p ${out_path}
|
||||||
|
|
||||||
|
echo "0" > ${in_path}/a
|
||||||
|
fi
|
||||||
|
|
||||||
|
afl-fuzz -V $time_per_fuzz -i $in_path -o $out_path -- $fuzz_name
|
||||||
|
done
|
|
@ -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_unit_tests=True \
|
-o enable_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_unit_tests=True \
|
-o enable_tests=True \
|
||||||
-o use_mold=True \
|
-o use_mold=True \
|
||||||
--build=missing
|
--build=missing
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ 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_unit_tests=True \
|
-o enable_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_UNIT_TESTS})
|
if (NOT ${ENABLE_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_FUZZ_TESTS})
|
if (NOT ${ENABLE_TESTS})
|
||||||
return()
|
return()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue