Оптимизация шаблона

This commit is contained in:
Andrei Astafev 2022-04-14 13:14:06 +03:00
parent 948fa3cf78
commit a68e81fb74

View File

@ -5,9 +5,72 @@ variables:
CI_BUILD_DIR: _build CI_BUILD_DIR: _build
CI_OUTPUT_DIR: _output CI_OUTPUT_DIR: _output
.scheduled-test: .use-clang:
variables:
CXX: clang++-14
CC: clang-14
.use-ninja:
variables: variables:
CMAKE_GENERATOR: Ninja CMAKE_GENERATOR: Ninja
.qmake-script:
variables:
QT_SELECT: qt5
script:
- >
if [ -f "${CI_JOB_NAME}.status" ]; then
if [ "$(cat ${CI_JOB_NAME}.status)" == "${CI_COMMIT_SHA}" ]; then
echo "=== Commit ${CI_COMMIT_SHORT_SHA} already tested with job ${CI_JOB_NAME} ==="
exit 0
fi
fi
- rm -f ${CI_JOB_NAME}.status
- mkdir -p ${CI_BUILD_DIR}
- qmake -o ${CI_BUILD_DIR} ${QMAKE_PRO_FILE}
- make -j8 -C ${CI_BUILD_DIR}
- echo "${CI_COMMIT_SHA}" > "${CI_JOB_NAME}.status"
.cmake-script:
extends: .use-ninja
script:
- >
if [ -f "${CI_JOB_NAME}.status" ]; then
if [ "$(cat ${CI_JOB_NAME}.status)" == "${CI_COMMIT_SHA}" ]; then
echo "=== Commit ${CI_COMMIT_SHORT_SHA} already tested with job ${CI_JOB_NAME} ==="
exit 0
fi
fi
- rm -f ${CI_JOB_NAME}.status
- >
if [ -n "${CONFIGURE_CMD}" ]; then
${CONFIGURE_CMD}
else
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CI_OUTPUT_DIR} -DCPACK_PACKAGING_INSTALL_PREFIX=/opt/ecs5 -B${CI_BUILD_DIR} -H.
fi
- >
if [ -n "${BUILD_CMD}" ]; then
${BUILD_CMD}
else
cmake --build ${CI_BUILD_DIR}
fi
- >
if [ -z "${CI_SHARED_ENVIRONMENT+x}" ]; then
if [ -n "${PACKAGE_CMD}" ]; then
${PACKAGE_CMD}
else
cmake --install ${CI_BUILD_DIR}
cmake --build ${CI_BUILD_DIR} --target package
cmake --build ${CI_BUILD_DIR} --target package_source
fi
fi
- echo "${CI_COMMIT_SHA}" > "${CI_JOB_NAME}.status"
.scheduled-test:
extends: .cmake-script
rules: rules:
- if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "web" - if: $CI_PIPELINE_SOURCE == "web"
@ -32,38 +95,6 @@ variables:
if [ -n "${INSTALL_CMD}" ]; then if [ -n "${INSTALL_CMD}" ]; then
${INSTALL_CMD} ${INSTALL_CMD}
fi fi
script:
- >
if [ -f "${CI_JOB_NAME}.status" ]; then
if [ "$(cat ${CI_JOB_NAME}.status)" == "${CI_COMMIT_SHA}" ]; then
echo "=== Commit ${CI_COMMIT_SHORT_SHA} already tested with job ${CI_JOB_NAME} ==="
exit 0
fi
fi
- rm -f ${CI_JOB_NAME}.status
- >
if [ -n "${CONFIGURE_CMD}" ]; then
${CONFIGURE_CMD}
else
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CI_OUTPUT_DIR} -DCPACK_PACKAGING_INSTALL_PREFIX=/opt/rtis -B${CI_BUILD_DIR} -H.
fi
- >
if [ -n "${BUILD_CMD}" ]; then
${BUILD_CMD}
else
cmake --build ${CI_BUILD_DIR}
fi
- >
if [ -z "${CI_SHARED_ENVIRONMENT+x}" ]; then
if [ -n "${PACKAGE_CMD}" ]; then
${PACKAGE_CMD}
else
cmake --install ${CI_BUILD_DIR}
cmake --build ${CI_BUILD_DIR} --target package
cmake --build ${CI_BUILD_DIR} --target package_source
fi
fi
- echo "${CI_COMMIT_SHA}" > "${CI_JOB_NAME}.status"
artifacts: artifacts:
paths: paths:
- ${CI_BUILD_DIR}/*.gz - ${CI_BUILD_DIR}/*.gz
@ -74,23 +105,6 @@ variables:
when: on_success when: on_success
expire_in: 10 days expire_in: 10 days
.qmake-script:
variables:
QT_SELECT: qt5
script:
- >
if [ -f "${CI_JOB_NAME}.status" ]; then
if [ "$(cat ${CI_JOB_NAME}.status)" == "${CI_COMMIT_SHA}" ]; then
echo "=== Commit ${CI_COMMIT_SHORT_SHA} already tested with job ${CI_JOB_NAME} ==="
exit 0
fi
fi
- rm -f ${CI_JOB_NAME}.status
- mkdir -p ${CI_BUILD_DIR}
- qmake -o ${CI_BUILD_DIR} ${QMAKE_PRO_FILE}
- make -j8 -C ${CI_BUILD_DIR}
- echo "${CI_COMMIT_SHA}" > "${CI_JOB_NAME}.status"
.scheduled-mxe: .scheduled-mxe:
extends: .scheduled-test extends: .scheduled-test
image: mxe-dev image: mxe-dev
@ -130,9 +144,9 @@ variables:
extends: .scheduled-test extends: .scheduled-test
tags: ['elbrus'] tags: ['elbrus']
.check-format-sources: .check-format-sources:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja
image: focal-dev image: focal-dev
tags: ['format'] tags: ['format']
script: script:
@ -140,8 +154,7 @@ variables:
- cmake --build ${CI_BUILD_DIR} --target check-format-sources - cmake --build ${CI_BUILD_DIR} --target check-format-sources
.myx-cmake-format-sources-check: .myx-cmake-format-sources-check:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja
image: focal-dev image: focal-dev
tags: ['format'] tags: ['format']
script: script:
@ -149,8 +162,7 @@ variables:
- cmake --build ${CI_BUILD_DIR} --target myx-cmake-format-sources-check - cmake --build ${CI_BUILD_DIR} --target myx-cmake-format-sources-check
.format-sources-check-custom: .format-sources-check-custom:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja
image: focal-dev image: focal-dev
tags: ['format'] tags: ['format']
script: script:
@ -164,37 +176,32 @@ variables:
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
- qmake - qmake ${QMAKE_PRO_FILE}
- bear -- make -k -j$(nproc) - bear -- make -k -j$(nproc)
- pvs-studio-analyzer analyze -a 29 -j$(nproc) - pvs-studio-analyzer analyze -a 29 -j$(nproc)
- plog-converter -a "GA:1,2,3;64:1;OP:1,2;CS:1,2" -t errorfile PVS-Studio.log - plog-converter -a "GA:1,2,3;64:1;OP:1,2;CS:1,2" -t errorfile PVS-Studio.log
.qmake-analyze-clang-tidy: .qmake-analyze-clang-tidy:
variables: extends: .use-clang
CXX: clang++-14
CC: clang-14
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
- qmake - qmake ${QMAKE_PRO_FILE}
- bear -- make -k -j$(nproc) - bear -- make -k -j$(nproc)
- run-clang-tidy-14 -checks=-*,bugprone-*,clang-analyzer-*,misc-*,modernize-*,performance-*,portability-* - run-clang-tidy-14 -checks=-*,bugprone-*,clang-analyzer-*,misc-*,modernize-*,performance-*,portability-*
.qmake-analyze-clazy: .qmake-analyze-clazy:
variables: extends: .use-clang
CXX: clang++-14
CC: clang-14
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
- qmake - qmake ${QMAKE_PRO_FILE}
- bear -- make -k -j$(nproc) - bear -- make -k -j$(nproc)
- find . -name "*.cpp" -print0 | xargs -0 clazy-standalone --ignore-dirs=/usr -checks=level2 -p compile_commands.json - find . -name "*.cpp" -print0 | xargs -0 clazy-standalone --ignore-dirs=/usr -checks=level2 -p compile_commands.json
.cmake-analyze-pvs-studio: .cmake-analyze-pvs-studio:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
@ -208,10 +215,8 @@ variables:
fi fi
.cmake-analyze-clang-tidy: .cmake-analyze-clang-tidy:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja extends: .use-clang
CXX: clang++-14
CC: clang-14
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
@ -224,10 +229,8 @@ variables:
fi fi
.cmake-analyze-clazy: .cmake-analyze-clazy:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja extends: .use-clang
CXX: clang++-14
CC: clang-14
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
@ -241,8 +244,7 @@ variables:
.myx-cmake-analyze-pvs-studio: .myx-cmake-analyze-pvs-studio:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
@ -250,10 +252,8 @@ variables:
- cmake --build ${CI_BUILD_DIR} --target myx-cmake-analyze-pvs-studio --parallel - cmake --build ${CI_BUILD_DIR} --target myx-cmake-analyze-pvs-studio --parallel
.myx-cmake-analyze-clang-tidy: .myx-cmake-analyze-clang-tidy:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja extends: .use-clang
CXX: clang++-14
CC: clang-14
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script:
@ -261,10 +261,7 @@ variables:
- cmake --build build --target myx-cmake-analyze-clang-tidy --parallel - cmake --build build --target myx-cmake-analyze-clang-tidy --parallel
.myx-cmake-analyze-clazy: .myx-cmake-analyze-clazy:
variables: extends: .use-ninja
CMAKE_GENERATOR: Ninja
CXX: clang++-14
CC: clang-14
image: jammy-dev image: jammy-dev
tags: ['analyze'] tags: ['analyze']
script: script: