Jelajahi Sumber

gitlab-ci: consolidate release and package job infrastructure

Use `linux_release` in names associated with building or testing
release-style binaries.  Add a `.linux_package` helper to adjust
the release binary build behavior for package-specific jobs.
Brad King 4 tahun lalu
induk
melakukan
616bf0d2f0

+ 11 - 9
.gitlab-ci.yml

@@ -93,8 +93,8 @@ build:fedora33-sphinx:
 
 
 build:centos6-release:
 build:centos6-release:
     extends:
     extends:
-        - .release_linux
-        - .cmake_build_release_linux
+        - .linux_release_x86_64
+        - .cmake_build_linux_release
         - .cmake_release_artifacts
         - .cmake_release_artifacts
         - .linux_builder_tags
         - .linux_builder_tags
         - .run_manually
         - .run_manually
@@ -102,7 +102,7 @@ build:centos6-release:
 test:debian10-ninja:
 test:debian10-ninja:
     extends:
     extends:
         - .debian10_ninja
         - .debian10_ninja
-        - .cmake_test_linux_package
+        - .cmake_test_linux_release
         - .linux_builder_tags_qt
         - .linux_builder_tags_qt
         - .run_dependent
         - .run_dependent
     dependencies:
     dependencies:
@@ -113,7 +113,7 @@ test:debian10-ninja:
 test:fedora33-makefiles:
 test:fedora33-makefiles:
     extends:
     extends:
         - .fedora33_makefiles
         - .fedora33_makefiles
-        - .cmake_test_linux_package
+        - .cmake_test_linux_release
         - .linux_builder_tags_qt
         - .linux_builder_tags_qt
         - .run_dependent
         - .run_dependent
     dependencies:
     dependencies:
@@ -124,7 +124,7 @@ test:fedora33-makefiles:
 test:cuda10.2-nvidia:
 test:cuda10.2-nvidia:
     extends:
     extends:
         - .cuda10.2_nvidia
         - .cuda10.2_nvidia
-        - .cmake_test_linux_package
+        - .cmake_test_linux_release
         - .linux_builder_tags_cuda
         - .linux_builder_tags_cuda
         - .run_dependent
         - .run_dependent
     dependencies:
     dependencies:
@@ -165,8 +165,9 @@ test:fedora33-ninja-multi:
 
 
 build:linux-x86_64-package:
 build:linux-x86_64-package:
     extends:
     extends:
-        - .linux_package_x86_64
-        - .cmake_build_linux_package
+        - .linux_package
+        - .linux_release_x86_64
+        - .cmake_build_linux_release
         - .cmake_release_artifacts
         - .cmake_release_artifacts
         - .linux_builder_tags
         - .linux_builder_tags
         - .run_only_for_package
         - .run_only_for_package
@@ -188,8 +189,9 @@ upload:linux-x86_64-package:
 
 
 build:linux-aarch64-package:
 build:linux-aarch64-package:
     extends:
     extends:
-        - .linux_package_aarch64
-        - .cmake_build_linux_package
+        - .linux_package
+        - .linux_release_aarch64
+        - .cmake_build_linux_release
         - .cmake_release_artifacts
         - .cmake_release_artifacts
         - .linux_builder_tags_aarch64
         - .linux_builder_tags_aarch64
         - .run_only_for_package
         - .run_only_for_package

+ 14 - 50
.gitlab/os-linux.yml

@@ -4,20 +4,13 @@
 
 
 ### Release
 ### Release
 
 
-.release_linux:
-    image: "kitware/cmake:build-linux-x86_64-deps-2020-04-02@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157"
-
-    variables:
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
-        LAUNCHER: "scl enable devtoolset-6 rh-python36 --"
-
 .linux_prep_source:
 .linux_prep_source:
     image: "fedora:33"
     image: "fedora:33"
 
 
     variables:
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
 
 
-.linux_package_x86_64:
+.linux_release_x86_64:
     image: "kitware/cmake:build-linux-x86_64-deps-2020-04-02@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157"
     image: "kitware/cmake:build-linux-x86_64-deps-2020-04-02@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157"
 
 
     variables:
     variables:
