Skip to content

Commit

Permalink
CI: move variable defs from scripts to gitlab-ci.yml (part 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2es3h committed Feb 22, 2024
1 parent af47b04 commit 11c3514
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
81 changes: 47 additions & 34 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,18 @@ variables:
- .cache/pip/
policy: pull

.build_template: &build
stage: build
.build_template: &setup_build_env
cache: !reference [.build_cache, cache_rw]
tags:
- KaraboFramework
image: europeanxfel/karabo-ci:$ARCH_TAG
script:
before_script:
# install conan to docker image
- python3 -m pip install --upgrade pip
- python3 -m pip install conan==1.62.0
# do CI build
- source set_lsb_release_info.sh
- source ci/prepare "$CI_JOB_NAME"
- source ci/build "$CI_JOB_NAME"
after_script:
# clean up build directories from conan cache
- conan remove "*" -b -f
Expand Down Expand Up @@ -92,55 +90,41 @@ variables:
INFLUXDB_USER: "infusr"
INFLUXDB_USER_PASSWORD: "usrpwd"

.test_template: &test
stage: test
<<: *services_template
<<: *artifacts-spec
cache: !reference [.build_cache, cache_rw]
tags:
- KaraboFramework
image: europeanxfel/karabo-ci:$ARCH_TAG
before_script:
# install conan to docker image
- python3 -m pip install --upgrade pip
- python3 -m pip install conan==1.62.0
# source environment variables for the tests
- source set_lsb_release_info.sh
- source ci/prepare "$CI_JOB_NAME"
after_script:
# clean up build directories from conan cache
- conan remove "*" -b -f


.image_miniconda_: &image_miniconda
image: europeanxfel/karabo-ci:miniconda-3-006
tags:
- KaraboFramework

.release_build: &release-build
<<: *build
stage: build
<<: *setup_build_env
variables:
REL_TAG: $CI_COMMIT_REF_NAME
FRAMEWORK_DEST_DIR: karaboFramework/tags/$CI_COMMIT_REF_NAME
LATEST_RELEASE_TAG: latest_build
FRAMEWORK_LATEST_DIR: karaboFramework/tags/$LATEST_RELEASE_TAG
LATEST_TAG: $LATEST_RELEASE_TAG
GUI_DEST_DIR: karaboGui
script:
- source ci/build "$CI_JOB_NAME"
only:
- /^(\d+\.)(\d+\.)(\d+)$/
except:
- branches
- schedules

.prerelease_build: &prerelease-build
<<: *build
stage: build
<<: *setup_build_env
variables:
REL_TAG: $CI_COMMIT_REF_NAME
FRAMEWORK_DEST_DIR: karaboFramework/tags/$CI_COMMIT_REF_NAME
LATEST_PRERELEASE_TAG: latest_prerelease_build
FRAMEWORK_LATEST_DIR: karaboFramework/tags/$LATEST_PRERELEASE_TAG
LATEST_TAG: $LATEST_PRERELEASE_TAG
GUI_DEST_DIR: karaboGui
script:
- source ci/build "$CI_JOB_NAME"
only:
- /^(\d+\.)(\d+\.)(\d+)((a|b|rc|\.)\d+)$/
except:
Expand Down Expand Up @@ -240,15 +224,26 @@ variables:
when: manual

.nightly_build: &nightly-build
<<: *build
stage: build
<<: *setup_build_env
variables:
NIGHTLY_TAG: Nightly
REL_TAG: $NIGHTLY_TAG
FRAMEWORK_DEST_DIR: karaboFramework/nightly
GUI_DEST_DIR: $FRAMEWORK_DEST_DIR
script:
- source ci/build "$CI_JOB_NAME"

.deps_build: &deps-build
<<: *build
stage: build
<<: *setup_build_env
script:
- pushd extern
- export DEPS_BASE_NAME=$LSB_RELEASE_DIST-$(echo $LSB_RELEASE_VERSION | sed -r "s/^([0-9]+).*/\1/")
- export DEPS_DIR_ABS_PATH=$(pwd -P)/$DEPS_BASE_NAME
- bash build.sh -q $DEPS_BASE_NAME CI
- $DEPS_BASE_NAME/bin/python3 ./builder_path_replace.py --fix-links $DEPS_BASE_NAME/bin $DEPS_DIR_ABS_PATH __KARABO_CI_PATH__
- $DEPS_BASE_NAME/bin/python3 ./builder_path_replace.py $DEPS_BASE_NAME/lib $DEPS_DIR_ABS_PATH __KARABO_CI_PATH__
only:
refs:
- /^deps-(add|update|remove)-.+$/
Expand All @@ -268,7 +263,10 @@ variables:
- "extern/**/*"

.integration_tests: &integration-tests
<<: *test
stage: test
<<: *services_template
<<: *artifacts-spec
<<: *setup_build_env
only:
refs:
- /^(master)$/ # the changes check will default to true
Expand All @@ -291,7 +289,10 @@ variables:


.cpp_unit_tests: &cpp-unit-tests
<<: *test
stage: test
<<: *services_template
<<: *artifacts-spec
<<: *setup_build_env
only:
refs:
- merge_requests
Expand All @@ -307,7 +308,10 @@ variables:
- extern/**/* # changes in extern are covered by deps_tests

.python_unit_tests: &python-unit-tests
<<: *test
stage: test
<<: *services_template
<<: *artifacts-spec
<<: *setup_build_env
only:
refs:
- merge_requests
Expand Down Expand Up @@ -343,7 +347,10 @@ variables:
<<: *artifacts-spec

.deps_tests: &deps-tests
<<: *test
stage: test
<<: *services_template
<<: *artifacts-spec
<<: *setup_build_env
when: manual
only:
refs:
Expand Down Expand Up @@ -557,7 +564,10 @@ cpp_integration tests:

coverage tests:
parallel: !reference [.target_os_matrix, only_centos7]
<<: *test
stage: test
<<: *services_template
<<: *artifacts-spec
<<: *setup_build_env
script:
- bash ./auto_build_all.sh CodeCoverage --quiet
rules:
Expand All @@ -567,7 +577,10 @@ coverage tests:

long tests:
parallel: !reference [.target_os_matrix, all_targets]
<<: *test
stage: test
<<: *services_template
<<: *artifacts-spec
<<: *setup_build_env
script:
- bash ./auto_build_all.sh Debug --runLongTests --quiet
rules:
Expand Down
11 changes: 0 additions & 11 deletions ci/build
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ __release_build() {
fi
}

__deps_build() {
pushd extern
export DEPS_BASE_NAME=$LSB_RELEASE_DIST-$(echo $LSB_RELEASE_VERSION | sed -r "s/^([0-9]+).*/\1/")
export DEPS_DIR_ABS_PATH=$(pwd -P)/$DEPS_BASE_NAME
bash build.sh -q $DEPS_BASE_NAME CI
$DEPS_BASE_NAME/bin/python3 ./builder_path_replace.py --fix-links $DEPS_BASE_NAME/bin $DEPS_DIR_ABS_PATH __KARABO_CI_PATH__
$DEPS_BASE_NAME/bin/python3 ./builder_path_replace.py $DEPS_BASE_NAME/lib $DEPS_DIR_ABS_PATH __KARABO_CI_PATH__
}


echo "Start building job: {$1}"

Expand All @@ -76,7 +67,5 @@ case "$JOB_SCOPE" in
release) __release_build $TARGET_OS ;;
prerelease) __release_build $TARGET_OS ;;
nightly) __release_build $TARGET_OS ;;
deps) __deps_build $JOB_TYPE ;;
tests) __tests_build $JOB_TYPE ;;
*) echo "unknown job scope: $JOB_SCOPE" ;;
esac
2 changes: 0 additions & 2 deletions extern/conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ boost:without_program_options=False
boost:without_python=False
# do not build libboost_numpy
boost:without_numpy=True
# build lapack support with openblas
# openblas:build_lapack=True

[imports]
# the ".."s are because conan install uses $INSTALL_PREFIX/conan_out in build.sh
Expand Down

0 comments on commit 11c3514

Please sign in to comment.