Page MenuHomePhorge

No OneTemporary

Size
10 KB
Referenced Files
None
Subscribers
None
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 846f07e..2092271 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,186 +1,187 @@
# This file is part of libkazv.
# SPDX-FileCopyrightText: 2022-2023 tusooa <tusooa@kazv.moe>
# SPDX-License-Identifier: AGPL-3.0-or-later
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "trigger"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_COMMIT_BRANCH
- if: '$CI_COMMIT_TAG !~ /^phabricator\//'
stages:
- prepare
- lint
- build
- coverage-vis
- coverage-upload
- doc
- pages
- report
.report:
image:
name: 'reg.lily.kazv.moe/infra/phorge-ci-tools:servant'
rules:
- if: $TARGET_PHID
when: always
- when: never
before_script:
- pipelineUrl="$CI_PROJECT_URL"/-/pipelines/"$CI_PIPELINE_ID"
report-start:
extends: .report
stage: prepare
script:
- 'echo "{\"receiver\": \"$TARGET_PHID\", \"type\": \"work\", \"unit\": [{\"name\": \"GitLab CI (information only)\", \"result\": \"skip\", \"details\": \"$pipelineUrl\", \"format\": \"remarkup\"}]}" | /tools/arcanist/bin/arc call-conduit --conduit-uri https://iron.lily-is.land/ --conduit-token "$CONDUIT_TOKEN" -- harbormaster.sendmessage'
lint:
stage: lint
script: |
echo 'Verify that no source file contains tabs'
! egrep -R --exclude-dir=resources $'\t' src
rules: &build-rules
- changes: &src-chg
- .gitlab-ci.yml
- Dockerfile
- '**/*.cpp'
- '**/*.hpp'
- '**/CMakeLists.txt'
- '**/*.in'
- 'src/tests/resources/**'
.build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script: |
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
if [ "$CI_PIPELINE_SOURCE" == "trigger" ]; then
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg JOBS=1 --build-arg BASE_IMG_TAG=$BASE_IMG_TAG --build-arg BUILD_TYPE=$BUILD_TYPE --no-push
else
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg JOBS=1 --build-arg BASE_IMG_TAG=$BASE_IMG_TAG --build-arg BUILD_TYPE=$BUILD_TYPE $PUSH_TAGS
fi
rules: *build-rules
'build:debug:22.04':
extends: .build
before_script:
- BASE_IMG_TAG=servant-ubuntu22.04
- BUILD_TYPE=Debug
- PUSH_TAGS="--destination $CI_REGISTRY_IMAGE/libkazv:$CI_COMMIT_REF_SLUG --destination $CI_REGISTRY_IMAGE/libkazv:$CI_COMMIT_REF_SLUG-debug --destination $CI_REGISTRY_IMAGE/libkazv:$CI_COMMIT_REF_SLUG-ubuntu22.04 --destination $CI_REGISTRY_IMAGE/libkazv:$CI_COMMIT_REF_SLUG-ubuntu22.04-debug"
'build:production:22.04':
extends: .build
before_script:
- BASE_IMG_TAG=servant-ubuntu22.04
- BUILD_TYPE=Release
- PUSH_TAGS="--destination $CI_REGISTRY_IMAGE/libkazv:$CI_COMMIT_REF_SLUG-prod --destination $CI_REGISTRY_IMAGE/libkazv:$CI_COMMIT_REF_SLUG-ubuntu22.04-prod"
'build:coverage':
stage: build
image:
name: reg.lily.kazv.moe/kazv/libkazv-deps/deps:servant-ubuntu22.04
entrypoint: [""]
script: |
export BUILD_TYPE=Debug
export JOBS=1
export DEPS_INSTALL_DIR=/opt/libkazv-deps
export LIBKAZV_INSTALL_DIR=/opt/libkazv
mkdir build && cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX="$LIBKAZV_INSTALL_DIR" -DCMAKE_PREFIX_PATH="$DEPS_INSTALL_DIR" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -Dlibkazv_BUILD_TESTS=ON \
-Dlibkazv_BUILD_EXAMPLES=ON -Dlibkazv_BUILD_KAZVJOB=ON -Dlibkazv_ENABLE_COVERAGE=ON -DCMAKE_CXX_FLAGS=-fsanitize=address && \
make -j$JOBS && \
make CTEST_OUTPUT_ON_FAILURE=1 test && \
gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml -r "${CI_PROJECT_DIR}" --object-directory src -e '.*/api/.*' -e '.*/tests/.*' -e '.*/testfixtures/.*' -e '.*/examples/.*'
coverage: /^\s*lines:\s*\d+.\d+\%/
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
paths:
- build/coverage.xml
reports:
+ junit: build/test-report.xml
coverage_report:
coverage_format: cobertura
path: build/coverage.xml
rules: *build-rules
'coverage-report':
rules: *build-rules
stage: coverage-vis
image: 'reg.lily.kazv.moe/infra/phorge-ci-tools/pycobertura:servant'
script:
- pycobertura show ./build/coverage.xml --format html --output ./build/coverage.html --source .
- pycobertura show ./build/coverage.xml --format markdown --source . | python -c 'import sys, json; print(json.dumps("".join(sys.stdin)))' > ./build/coverage-md.json
- /tools/cobertura-to-phorge ./build/coverage.xml . > ./build/coverage.json
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
paths:
- build/coverage.html
- build/coverage-md.json
- build/coverage.json
upload-coverage:
extends: .report
stage: coverage-upload
rules:
- if: $TARGET_PHID
changes: *src-chg
when: always
- when: never
script:
- '{ echo "{\"receiver\": \"$TARGET_PHID\", \"type\": \"work\", \"unit\": [{\"name\": \"Test coverage\", \"result\": \"pass\", \"details\": "; cat build/coverage-md.json; echo ", \"format\": \"remarkup\", \"coverage\":"; cat build/coverage.json; echo "}]}"; } | /tools/arcanist/bin/arc call-conduit --conduit-uri https://iron.lily-is.land/ --conduit-token "$CONDUIT_TOKEN" -- harbormaster.sendmessage'
'doc:build':
stage: doc
image: reg.lily.kazv.moe/kazv/libkazv-deps/deps:servant
dependencies: []
script:
- doxygen Doxyfile
artifacts:
paths:
- doc/html/
rules:
- changes: *src-chg
- changes: &doc-chg
- '**/*.md'
- .gitlab-ci.yml
- public/**/*
pages:
stage: pages
image: alpine
dependencies:
- 'doc:build'
script:
- mv -v doc/html public/api
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH != "servant"
when: never
- changes: *src-chg
- changes: *doc-chg
report-success:
extends: .report
rules:
- if: $TARGET_PHID
when: on_success
- when: never
stage: report
script:
- 'echo "{\"receiver\": \"$TARGET_PHID\", \"type\": \"pass\"}" | /tools/arcanist/bin/arc call-conduit --conduit-uri https://iron.lily-is.land/ --conduit-token "$CONDUIT_TOKEN" -- harbormaster.sendmessage'
report-failure:
extends: .report
rules:
- if: $TARGET_PHID
when: on_failure
- when: never
stage: report
script:
- 'echo "{\"receiver\": \"$TARGET_PHID\", \"type\": \"fail\"}" | /tools/arcanist/bin/arc call-conduit --conduit-uri https://iron.lily-is.land/ --conduit-token "$CONDUIT_TOKEN" -- harbormaster.sendmessage'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd8fada..b59d45c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,131 +1,131 @@
# Do not let the option()s override variables here
cmake_minimum_required(VERSION 3.13)
if(NOT DEFINED PROJECT_NAME)
if(NOT DEFINED libkazv_INSTALL_HEADERS)
set(libkazv_INSTALL_HEADERS ON)
endif()
endif()
project(libkazv)
set(libkazvSourceRoot ${CMAKE_CURRENT_SOURCE_DIR})
set(libkazv_VERSION_MAJOR 0)
set(libkazv_VERSION_MINOR 7)
set(libkazv_VERSION_PATCH 0)
set(libkazv_VERSION_STRING ${libkazv_VERSION_MAJOR}.${libkazv_VERSION_MINOR}.${libkazv_VERSION_PATCH})
set(libkazv_SOVERSION 6)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
option(libkazv_BUILD_TESTS "Build tests" ON)
option(libkazv_BUILD_EXAMPLES "Build examples" ON)
option(libkazv_BUILD_KAZVJOB "Build libkazvjob the async and networking library" ON)
option(libkazv_OUTPUT_LEVEL "Output level: Debug>=90, Info>=70, Quiet>=20, no output=1" 0)
option(libkazv_ENABLE_COVERAGE "Enable code coverage information" OFF)
if(libkazv_ENABLE_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fPIC -O0")
endif()
if((libkazv_BUILD_TESTS OR libkazv_BUILD_EXAMPLES) AND NOT libkazv_BUILD_KAZVJOB)
message(FATAL_ERROR
"You asked kazvjob not to be built, but asked to build tests or examples. Tests and examples both depend on kazvjob. This is not possible.")
endif()
if(libkazv_BUILD_TESTS)
set(BUILD_TESTING ON)
include(CTest)
- set(CMAKE_CTEST_ARGUMENTS --output-on-failure)
+ set(CMAKE_CTEST_ARGUMENTS --output-on-failure --output-junit test-report.xml)
endif()
# Build shared libraries by default
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(LIBKAZV_BUILT_WITH_DEBUG 1)
else()
set(LIBKAZV_BUILT_WITH_DEBUG 0)
endif()
find_package(Boost REQUIRED COMPONENTS serialization regex)
if(libkazv_BUILD_KAZVJOB)
find_package(cpr REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
endif()
if(libkazv_BUILD_TESTS)
find_package(Catch2 REQUIRED)
endif()
find_package(nlohmann_json REQUIRED)
find_package(Immer REQUIRED)
find_package(Zug REQUIRED)
find_package(Lager REQUIRED)
if(MINGW)
# On MinGW, disregard the Findcryptopp.cmake
find_package(cryptopp REQUIRED CONFIG)
else()
find_package(cryptopp REQUIRED)
endif()
# On MinGW we use the CMake build, and the target name is different
# for the shared and the static libraries.
if(MINGW)
set(CRYPTOPP_TARGET_NAME cryptopp-shared)
else()
set(CRYPTOPP_TARGET_NAME cryptopp)
endif()
find_package(vodozemac REQUIRED)
if(libkazv_BUILD_EXAMPLES)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBHTTPSERVER REQUIRED libhttpserver)
endif()
if(libkazv_OUTPUT_LEVEL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLIBKAZV_OUTPUT_LEVEL=${libkazv_OUTPUT_LEVEL}")
endif()
include(GNUInstallDirs)
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/libkazv)
add_subdirectory(src)
install(EXPORT libkazvTargets
NAMESPACE
libkazv::
DESTINATION
${ConfigPackageLocation}
)
install(
FILES cmake/libkazvConfig.cmake
DESTINATION ${ConfigPackageLocation})
# cpr does not install a good config file.
# We use the find module instead.
install(
FILES cmake/Findcpr.cmake
DESTINATION ${ConfigPackageLocation})
if(NOT MINGW)
install(
FILES cmake/Findcryptopp.cmake
DESTINATION ${ConfigPackageLocation})
endif()

File Metadata

Mime Type
text/x-diff
Expires
Thu, Nov 28, 5:12 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40846
Default Alt Text
(10 KB)

Event Timeline