@@ -25,7 +18,7 @@
         LAUNCHER: "scl enable devtoolset-6 rh-python36 --"
         LAUNCHER: "scl enable devtoolset-6 rh-python36 --"
         CMAKE_ARCH: x86_64
         CMAKE_ARCH: x86_64
 
 
-.linux_package_aarch64:
+.linux_release_aarch64:
     image: "kitware/cmake:build-linux-aarch64-deps-2020-12-21@sha256:0bd7dfe4e45593b04e39cd21e44011034610cfd376900558c5ef959bb1af15af"
     image: "kitware/cmake:build-linux-aarch64-deps-2020-12-21@sha256:0bd7dfe4e45593b04e39cd21e44011034610cfd376900558c5ef959bb1af15af"
 
 
     variables:
     variables:
@@ -33,6 +26,10 @@
         LAUNCHER: "scl enable devtoolset-7 --"
         LAUNCHER: "scl enable devtoolset-7 --"
         CMAKE_ARCH: aarch64
         CMAKE_ARCH: aarch64
 
 
+.linux_package:
+    variables:
+        BOOTSTRAP_ARGS: '-- "-DCMake_DOC_ARTIFACT_PREFIX=$CI_PROJECT_DIR/build/install-doc"'
+
 ### Debian
 ### Debian
 
 
 .debian10:
 .debian10:
@@ -40,6 +37,7 @@
 
 
     variables:
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+        CMAKE_ARCH: x86_64
 
 
 .debian10_iwyu:
 .debian10_iwyu:
     extends: .debian10
     extends: .debian10
@@ -56,6 +54,7 @@
 
 
     variables:
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
+        CMAKE_ARCH: x86_64
 
 
 #### Lint builds
 #### Lint builds
 
 
@@ -122,6 +121,7 @@
 
 
     variables:
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+        CMAKE_ARCH: x86_64
         CTEST_LABELS: "CUDA"
         CTEST_LABELS: "CUDA"
 
 
 .cuda10.2_nvidia:
 .cuda10.2_nvidia:
@@ -225,11 +225,12 @@
 
 
     interruptible: true
     interruptible: true
 
 
-.cmake_build_linux_package:
+.cmake_build_linux_release:
     stage: build
     stage: build
 
 
     script:
     script:
         # Bootstrap.
         # Bootstrap.
+        - mkdir -p build/
         - cp -v Utilities/Release/linux/$CMAKE_ARCH/cache.txt build/CMakeCache.txt
         - cp -v Utilities/Release/linux/$CMAKE_ARCH/cache.txt build/CMakeCache.txt
         # Make sccache available.
         # Make sccache available.
         - .gitlab/ci/sccache.sh
         - .gitlab/ci/sccache.sh
@@ -248,44 +249,7 @@
         - git reset --hard
         - git reset --hard
         # Bootstrap
         # Bootstrap
         - cd build/
         - cd build/
-        - '$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake -- "-DCMake_DOC_ARTIFACT_PREFIX=$CI_PROJECT_DIR/build/install-doc"'
-        # FIXME: When CTest can drive an external CMake for the build as well,
-        # use the scripts here.
-        - "$LAUNCHER make -j$(nproc)"
-        # NOTE: This regex matches that used in the release build.
-        - "$LAUNCHER bin/ctest --output-on-failure -j$(nproc) -R '^(CMake\\.|CMakeLib\\.|CMakeServerLib\\.|RunCMake\\.ctest_memcheck)'"
-        # Make a package.
-        - bin/cpack -G TGZ
-        - bin/cpack -G STGZ
-        - sccache --show-stats
-
-    interruptible: true
-
-.cmake_build_release_linux:
-    stage: build
-
-    script:
-        # Bootstrap.
-        - mkdir build/
-        - cp -v Utilities/Release/linux/x86_64/cache.txt build/CMakeCache.txt
-        # Make sccache available.
-        - .gitlab/ci/sccache.sh
-        - export PATH=$PWD/.gitlab:$PATH
-        # Append sccache settings to the cache.
-        - echo "CMAKE_C_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
-        - echo "CMAKE_CXX_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
-        # CI settings.
-        - echo "CMake_TEST_INSTALL:BOOL=OFF" >> build/CMakeCache.txt
-        - echo "CMAKE_INSTALL_PREFIX:PATH=$PWD/build/install" >> build/CMakeCache.txt
-        - echo "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY:BOOL=ON" >> build/CMakeCache.txt
-        # Appease Git. The Git in this container is old (1.7) and doesn't
-        # understand some things. But, it doesn't need to, so make it blind.
-        - mkdir -p .git/info
-        - echo "* -crlf" >> .git/info/attributes
-        - git reset --hard
-        # Bootstrap
-        - cd build/
-        - "$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake"
+        - '$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake $BOOTSTRAP_ARGS'
         # FIXME: When CTest can drive an external CMake for the build as well,
         # FIXME: When CTest can drive an external CMake for the build as well,
         # use the scripts here.
         # use the scripts here.
         - "$LAUNCHER make -j$(nproc)"
         - "$LAUNCHER make -j$(nproc)"
@@ -298,14 +262,14 @@
 
 
     interruptible: true
     interruptible: true
 
 
-.cmake_test_linux_package:
+.cmake_test_linux_release:
     stage: test-ext
     stage: test-ext
 
 
     script:
     script:
         - *before_script_linux
         - *before_script_linux
         # Make the CMake package available.
         # Make the CMake package available.
         - mkdir -p build/install
         - mkdir -p build/install
-        - tar -C build/install --strip-components=1 -xzf build/cmake-*-linux-x86_64.tar.gz
+        - tar -C build/install --strip-components=1 -xzf build/cmake-*-linux-$CMAKE_ARCH.tar.gz
         - .gitlab/ci/sccache.sh
         - .gitlab/ci/sccache.sh
         - sccache --start-server
         - sccache --start-server
         - sccache --show-stats
         - sccache --show-stats

+ 1 - 1
Utilities/Release/linux/aarch64/Dockerfile

@@ -5,7 +5,7 @@
 # Build using the CMake source directory as the build context.
 # Build using the CMake source directory as the build context.
 # The resulting image will have an '/out' directory containing the package.
 # The resulting image will have an '/out' directory containing the package.
 
 
-# Keep this in sync with the `.gitlab-ci.yml` `release_linux` image.
+# Keep this in sync with the `.gitlab/os-linux.yml` `.linux_release_aarch64` image.
 ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-aarch64-deps-2020-12-21
 ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-aarch64-deps-2020-12-21
 ARG FROM_IMAGE_DIGEST=@sha256:0bd7dfe4e45593b04e39cd21e44011034610cfd376900558c5ef959bb1af15af
 ARG FROM_IMAGE_DIGEST=@sha256:0bd7dfe4e45593b04e39cd21e44011034610cfd376900558c5ef959bb1af15af
 ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
 ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST

+ 1 - 1
Utilities/Release/linux/x86_64/Dockerfile

@@ -5,7 +5,7 @@
 # Build using the CMake source directory as the build context.
 # Build using the CMake source directory as the build context.
 # The resulting image will have an '/out' directory containing the package.
 # The resulting image will have an '/out' directory containing the package.
 
 
-# Keep this in sync with the `.gitlab-ci.yml` `release_linux` image.
+# Keep this in sync with the `.gitlab/os-linux.yml` `.linux_release_x86_64` image.
 ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-x86_64-deps-2020-04-02
 ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-x86_64-deps-2020-04-02
 ARG FROM_IMAGE_DIGEST=@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157
 ARG FROM_IMAGE_DIGEST=@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157
 ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
 ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST