Ver Fonte

gitlab-ci: add Linux makefiles and ninja builders

Ben Boeckel há 5 anos atrás
pai
commit
a1b1fc611b

+ 134 - 1
.gitlab-ci.yml

@@ -4,7 +4,7 @@
     - tags@cmake/cmake
     - tags@cmake/cmake
 
 
 .fedora31: &fedora31
 .fedora31: &fedora31
-    image: "kitware/cmake:ci-fedora31-x86_64-2020-05-05"
+    image: "kitware/cmake:ci-fedora31-x86_64-2020-05-08"
 
 
     variables:
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/gitlab-kitware-cmake ci"
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/gitlab-kitware-cmake ci"
@@ -21,6 +21,7 @@
     variables:
     variables:
         CMAKE_CONFIGURATION: debian10_iwyu
         CMAKE_CONFIGURATION: debian10_iwyu
         CTEST_NO_WARNINGS_ALLOWED: 1
         CTEST_NO_WARNINGS_ALLOWED: 1
+        CMake_SKIP_INSTALL: 1
 
 
 .fedora31_tidy: &fedora31_tidy
 .fedora31_tidy: &fedora31_tidy
     extends: .fedora31
     extends: .fedora31
@@ -28,6 +29,7 @@
     variables:
     variables:
         CMAKE_CONFIGURATION: fedora31_tidy
         CMAKE_CONFIGURATION: fedora31_tidy
         CTEST_NO_WARNINGS_ALLOWED: 1
         CTEST_NO_WARNINGS_ALLOWED: 1
+        CMake_SKIP_INSTALL: 1
 
 
 .fedora31_sphinx: &fedora31_sphinx
 .fedora31_sphinx: &fedora31_sphinx
     extends: .fedora31
     extends: .fedora31
@@ -36,6 +38,22 @@
         CMAKE_CONFIGURATION: fedora31_sphinx
         CMAKE_CONFIGURATION: fedora31_sphinx
         CTEST_NO_WARNINGS_ALLOWED: 1
         CTEST_NO_WARNINGS_ALLOWED: 1
         CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
         CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
+        CMake_SKIP_INSTALL: 1
+
+.fedora31_ninja: &fedora31_ninja
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_ninja
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
+.fedora31_makefiles: &fedora31_makefiles
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_makefiles
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMAKE_GENERATOR: "Unix Makefiles"
 
 
 before_script:
 before_script:
     - .gitlab/ci/cmake.sh
     - .gitlab/ci/cmake.sh
@@ -62,6 +80,79 @@ before_script:
 
 
     interruptible: true
     interruptible: true
 
 
+.cmake_build_artifacts: &cmake_build_artifacts
+    artifacts:
+        expire_in: 1d
+        paths:
+            # XXX(globbing): Can be simplified with support from
+            # https://gitlab.com/gitlab-org/gitlab-runner/issues/4840
+            - build/CTestTestfile.cmake
+            - build/*/CTestTestfile.cmake
+            - build/*/*/CTestTestfile.cmake
+            - build/*/*/*/CTestTestfile.cmake
+            - build/*/*/*/*/CTestTestfile.cmake
+
+            # Allow CMake to find CMAKE_ROOT.
+            - build/CMakeFiles/CMakeSourceDir.txt
+
+            # Take the install tree.
+            - build/install/
+
+            # We need the main binaries.
+            - build/bin/
+            # The cache is needed for the installation test.
+            - build/CMakeCache.txt
+            # Test binaries. Eventually these might be better under
+            # `Source/Tests` or the like.
+            - build/Tests/EnforceConfig.cmake
+            - build/Tests/CMakeBuildTest.cmake
+            - build/Tests/CMakeBuildDoubleProjectTest.cmake
+            - build/Tests/CMake*/runcompilecommands
+            - build/Tests/CMake*/test*
+            - build/Tests/CMake*/PseudoMemcheck/valgrind
+            - build/Tests/CMake*/PseudoMemcheck/purify
+            - build/Tests/CMake*/PseudoMemcheck/memcheck_fail
+            - build/Tests/CMake*/PseudoMemcheck/BC
+            - build/Tests/CMake*/PseudoMemcheck/NoLog
+            - build/Tests/CMake*Lib/*LibTests
+            - build/Source/kwsys/cmsysTest*
+            - build/Utilities/cmcurl/curltest
+            - build/Utilities/KWIML/test/kwiml_test
+            - build/Source/kwsys/libcmsysTestDynload.so
+
+            # Test directories.
+            - build/Tests/CTest*
+            - build/Tests/Find*
+            - build/Tests/Qt5*
+            - build/Tests/RunCMake/
+            - build/Tests/CMakeOnly/
+            - build/Tests/CMakeTests/
+
+            # CTest/CDash information.
+            - build/Testing/
+            - build/DartConfiguation.tcl
+            - build/CTestCustom.cmake
+
+.cmake_test_artifacts: &cmake_test_artifacts
+    artifacts:
+        expire_in: 1d
+        paths:
+            # Take the install tree.
+            - build/install/
+
+.cmake_test_unix: &cmake_test_unix
+    stage: test
+    only: *only_settings
+    tags:
+        - build
+        - docker
+        - linux
+
+    script:
+        - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
+
+    interruptible: true
+
 stages:
 stages:
     - build
     - build
     - test
     - test
@@ -85,3 +176,45 @@ build:fedora31-sphinx:
         - docker
         - docker
         - linux
         - linux
         - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
         - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+
+build:fedora31-ninja:
+    <<:
+        - *fedora31_ninja
+        - *cmake_build_unix
+        - *cmake_build_artifacts
+    when: manual
+
+test:fedora31-ninja:
+    <<:
+        - *fedora31_ninja
+        - *cmake_test_unix
+    tags:
+        - build
+        - docker
+        - linux
+        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+    dependencies:
+        - build:fedora31-ninja
+    needs:
+        - build:fedora31-ninja
+
+build:fedora31-makefiles:
+    <<:
+        - *fedora31_makefiles
+        - *cmake_build_unix
+        - *cmake_build_artifacts
+    when: manual
+
+test:fedora31-makefiles:
+    <<:
+        - *fedora31_makefiles
+        - *cmake_test_unix
+    tags:
+        - build
+        - docker
+        - linux
+        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+    dependencies:
+        - build:fedora31-makefiles
+    needs:
+        - build:fedora31-makefiles

+ 6 - 0
.gitlab/ci/configure_common.cmake

@@ -1,3 +1,9 @@
 set(CTEST_USE_LAUNCHERS "ON" CACHE STRING "")
 set(CTEST_USE_LAUNCHERS "ON" CACHE STRING "")
 
 
+# We run the install right after the build. Avoid rerunning it when installing.
+set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "ON" CACHE STRING "")
+# Install CMake under the build tree.
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "")
+set(CMake_TEST_INSTALL "OFF" CACHE BOOL "")
+
 include("${CMAKE_CURRENT_LIST_DIR}/configure_sccache.cmake")
 include("${CMAKE_CURRENT_LIST_DIR}/configure_sccache.cmake")

+ 1 - 0
.gitlab/ci/configure_fedora31_makefiles.cmake

@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")

+ 1 - 0
.gitlab/ci/configure_fedora31_ninja.cmake

@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")

+ 11 - 0
.gitlab/ci/ctest_build.cmake

@@ -28,3 +28,14 @@ if ("$ENV{CTEST_NO_WARNINGS_ALLOWED}" AND num_warnings GREATER 0)
   message(FATAL_ERROR
   message(FATAL_ERROR
     "Found ${num_warnings} warnings (treating as fatal).")
     "Found ${num_warnings} warnings (treating as fatal).")
 endif ()
 endif ()
+
+if (NOT "$ENV{CMake_SKIP_INSTALL}")
+  ctest_build(APPEND
+    TARGET install
+    RETURN_VALUE install_result)
+
+  if (install_result)
+    message(FATAL_ERROR
+      "Failed to install")
+  endif ()
+endif ()

+ 1 - 0
.gitlab/ci/ctest_exclusions.cmake

@@ -1,5 +1,6 @@
 set(test_exclusions
 set(test_exclusions
 )
 )
+
 string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
 string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
 if (test_exclusions)
 if (test_exclusions)
   set(test_exclusions "(${test_exclusions})")
   set(test_exclusions "(${test_exclusions})")