Newer
Older
SCRIPTS_DIR: "${CI_PROJECT_DIR}/scripts"
CI_SCRIPTS_DIR: "${CI_PROJECT_DIR}/scripts/ci"
BUILD_PATH: "${CI_PROJECT_DIR}/gkfs/build"
INSTALL_PATH: "${CI_PROJECT_DIR}/gkfs/install"
INTEGRATION_TESTS_BIN_PATH: "${CI_PROJECT_DIR}/gkfs/install/share/gkfs/tests/integration"
COVERAGE_PATH: "${CI_PROJECT_DIR}/gkfs/build/.coverage"
PYTEST: "${CI_PROJECT_DIR}/gkfs/install/share/gkfs/tests/integration/pytest-venv/bin/py.test"
BATS: "${CI_PROJECT_DIR}/tests/scripts/bats/bin/bats"
LD_LIBRARY_PATH: "${CI_PROJECT_DIR}/deps/install/lib:${CI_PROJECT_DIR}/deps/install/lib64"
GKFS_LOG_LEVEL: "100"
GKFS_DAEMON_LOG_PATH: "${CI_PROJECT_DIR}/logs/daemon.log"
LIBGKFS_LOG: "all"
LIBGKFS_LOG_OUTPUT: "${CI_PROJECT_DIR}/logs/gkfs_client.log"
GIT_SUBMODULE_STRATEGY: recursive
################################################################################
## Validating
################################################################################
- ${SCRIPTS_DIR}/check_format.sh
-s "${CI_PROJECT_DIR}/src"
-i "${CI_PROJECT_DIR}/include"
-v
################################################################################
## Building
################################################################################
gkfs:
stage: build
- mkdir -p ${BUILD_PATH} && cd ${BUILD_PATH}
- cmake
-Wdev
-Wdeprecate
-DCMAKE_BUILD_TYPE=Debug
-DGKFS_ENABLE_CODE_COVERAGE:BOOL=ON
-DGKFS_BUILD_TESTS:BOOL=ON
-DGKFS_INSTALL_TESTS:BOOL=ON
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH}
-DGKFS_USE_GUIDED_DISTRIBUTION:BOOL=ON
# reduce artifacts size
- ${CI_SCRIPTS_DIR}/trim_build_artifacts.sh ${BUILD_PATH}
script:
- mkdir -p ${BUILD_PATH} && cd ${BUILD_PATH}
- cmake
-Wdev
-Wdeprecate
-DCMAKE_BUILD_TYPE=Debug
-DGKFS_INSTALL_TESTS:BOOL=ON
-DGKFS_ENABLE_FORWARDING:BOOL=ON
-DGKFS_ENABLE_AGIOS:BOOL=ON
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH}
${CI_PROJECT_DIR}
- make -j$(nproc) install
# reduce artifacts size
- ${CI_SCRIPTS_DIR}/trim_build_artifacts.sh ${BUILD_PATH}
- ${BUILD_PATH}
- ${INSTALL_PATH}
################################################################################
## Testing
################################################################################
## == tests for scripts ====================
scripts:
stage: test
needs: []
parallel:
matrix:
- SUBTEST: [ dl_dep.sh, compile_dep.sh ]
script:
- mkdir -p ${BUILD_PATH}/tests/scripts
- cd ${BUILD_PATH}/tests/scripts
- ${BATS} -r ${CI_PROJECT_DIR}/tests/scripts/${SUBTEST} --formatter junit > report.xml
artifacts:
expire_in: 1 week
reports:
junit: ${BUILD_PATH}/tests/scripts/report.xml
## == integration tests for gkfs ===========
gkfs:integration:
interruptible: true
needs: ['gkfs']
parallel:
matrix:
- SUBTEST: [ data, directories, operations, position, shell, status ]
- ${PYTEST} -v -n $(nproc)
${INTEGRATION_TESTS_BIN_PATH}/${SUBTEST}
## capture coverage information
- cd ${BUILD_PATH}
--root-dir ${CI_PROJECT_DIR}
--build-dir ${BUILD_PATH}
--exclusions "${CI_SCRIPTS_DIR}/.coverage-exclusions"
--log-file "${COVERAGE_PATH}/partial/integration_${SUBTEST}/capture.log"
# fix relative paths so that GitLab can find the correct files
after_script:
- perl -i.orig
-pe 's%file="(.*?)"%file="tests/integration/$1"%;'
-pe 's%(../)+install/share/gkfs/%%g;'
${BUILD_PATH}/tests/integration/report.xml
reports:
junit: ${BUILD_PATH}/tests/integration/report.xml
## == integration tests for gkfwd ==========
gkfwd:integration:
interruptible: true
needs: ['gkfwd']
parallel:
matrix:
- SUBTEST: [ forwarding ]
- cd ${BUILD_PATH}/tests/integration
- ${PYTEST} -v -n $(nproc)
${INTEGRATION_TESTS_BIN_PATH}/${SUBTEST}
--root-dir ${CI_PROJECT_DIR}
--build-dir ${BUILD_PATH}
--exclusions "${CI_SCRIPTS_DIR}/.coverage-exclusions"
--log-file "${COVERAGE_PATH}/partial/integration_${SUBTEST}/capture.log"
# fix relative paths so that GitLab can find the correct files
after_script:
- perl -i.orig
-pe 's%file="(.*?)"%file="tests/integration/$1"%;'
-pe 's%(../)+install/share/gkfs/%%g;'
${BUILD_PATH}/tests/integration/report.xml
- ${BUILD_PATH}
reports:
junit: ${BUILD_PATH}/tests/integration/report.xml
## == unit tests for gkfs ==================
gkfs:unit:
## run actual tests
- cd ${BUILD_PATH}/tests/unit
- ctest -j $(nproc) -L unit::all --output-junit report.xml
## capture coverage information
--capture unit
--root-dir ${CI_PROJECT_DIR}
--build-dir ${BUILD_PATH}
--exclusions "${CI_SCRIPTS_DIR}/.coverage-exclusions"
--log-file "${COVERAGE_PATH}/partial/unit/capture.log"
- ${BUILD_PATH}
reports:
junit: ${BUILD_PATH}/tests/unit/report.xml
################################################################################
## Generation of code coverage reports
################################################################################
coverage:
stage: report
needs: [ 'gkfs:integration', 'gkfwd:integration', 'gkfs:unit' ]
script:
- cd ${BUILD_PATH}
## merge the partial coverage files from each test in the pipeline