Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 1bfc6313 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1410 Introduce a script to easily generate the Yaml files... and use it to...

#1410 Introduce a script to easily generate the Yaml files... and use it to refresh completely existing ones.
parent fac4bb1e
stages:
- build_and_test
- check_warnings
# - analysis
# - documentation
# - deploy
# Todo: Doxygen doc should be published with pages.
- build_and_test
- check_warnings
# As suggested by https://blog.sparksuite.com/7-ways-to-speed-up-gitlab-ci-cd-times-29f60aab69f9
variables:
......@@ -105,151 +100,6 @@ variables:
- python Scripts/Tools/find_warning_in_doxygen_log.py --log Documentation/Doxygen/${DOXYGEN_OUTPUT_FILE}
allow_failure: true
# .test_template: &test_template
# stage: check_warnings
# image: registry.gitlab.inria.fr/morefem/thirdpartycompilationfactory/${OS}-${COMPILER}-${MODE}:latest
# cache:
# key: "${CI_COMMIT_REF_SLUG}_${OS}-${COMPILER}-${MODE}-${LIB_NATURE}-UniqueLib_${IS_ONLY_ONE_LIB}"
# untracked: true
# paths:
# - build
# script:
# - cd build && ctest
build-Ubuntu-gcc-debug-shared-several_libs:
<<: *build_template_linux
tags:
- ubuntu
- gcc
- debug
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "debug"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
check_warning_Ubuntu-gcc-debug-shared-several_libs:
<<: *check_compilation_warning_template
dependencies:
- build-Ubuntu-gcc-debug-shared-several_libs
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "debug"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
build-Ubuntu-gcc-release-static-one_lib:
<<: *build_template_linux
tags:
- ubuntu
- gcc
- release
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "release"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
check_warning_Ubuntu-gcc-release-static-one_lib:
<<: *check_compilation_warning_template
dependencies:
- build-Ubuntu-gcc-release-static-one_lib
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "release"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
build-Fedora-clang-debug-static-one_lib:
<<: *build_template_linux
tags:
- fedora
- clang
- debug
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "debug"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
check_warning_Fedora-clang-debug-static-one_lib:
<<: *check_compilation_warning_template
dependencies:
- build-Fedora-clang-debug-static-one_lib
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "debug"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
build-Fedora-clang-release-shared-one_lib:
<<: *build_template_linux
tags:
- fedora
- clang
- release
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "release"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
check_warning_Fedora-clang-release-shared-one_lib:
<<: *check_compilation_warning_template
dependencies:
- build-Fedora-clang-release-shared-one_lib
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "release"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
build-Fedora-gcc-debug-static-one_lib:
<<: *build_template_linux
tags:
- fedora
- gcc
- debug
variables:
OS: "fedora"
COMPILER: "gcc"
MODE: "debug"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
check_warning_Fedora-gcc-debug-static-one_lib:
<<: *check_compilation_warning_template
dependencies:
- build-Fedora-gcc-debug-static-one_lib
variables:
OS: "fedora"
COMPILER: "gcc"
MODE: "debug"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
complete_doxygen:
<<: *run_doxygen_template
......@@ -287,3 +137,4 @@ check_warning_complete_doxygen:
# paths:
# - public
\ No newline at end of file
class Configuration():
"""
A class which describes a configuration we would like to compile and put in test in a Yaml file.
The expected usage of this class is to use its Print() method which prints the content as expected in the Yaml
file.
"""
def __init__(self, os, compiler, mode, library_type, is_one_library):
"""
\param os The chosen OS, among "macos", "fedora" and "ubuntu"
\param compiler "clang" or "gcc" so far
\param mode "debug" or "release"
\param library_type "static" or "shared"
\param[in] is_one_library If True, MoReFEM will generate (mostly) one library (with the exception of
post-processing and test which are separate). If False, each MoReFEM module will be in its own library
(except Utilities and ThirdParty which are way too intertwined).
"""
__slots__ = [ "__os", "__compiler", "__mode", "__library_type", "__is_one_library" ]
self.__os = os
self.__compiler = compiler
self.__mode = mode
self.__library_type = library_type
self.__is_one_library = is_one_library
def __key(self):
"""Returns the key that will be used to designate the job in the Yaml file."""
if self.__is_one_library:
library_description = "one_{}_library".format(self.__library_type)
else:
library_description = "several_{}_libraries".format(self.__library_type)
return "{os}_{compiler}_{mode}_{library_description}".format(os = self.__os, \
compiler = self.__compiler, \
mode = self.__mode, \
library_description = library_description)
def __PrintTagsAndVariables(self, do_define_tags):
"""Helper method to Print().
\param define_tags If True, a field with tags will also be written to coerce the jobs to go on dedicated
VMs.
"""
if do_define_tags:
print(" tags:")
print(" - {}".format(self.__os))
print(" - {}".format(self.__compiler))
print(" - {}".format(self.__mode))
print(" variables:")
print(" OS: {}".format(self.__os))
print(" COMPILER: {}".format(self.__compiler))
print(" MODE: {}".format(self.__mode))
print(" LIB_NATURE: {}".format(self.__library_type))
print(" OS: {}".format(self.__os))
print(" IS_ONLY_ONE_LIB: {}".format(self.__is_one_library))
def Print(self, do_define_tags):
"""Print the two jobs related to the chosen configuration; the output may be pasted as such in the Yaml file.
\param define_tags If True, a field with tags will also be written to coerce the jobs to go on dedicated
VMs.
"""
key = self.__key()
if self.__os in ("ubuntu", "fedora"):
unix = "linux"
elif self.__os == "macos":
unix = "macos"
else:
raise Exception("Chosen OS ({}) is not a known one".format(self.__os))
print("build_{}:".format(key))
print(" <<: *build_template_{}".format(unix))
self.__PrintTagsAndVariables(do_define_tags)
print("")
print("check_{}:".format(key))
print(" <<: *check_compilation_warning_template")
self.__PrintTagsAndVariables(do_define_tags)
if __name__ == "__main__":
do_define_tags = True
print("include:")
print(" - local: '/ExternalTools/Gitlab-CI/common.yml'\n\n")
configuration_list = \
(
Configuration("ubuntu", "gcc", "debug", "shared", False),
Configuration("ubuntu", "gcc", "release", "static", True),
Configuration("fedora", "gcc", "debug", "shared", True),
Configuration("fedora", "gcc", "release", "static", False),
Configuration("fedora", "clang", "debug", "shared", False),
Configuration("fedora", "clang", "release", "static", True),
Configuration("macos", "clang", "debug", "static", True),
Configuration("macos", "clang", "release", "shared", False),
)
for config in configuration_list:
config.Print(do_define_tags)
print("\n")
\ No newline at end of file
stages:
- build_and_test
- check_warnings
# - analysis
# - documentation
# - deploy
include:
- local: '/ExternalTools/Gitlab-CI/common.yml'
# Todo: Doxygen doc should be published with pages.
# As suggested by https://blog.sparksuite.com/7-ways-to-speed-up-gitlab-ci-cd-times-29f60aab69f9
variables:
DOCKER_DRIVER: overlay2
.build_template_linux: &build_template_linux
stage: build_and_test
image: registry.gitlab.inria.fr/morefem/thirdpartycompilationfactory/${OS}-${COMPILER}-${MODE}
cache:
key: "cache_${CI_COMMIT_REF_SLUG}_${OS}-${COMPILER}-${MODE}-${LIB_NATURE}-${IS_ONLY_ONE_LIB}"
untracked: true
paths:
- build
artifacts:
name: "artifact_${CI_COMMIT_REF_SLUG}_${OS}-${COMPILER}-${MODE}-${LIB_NATURE}-${IS_ONLY_ONE_LIB}"
expire_in: 8 hours
paths:
- build/compilation.log
script:
- mkdir -p build
- cd build && python ../cmake/Scripts/configure_cmake.py --cache_file=../cmake/PreCache/linux.cmake --cmake_args="-G Ninja" --third_party_directory=/opt --mode=${MODE} --library_type=${LIB_NATURE} --morefem_as_single_library=${IS_ONLY_ONE_LIB}
- ninja |& tee compilation.log
- ninja test # as artifact are limited in size, I can't unfortunately use a separate stage...
.build_template_macos: &build_template_macos
stage: build_and_test
tags:
- macos
cache:
key: "cache_${CI_COMMIT_REF_SLUG}_${OS}-${COMPILER}-${MODE}-${LIB_NATURE}-${IS_ONLY_ONE_LIB}"
untracked: true
paths:
- build
artifacts:
name: "artifact_${CI_COMMIT_REF_SLUG}_${OS}-${COMPILER}-${MODE}-${LIB_NATURE}-${IS_ONLY_ONE_LIB}"
expire_in: 8 hours
paths:
- build/compilation.log
script:
- mkdir -p build
- source activate Python3
- cd build && python ../cmake/Scripts/configure_cmake.py --cache_file=../cmake/PreCache/macos_apple_clang.cmake --cmake_args="-G Ninja" --third_party_directory=/Volumes/Data/ci/opt/${MODE} --mode=${MODE} --library_type=${LIB_NATURE} --morefem_as_single_library=${IS_ONLY_ONE_LIB}
- ninja 2>&1 | tee compilation.log
- ninja test # as artifact are limited in size, I can't unfortunately use a separate stage...
.run_doxygen_template: &run_doxygen_template
stage: build_and_test
image: ubuntu:latest
artifacts:
name: "artifact_run_doxygen_${CI_COMMIT_REF_SLUG}_${DOX}"
expire_in: 1 day
paths:
- Documentation/Doxygen/${OUTPUT_FILE}
before_script:
- apt-get update -y
- apt-get install -y doxygen graphviz libjs-mathjax
script:
- cd Documentation/Doxygen
- doxygen ${DOX}
.check_compilation_warning_template: &check_compilation_warning_template
stage: check_warnings
image: alpine:latest
before_script:
- apk add --update python python-dev && rm -rf /var/cache/apk/*
# dependencies: in the instantiations!
script:
- python Scripts/Tools/find_warning_in_compilation_log.py --log build/compilation.log
allow_failure: true
.check_doxygen_warning_template: &check_doxygen_warning_template
stage: check_warnings
image: alpine:latest
artifacts:
name: "artifact_check_warning_doxygen_${CI_COMMIT_REF_SLUG}_${DOXYGEN_OUTPUT_FILE}"
when: on_failure
expire_in: 1 day
paths:
- filtered_doxygen_log.txt
before_script:
- apk add --update python python-dev && rm -rf /var/cache/apk/*
# dependencies: in the instantiations!
script:
- python Scripts/Tools/find_warning_in_doxygen_log.py --log Documentation/Doxygen/${DOXYGEN_OUTPUT_FILE}
allow_failure: true
# .test_template: &test_template
# stage: check_warnings
# image: registry.gitlab.inria.fr/morefem/thirdpartycompilationfactory/${OS}-${COMPILER}-${MODE}:latest
# cache:
# key: "${CI_COMMIT_REF_SLUG}_${OS}-${COMPILER}-${MODE}-${LIB_NATURE}-UniqueLib_${IS_ONLY_ONE_LIB}"
# untracked: true
# paths:
# - build
# script:
# - cd build && ctest
build-Ubuntu-gcc-debug-shared-several_libs:
build_ubuntu_gcc_debug_several_shared_libraries:
<<: *build_template_linux
tags:
- ubuntu
- gcc
- debug
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "debug"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
check_warning_Ubuntu-gcc-debug-shared-several_libs:
OS: ubuntu
COMPILER: gcc
MODE: debug
LIB_NATURE: shared
OS: ubuntu
IS_ONLY_ONE_LIB: False
check_ubuntu_gcc_debug_several_shared_libraries:
<<: *check_compilation_warning_template
dependencies:
- build-Ubuntu-gcc-debug-shared-several_libs
tags:
- ubuntu
- gcc
- debug
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "debug"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
OS: ubuntu
COMPILER: gcc
MODE: debug
LIB_NATURE: shared
OS: ubuntu
IS_ONLY_ONE_LIB: False
build-Ubuntu-gcc-release-static-one_lib:
build_ubuntu_gcc_release_one_static_library:
<<: *build_template_linux
tags:
- ubuntu
- gcc
- release
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "release"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
check_warning_Ubuntu-gcc-release-static-one_lib:
OS: ubuntu
COMPILER: gcc
MODE: release
LIB_NATURE: static
OS: ubuntu
IS_ONLY_ONE_LIB: True
check_ubuntu_gcc_release_one_static_library:
<<: *check_compilation_warning_template
dependencies:
- build-Ubuntu-gcc-release-static-one_lib
tags:
- ubuntu
- gcc
- release
variables:
OS: "ubuntu"
COMPILER: "gcc"
MODE: "release"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
OS: ubuntu
COMPILER: gcc
MODE: release
LIB_NATURE: static
OS: ubuntu
IS_ONLY_ONE_LIB: True
build-Fedora-clang-debug-static-one_lib:
build_fedora_gcc_debug_one_shared_library:
<<: *build_template_linux
tags:
- fedora
- gcc
- debug
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "debug"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
check_warning_Fedora-clang-debug-static-one_lib:
OS: fedora
COMPILER: gcc
MODE: debug
LIB_NATURE: shared
OS: fedora
IS_ONLY_ONE_LIB: True
check_fedora_gcc_debug_one_shared_library:
<<: *check_compilation_warning_template
dependencies:
- build-Fedora-clang-debug-static-one_lib
tags:
- fedora
- gcc
- debug
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "debug"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
OS: fedora
COMPILER: gcc
MODE: debug
LIB_NATURE: shared
OS: fedora
IS_ONLY_ONE_LIB: True
build-Fedora-clang-release-shared-one_lib:
build_fedora_gcc_release_several_static_libraries:
<<: *build_template_linux
tags:
- fedora
- gcc
- release
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "release"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
check_warning_Fedora-clang-release-shared-one_lib:
OS: fedora
COMPILER: gcc
MODE: release
LIB_NATURE: static
OS: fedora
IS_ONLY_ONE_LIB: False
check_fedora_gcc_release_several_static_libraries:
<<: *check_compilation_warning_template
dependencies:
- build-Fedora-clang-release-shared-one_lib
tags:
- fedora
- gcc
- release
variables:
OS: "fedora"
COMPILER: "clang"
MODE: "release"
LIB_NATURE: "shared"
IS_ONLY_ONE_LIB: "False"
build-Fedora-gcc-debug-static-one_lib:
OS: fedora
COMPILER: gcc
MODE: release
LIB_NATURE: static
OS: fedora
IS_ONLY_ONE_LIB: False
build_fedora_clang_debug_several_shared_libraries:
<<: *build_template_linux
tags:
- fedora
- clang
- debug
variables:
OS: "fedora"
COMPILER: "gcc"
MODE: "debug"
LIB_NATURE: "static"
IS_ONLY_ONE_LIB: "True"
check_warning_Fedora-gcc-debug-static-one_lib:
OS: fedora
COMPILER: clang
MODE: debug
LIB_NATURE: shared
OS: fedora
IS_ONLY_ONE_LIB: False