Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85630647
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8ab8954..f6c5710 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,172 +1,200 @@
# 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:20.04':
extends: .build
before_script:
- BASE_IMG_TAG=servant-ubuntu20.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-ubuntu20.04 --destination $CI_REGISTRY_IMAGE/libkazv:$CI_COMMIT_REF_SLUG-ubuntu20.04-debug"
'build:production:20.04':
extends: .build
before_script:
- BASE_IMG_TAG=servant-ubuntu20.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-ubuntu20.04-prod"
'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-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-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:
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'
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Aug 9, 5:49 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1724735
Default Alt Text
(7 KB)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment