From d6fe877cf988dc72853d744566ec0ce997647db9 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 12 Jun 2020 11:10:58 -0400
Subject: gitlab-ci: split into multiple files

Also add comments for sections to make it easier to figure out what's
going on.

Also rename the `cmake_test_unix_package` to be Linux-specific since it
actually is.
---
 .gitlab-ci.yml         | 479 ++-----------------------------------------------
 .gitlab/artifacts.yml  |  79 ++++++++
 .gitlab/os-linux.yml   | 180 +++++++++++++++++++
 .gitlab/os-macos.yml   |  81 +++++++++
 .gitlab/os-unix.yml    |  35 ++++
 .gitlab/os-windows.yml | 116 ++++++++++++
 .gitlab/rules.yml      |  16 ++
 7 files changed, 524 insertions(+), 462 deletions(-)
 create mode 100644 .gitlab/artifacts.yml
 create mode 100644 .gitlab/os-linux.yml
 create mode 100644 .gitlab/os-macos.yml
 create mode 100644 .gitlab/os-unix.yml
 create mode 100644 .gitlab/os-windows.yml
 create mode 100644 .gitlab/rules.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 438510c..3fa3f55 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,472 +1,21 @@
-.manual_rules_settings: &manual_rules_settings
-    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
-      when: delayed
-      start_in: 5 minutes
-    - if: '$CI_MERGE_REQUEST_ID'
-      when: manual
-    - when: never
+include:
+    # Metadata shared my many jobs
+    - local: .gitlab/rules.yml
+    - local: .gitlab/artifacts.yml
 
-.rules_settings: &rules_settings
-    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
-      when: always
-    - if: '$CI_MERGE_REQUEST_ID'
-      when: always
-    - when: never
-
-.release_linux: &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 --"
-
-.fedora31: &fedora31
-    image: "kitware/cmake:ci-fedora31-x86_64-2020-06-01"
-
-    variables:
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
-
-.debian10: &debian10
-    image: "kitware/cmake:ci-debian10-x86_64-2020-04-27"
-
-    variables:
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
-
-.debian10_iwyu: &debian10_iwyu
-    extends: .debian10
-
-    variables:
-        CMAKE_CONFIGURATION: debian10_iwyu
-        CTEST_NO_WARNINGS_ALLOWED: 1
-        CMake_SKIP_INSTALL: 1
-
-.fedora31_tidy: &fedora31_tidy
-    extends: .fedora31
-
-    variables:
-        CMAKE_CONFIGURATION: fedora31_tidy
-        CTEST_NO_WARNINGS_ALLOWED: 1
-        CMake_SKIP_INSTALL: 1
-
-.fedora31_sphinx: &fedora31_sphinx
-    extends: .fedora31
-
-    variables:
-        CMAKE_CONFIGURATION: fedora31_sphinx
-        CTEST_NO_WARNINGS_ALLOWED: 1
-        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_ninja_multi: &fedora31_ninja_multi
-    extends: .fedora31
-
-    variables:
-        CMAKE_CONFIGURATION: fedora31_ninja_multi
-        CTEST_NO_WARNINGS_ALLOWED: 1
-        CMAKE_GENERATOR: "Ninja Multi-Config"
-
-.fedora31_makefiles: &fedora31_makefiles
-    extends: .fedora31
-
-    variables:
-        CMAKE_CONFIGURATION: fedora31_makefiles
-        CTEST_NO_WARNINGS_ALLOWED: 1
-        CMAKE_GENERATOR: "Unix Makefiles"
-
-.cuda10.2: &cuda
-    image: "kitware/cmake:ci-cuda10.2-x86_64-2020-06-11"
-
-    variables:
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
-        CTEST_LABELS: "CUDA"
-
-.cuda10.2_nvidia: &cuda10_2_nvidia
-    extends: .cuda10.2
-
-    variables:
-        CMAKE_CONFIGURATION: cuda10.2_nvidia
-        CTEST_NO_WARNINGS_ALLOWED: 1
-
-.macos: &macos
-    variables:
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
-        # TODO: Factor this out so that each job selects the Xcode version to
-        # use so that different versions can be tested in a single pipeline.
-        DEVELOPER_DIR: "/Applications/Xcode-11.5.app/Contents/Developer"
-
-.macos_build: &macos_build
-    extends: .macos
-
-    variables:
-        # Note that shell runners only support runners with a single
-        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
-        # change between the build and test stages which CMake doesn't support.
-        # Even if we could, it could change if other runners on the machine
-        # could run at the same time, so we drop it.
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
-
-.macos_ninja: &macos_ninja
-    extends: .macos_build
-
-    variables:
-        CMAKE_CONFIGURATION: macos_ninja
-        CTEST_NO_WARNINGS_ALLOWED: 1
-
-.macos_makefiles: &macos_makefiles
-    extends: .macos_build
-
-    variables:
-        CMAKE_CONFIGURATION: macos_makefiles
-        CTEST_NO_WARNINGS_ALLOWED: 1
-        CMAKE_GENERATOR: "Unix Makefiles"
-
-.macos_xcode: &macos_xcode
-    extends: .macos
-
-    variables:
-        CMAKE_CONFIGURATION: macos_xcode
-        CMAKE_GENERATOR: Xcode
-
-.windows: &windows
-    variables:
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci ext\\$CI_CONCURRENT_ID"
-
-.windows_build: &windows_build
-    extends: .windows
-
-    variables:
-        # Note that shell runners only support runners with a single
-        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
-        # change between the build and test stages which CMake doesn't support.
-        # Even if we could, it could change if other runners on the machine
-        # could run at the same time, so we drop it.
-        GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci"
-
-.windows_ninja: &windows_ninja
-    extends: .windows_build
-
-    variables:
-        # Debug and RelWithDebinfo build types use the `/Zi` which results in
-        # uncacheable compiations.
-        # https://github.com/mozilla/sccache/issues/242
-        CMAKE_BUILD_TYPE: Release
-        CTEST_NO_WARNINGS_ALLOWED: 1
-
-.windows_vs2019_x64_ninja: &windows_vs2019_x64_ninja
-    extends: .windows_ninja
-
-    variables:
-        CMAKE_CONFIGURATION: windows_vs2019_x64_ninja
-        VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
-        VCVARSPLATFORM: "x64"
-        VCVARSVERSION: "14.26"
-
-.windows_vs2019_x64: &windows_vs2019_x64
-    extends: .windows
-
-    variables:
-        CMAKE_CONFIGURATION: windows_vs2019_x64
-        CMAKE_GENERATOR: "Visual Studio 16 2019"
-        CMAKE_GENERATOR_PLATFORM: "x64"
-        CMAKE_GENERATOR_TOOLSET: "v142,version=14.26"
-
-.linux_builder_tags: &linux_builder_tags
-    tags:
-        - build
-        - docker
-        - linux
-
-.linux_builder_tags_qt: &linux_builder_tags_qt
-    tags:
-        - build
-        - docker
-        - linux
-        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
-
-.linux_builder_tags_cuda: &linux_builder_tags_cuda
-    tags:
-        - cuda-rt
-        - docker
-        - linux
-
-.macos_builder_tags: &macos_builder_tags
-    tags:
-        - cmake # Since this is a bare runner, pin to a project.
-        - macos
-        - shell
-        - xcode-11.5
-        - nonconcurrent
-
-.macos_builder_ext_tags: &macos_builder_ext_tags
-    tags:
-        - cmake # Since this is a bare runner, pin to a project.
-        - macos
-        - shell
-        - xcode-11.5
-        - concurrent
-
-.windows_builder_tags: &windows_builder_tags
-    tags:
-        - cmake # Since this is a bare runner, pin to a project.
-        - windows
-        - shell
-        - vs2019
-        - msvc-19.25
-        - nonconcurrent
-
-.windows_builder_ext_tags: &windows_builder_ext_tags
-    tags:
-        - cmake # Since this is a bare runner, pin to a project.
-        - windows
-        - shell
-        - vs2019
-        - msvc-19.25
-        - concurrent
-
-.before_script_unix: &before_script_unix
-    - .gitlab/ci/cmake.sh
-    - .gitlab/ci/ninja.sh
-    - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
-    - cmake --version
-    - ninja --version
-    # Download Qt on macOS
-    - "[ \"$( uname -s )\" = \"Darwin\" ] && cmake -P .gitlab/ci/download_qt.cmake"
-    - "[ \"$( uname -s )\" = \"Darwin\" ] && export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt"
-
-.before_script_windows: &before_script_windows
-    - Invoke-Expression -Command .gitlab/ci/cmake.ps1
-    - Invoke-Expression -Command .gitlab/ci/ninja.ps1
-    - $pwdpath = $pwd.Path
-    - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$pwdpath\.gitlab\cmake\bin;$env:PATH"
-    - cmake --version
-    - ninja --version
-    - cmake -P .gitlab/ci/download_qt.cmake
-    - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\qt\bin;$env:PATH"
-
-.cmake_build_unix: &cmake_build_unix
-    stage: build
-
-    script:
-        - *before_script_unix
-        - .gitlab/ci/sccache.sh
-        # Allow the server to already be running.
-        - "sccache --start-server || :"
-        - sccache --show-stats
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
-        - sccache --show-stats
-
-    interruptible: true
-
-.cmake_build_release_linux: &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
-        # Bootstrap
-        - cd build/
-        - "$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake"
-        # 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_windows: &cmake_build_windows
-    stage: build
-
-    script:
-        - *before_script_windows
-        - Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$env:SCCACHE_PATH"
-        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
-        - sccache --start-server
-        - sccache --show-stats
-        - ctest -VV -S .gitlab/ci/ctest_configure.cmake
-        - ctest -VV -S .gitlab/ci/ctest_build.cmake
-        - sccache --show-stats
-        - sccache --stop-server
-
-    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*/runcompilecommands.exe
-            - 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/valgrind.exe
-            - build/Tests/CMake*/PseudoMemcheck/purify.exe
-            - build/Tests/CMake*/PseudoMemcheck/memcheck_fail.exe
-            - build/Tests/CMake*/PseudoMemcheck/BC.exe
-            - build/Tests/CMake*/PseudoMemcheck/NoLog
-            - build/Tests/CMake*Lib/*LibTests
-            - build/Tests/CMake*Lib/*LibTests.exe
-            - build/Source/kwsys/cmsysTest*
-            - build/Source/kwsys/testConsoleBufChild.exe
-            - build/Utilities/cmcurl/curltest
-            - build/Utilities/cmcurl/curltest.exe
-            - build/Utilities/KWIML/test/kwiml_test
-            - build/Utilities/KWIML/test/kwiml_test.exe
-            - build/Source/kwsys/*cmsysTestDynload.*
-            - build/Source/kwsys/dynloaddir/cmsysTestDynloadImpl.dll
-            - build/Source/kwsys/dynloaddir/cmsysTestDynloadUse.dll
-
-            # 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_release_artifacts: &cmake_release_artifacts
-    artifacts:
-        expire_in: 5d
-        paths:
-            # Any packages made.
-            - build/cmake-*-Linux-x86_64.*
-
-.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
-
-    script:
-        - *before_script_unix
-        - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
-
-    interruptible: true
-
-.cmake_test_windows: &cmake_test_windows
-    stage: test
-
-    script:
-        - *before_script_windows
-        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
-        - ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake
-
-    interruptible: true
-
-.cmake_test_linux_package: &cmake_test_linux_package
-    stage: test-ext
-
-    script:
-        - *before_script_unix
-        # Make the CMake package available.
-        - mkdir -p build/install
-        - tar -C build/install --strip-components=1 -xzf build/cmake-*-Linux-x86_64.tar.gz
-        - .gitlab/ci/sccache.sh
-        # Allow the server to already be running.
-        - "sccache --start-server || :"
-        - sccache --show-stats
-        - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
-        - sccache --show-stats
-
-    interruptible: true
-
-.cmake_test_linux_external: &cmake_test_linux_external
-    stage: test-ext
-
-    script:
-        - *before_script_unix
-        - .gitlab/ci/sccache.sh
-        - sccache --start-server
-        - sccache --show-stats
-        - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
-        - sccache --show-stats
-
-    interruptible: true
-
-.cmake_test_macos_external: &cmake_test_macos_external
-    stage: test-ext
-
-    script:
-        - *before_script_unix
-        - .gitlab/ci/sccache.sh
-        # Allow the server to already be running.
-        - "sccache --start-server || :"
-        - sccache --show-stats
-        - "$LAUNCHER build/install/CMake.app/Contents/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
-        - sccache --show-stats
-
-    interruptible: true
-
-.cmake_test_windows_external: &cmake_test_windows_external
-    stage: test-ext
-
-    script:
-        - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
-
-    interruptible: true
+    # OS builds.
+    - local: .gitlab/os-unix.yml
+    - local: .gitlab/os-linux.yml
+    - local: .gitlab/os-macos.yml
+    - local: .gitlab/os-windows.yml
 
 stages:
     - build
     - test
     - test-ext
 
+# Lint builds
+
 build:debian10-iwyu:
     <<:
         - *debian10_iwyu
@@ -488,6 +37,8 @@ build:fedora31-sphinx:
         - *linux_builder_tags_qt
     rules: *rules_settings
 
+# Linux builds
+
 build:centos6-release:
     <<:
         - *release_linux
@@ -549,6 +100,8 @@ test:fedora31-ninja-multi:
     needs:
         - test:fedora31-ninja
 
+# macOS builds
+
 build:macos-ninja:
     <<:
         - *macos_ninja
@@ -599,6 +152,8 @@ test:macos-xcode:
     needs:
         - test:macos-ninja
 
+# Windows builds
+
 build:windows-vs2019-x64-ninja:
     <<:
         - *windows_vs2019_x64_ninja
diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml
new file mode 100644
index 0000000..b25e4ff
--- /dev/null
+++ b/.gitlab/artifacts.yml
@@ -0,0 +1,79 @@
+# Lists of paths for artifacts of various stages.
+
+.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*/runcompilecommands.exe
+            - 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/valgrind.exe
+            - build/Tests/CMake*/PseudoMemcheck/purify.exe
+            - build/Tests/CMake*/PseudoMemcheck/memcheck_fail.exe
+            - build/Tests/CMake*/PseudoMemcheck/BC.exe
+            - build/Tests/CMake*/PseudoMemcheck/NoLog
+            - build/Tests/CMake*Lib/*LibTests
+            - build/Tests/CMake*Lib/*LibTests.exe
+            - build/Source/kwsys/cmsysTest*
+            - build/Source/kwsys/testConsoleBufChild.exe
+            - build/Utilities/cmcurl/curltest
+            - build/Utilities/cmcurl/curltest.exe
+            - build/Utilities/KWIML/test/kwiml_test
+            - build/Utilities/KWIML/test/kwiml_test.exe
+            - build/Source/kwsys/*cmsysTestDynload.*
+            - build/Source/kwsys/dynloaddir/cmsysTestDynloadImpl.dll
+            - build/Source/kwsys/dynloaddir/cmsysTestDynloadUse.dll
+
+            # 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_release_artifacts: &cmake_release_artifacts
+    artifacts:
+        expire_in: 5d
+        paths:
+            # Any packages made.
+            - build/cmake-*-Linux-x86_64.*
+
+.cmake_test_artifacts: &cmake_test_artifacts
+    artifacts:
+        expire_in: 1d
+        paths:
+            # Take the install tree.
+            - build/install/
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
new file mode 100644
index 0000000..7f7e506
--- /dev/null
+++ b/.gitlab/os-linux.yml
@@ -0,0 +1,180 @@
+# Linux-specific builder configurations and build commands
+
+## Base images
+
+### Release
+
+.release_linux: &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 --"
+
+### Debian
+
+.debian10: &debian10
+    image: "kitware/cmake:ci-debian10-x86_64-2020-04-27"
+
+    variables:
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+
+.debian10_iwyu: &debian10_iwyu
+    extends: .debian10
+
+    variables:
+        CMAKE_CONFIGURATION: debian10_iwyu
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMake_SKIP_INSTALL: 1
+
+### Fedora
+
+.fedora31: &fedora31
+    image: "kitware/cmake:ci-fedora31-x86_64-2020-06-01"
+
+    variables:
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+
+#### Lint builds
+
+.fedora31_tidy: &fedora31_tidy
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_tidy
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMake_SKIP_INSTALL: 1
+
+.fedora31_sphinx: &fedora31_sphinx
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_sphinx
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
+        CMake_SKIP_INSTALL: 1
+
+#### Build and test
+
+.fedora31_ninja: &fedora31_ninja
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_ninja
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
+.fedora31_ninja_multi: &fedora31_ninja_multi
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_ninja_multi
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMAKE_GENERATOR: "Ninja Multi-Config"
+
+.fedora31_makefiles: &fedora31_makefiles
+    extends: .fedora31
+
+    variables:
+        CMAKE_CONFIGURATION: fedora31_makefiles
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMAKE_GENERATOR: "Unix Makefiles"
+
+### CUDA builds
+
+.cuda10.2: &cuda
+    image: "kitware/cmake:ci-cuda10.2-x86_64-2020-06-11"
+
+    variables:
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+        CTEST_LABELS: "CUDA"
+
+.cuda10.2_nvidia: &cuda10_2_nvidia
+    extends: .cuda10.2
+
+    variables:
+        CMAKE_CONFIGURATION: cuda10.2_nvidia
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
+## Tags
+
+.linux_builder_tags: &linux_builder_tags
+    tags:
+        - build
+        - docker
+        - linux
+
+.linux_builder_tags_qt: &linux_builder_tags_qt
+    tags:
+        - build
+        - docker
+        - linux
+        - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+
+.linux_builder_tags_cuda: &linux_builder_tags_cuda
+    tags:
+        - cuda-rt
+        - docker
+        - linux
+
+## Linux-specific scripts
+
+.cmake_build_release_linux: &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
+        # Bootstrap
+        - cd build/
+        - "$LAUNCHER ../bootstrap --parallel=$(nproc) --docdir=doc/cmake"
+        # 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_test_linux_package: &cmake_test_linux_package
+    stage: test-ext
+
+    script:
+        - *before_script_unix
+        # Make the CMake package available.
+        - mkdir -p build/install
+        - tar -C build/install --strip-components=1 -xzf build/cmake-*-Linux-x86_64.tar.gz
+        - .gitlab/ci/sccache.sh
+        - sccache --start-server
+        - sccache --show-stats
+        - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
+        - sccache --show-stats
+
+    interruptible: true
+
+.cmake_test_linux_external: &cmake_test_linux_external
+    stage: test-ext
+
+    script:
+        - *before_script_unix
+        - .gitlab/ci/sccache.sh
+        - sccache --start-server
+        - sccache --show-stats
+        - "$LAUNCHER build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
+        - sccache --show-stats
+
+    interruptible: true
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
new file mode 100644
index 0000000..b36de98
--- /dev/null
+++ b/.gitlab/os-macos.yml
@@ -0,0 +1,81 @@
+# macOS-specific builder configurations and build commands
+
+## Base configurations
+
+.macos: &macos
+    variables:
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
+        # TODO: Factor this out so that each job selects the Xcode version to
+        # use so that different versions can be tested in a single pipeline.
+        DEVELOPER_DIR: "/Applications/Xcode-11.5.app/Contents/Developer"
+
+### Build and test
+
+.macos_build: &macos_build
+    extends: .macos
+
+    variables:
+        # Note that shell runners only support runners with a single
+        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
+        # change between the build and test stages which CMake doesn't support.
+        # Even if we could, it could change if other runners on the machine
+        # could run at the same time, so we drop it.
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+
+.macos_ninja: &macos_ninja
+    extends: .macos_build
+
+    variables:
+        CMAKE_CONFIGURATION: macos_ninja
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
+.macos_makefiles: &macos_makefiles
+    extends: .macos_build
+
+    variables:
+        CMAKE_CONFIGURATION: macos_makefiles
+        CTEST_NO_WARNINGS_ALLOWED: 1
+        CMAKE_GENERATOR: "Unix Makefiles"
+
+### External testing
+
+.macos_xcode: &macos_xcode
+    extends: .macos
+
+    variables:
+        CMAKE_CONFIGURATION: macos_xcode
+        CMAKE_GENERATOR: Xcode
+
+## Tags
+
+.macos_builder_tags: &macos_builder_tags
+    tags:
+        - cmake # Since this is a bare runner, pin to a project.
+        - macos
+        - shell
+        - xcode-11.5
+        - nonconcurrent
+
+.macos_builder_ext_tags: &macos_builder_ext_tags
+    tags:
+        - cmake # Since this is a bare runner, pin to a project.
+        - macos
+        - shell
+        - xcode-11.5
+        - concurrent
+
+## macOS-specific scripts
+
+.cmake_test_macos_external: &cmake_test_macos_external
+    stage: test-ext
+
+    script:
+        - *before_script_unix
+        - .gitlab/ci/sccache.sh
+        # Allow the server to already be running.
+        - "sccache --start-server || :"
+        - sccache --show-stats
+        - "$LAUNCHER build/install/CMake.app/Contents/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake"
+        - sccache --show-stats
+
+    interruptible: true
diff --git a/.gitlab/os-unix.yml b/.gitlab/os-unix.yml
new file mode 100644
index 0000000..902c428
--- /dev/null
+++ b/.gitlab/os-unix.yml
@@ -0,0 +1,35 @@
+# Unix-specific build commands
+
+.before_script_unix: &before_script_unix
+    - .gitlab/ci/cmake.sh
+    - .gitlab/ci/ninja.sh
+    - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
+    - cmake --version
+    - ninja --version
+    # Download Qt on macOS
+    - "[ \"$( uname -s )\" = \"Darwin\" ] && cmake -P .gitlab/ci/download_qt.cmake"
+    - "[ \"$( uname -s )\" = \"Darwin\" ] && export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt"
+
+.cmake_build_unix: &cmake_build_unix
+    stage: build
+
+    script:
+        - *before_script_unix
+        - .gitlab/ci/sccache.sh
+        # Allow the server to already be running.
+        - "sccache --start-server || :"
+        - sccache --show-stats
+        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
+        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
+        - sccache --show-stats
+
+    interruptible: true
+
+.cmake_test_unix: &cmake_test_unix
+    stage: test
+
+    script:
+        - *before_script_unix
+        - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
+
+    interruptible: true
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
new file mode 100644
index 0000000..90d4685
--- /dev/null
+++ b/.gitlab/os-windows.yml
@@ -0,0 +1,116 @@
+# Windows-specific builder configurations and build commands
+
+## Base configurations
+
+.windows: &windows
+    variables:
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci ext\\$CI_CONCURRENT_ID"
+
+### Build and test
+
+.windows_build: &windows_build
+    extends: .windows
+
+    variables:
+        # Note that shell runners only support runners with a single
+        # concurrency level. We can't use `$CI_CONCURRENCY_ID` because this may
+        # change between the build and test stages which CMake doesn't support.
+        # Even if we could, it could change if other runners on the machine
+        # could run at the same time, so we drop it.
+        GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci"
+
+.windows_ninja: &windows_ninja
+    extends: .windows_build
+
+    variables:
+        # Debug and RelWithDebinfo build types use the `/Zi` which results in
+        # uncacheable compiations.
+        # https://github.com/mozilla/sccache/issues/242
+        CMAKE_BUILD_TYPE: Release
+        CTEST_NO_WARNINGS_ALLOWED: 1
+
+.windows_vs2019_x64_ninja: &windows_vs2019_x64_ninja
+    extends: .windows_ninja
+
+    variables:
+        CMAKE_CONFIGURATION: windows_vs2019_x64_ninja
+        VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
+        VCVARSPLATFORM: "x64"
+        VCVARSVERSION: "14.26"
+
+### External testing
+
+.windows_vs2019_x64: &windows_vs2019_x64
+    extends: .windows
+
+    variables:
+        CMAKE_CONFIGURATION: windows_vs2019_x64
+        CMAKE_GENERATOR: "Visual Studio 16 2019"
+        CMAKE_GENERATOR_PLATFORM: "x64"
+        CMAKE_GENERATOR_TOOLSET: "v142,version=14.26"
+
+## Tags
+
+.windows_builder_tags: &windows_builder_tags
+    tags:
+        - cmake # Since this is a bare runner, pin to a project.
+        - windows
+        - shell
+        - vs2019
+        - msvc-19.25
+        - nonconcurrent
+
+.windows_builder_ext_tags: &windows_builder_ext_tags
+    tags:
+        - cmake # Since this is a bare runner, pin to a project.
+        - windows
+        - shell
+        - vs2019
+        - msvc-19.25
+        - concurrent
+
+## Windows-specific scripts
+
+.before_script_windows: &before_script_windows
+    - Invoke-Expression -Command .gitlab/ci/cmake.ps1
+    - Invoke-Expression -Command .gitlab/ci/ninja.ps1
+    - $pwdpath = $pwd.Path
+    - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$pwdpath\.gitlab\cmake\bin;$env:PATH"
+    - cmake --version
+    - ninja --version
+    - cmake -P .gitlab/ci/download_qt.cmake
+    - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\qt\bin;$env:PATH"
+
+.cmake_build_windows: &cmake_build_windows
+    stage: build
+
+    script:
+        - *before_script_windows
+        - Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$env:SCCACHE_PATH"
+        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+        - sccache --start-server
+        - sccache --show-stats
+        - ctest -VV -S .gitlab/ci/ctest_configure.cmake
+        - ctest -VV -S .gitlab/ci/ctest_build.cmake
+        - sccache --show-stats
+        - sccache --stop-server
+
+    interruptible: true
+
+.cmake_test_windows: &cmake_test_windows
+    stage: test
+
+    script:
+        - *before_script_windows
+        - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+        - ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake
+
+    interruptible: true
+
+.cmake_test_windows_external: &cmake_test_windows_external
+    stage: test-ext
+
+    script:
+        - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
+
+    interruptible: true
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
new file mode 100644
index 0000000..6911e5e
--- /dev/null
+++ b/.gitlab/rules.yml
@@ -0,0 +1,16 @@
+# Rules for where jobs can run
+
+.manual_rules_settings: &manual_rules_settings
+    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
+      when: delayed
+      start_in: 5 minutes
+    - if: '$CI_MERGE_REQUEST_ID'
+      when: manual
+    - when: never
+
+.rules_settings: &rules_settings
+    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
+      when: always
+    - if: '$CI_MERGE_REQUEST_ID'
+      when: always
+    - when: never
-- 
cgit v0.12


From 2b4523c5f2f6864eb36fa0eeda22069e0a109dbf Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 12 Jun 2020 11:03:51 -0400
Subject: gitlab-ci: make rules a bit more uniform

---
 .gitlab-ci.yml    | 34 +++++++++++++++++-----------------
 .gitlab/rules.yml | 28 +++++++++++++++-------------
 2 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3fa3f55..22d3578 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,21 +21,21 @@ build:debian10-iwyu:
         - *debian10_iwyu
         - *cmake_build_unix
         - *linux_builder_tags
-    rules: *rules_settings
+        - *run_automatically
 
 build:fedora31-tidy:
     <<:
         - *fedora31_tidy
         - *cmake_build_unix
         - *linux_builder_tags_qt
-    rules: *rules_settings
+        - *run_automatically
 
 build:fedora31-sphinx:
     <<:
         - *fedora31_sphinx
         - *cmake_build_unix
         - *linux_builder_tags_qt
-    rules: *rules_settings
+        - *run_automatically
 
 # Linux builds
 
@@ -45,14 +45,14 @@ build:centos6-release:
         - *cmake_build_release_linux
         - *cmake_release_artifacts
         - *linux_builder_tags
-    rules: *manual_rules_settings
+        - *run_manually
 
 test:fedora31-makefiles:
     <<:
         - *fedora31_makefiles
         - *cmake_test_linux_package
         - *linux_builder_tags_qt
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - build:centos6-release
     needs:
@@ -63,7 +63,7 @@ test:cuda10.2-nvidia:
         - *cuda10_2_nvidia
         - *cmake_test_linux_package
         - *linux_builder_tags_cuda
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - build:centos6-release
     needs:
@@ -75,7 +75,7 @@ build:fedora31-ninja:
         - *cmake_build_unix
         - *cmake_build_artifacts
         - *linux_builder_tags_qt
-    rules: *manual_rules_settings
+        - *run_manually
 
 test:fedora31-ninja:
     <<:
@@ -83,7 +83,7 @@ test:fedora31-ninja:
         - *cmake_test_unix
         - *linux_builder_tags_qt
         - *cmake_test_artifacts
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - build:fedora31-ninja
     needs:
@@ -94,7 +94,7 @@ test:fedora31-ninja-multi:
         - *fedora31_ninja_multi
         - *cmake_test_linux_external
         - *linux_builder_tags_qt
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - test:fedora31-ninja
     needs:
@@ -108,7 +108,7 @@ build:macos-ninja:
         - *cmake_build_unix
         - *cmake_build_artifacts
         - *macos_builder_tags
-    rules: *manual_rules_settings
+        - *run_manually
 
 test:macos-ninja:
     <<:
@@ -116,7 +116,7 @@ test:macos-ninja:
         - *cmake_test_unix
         - *cmake_test_artifacts
         - *macos_builder_tags
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - build:macos-ninja
     needs:
@@ -128,14 +128,14 @@ build:macos-makefiles:
         - *cmake_build_unix
         - *cmake_build_artifacts
         - *macos_builder_tags
-    rules: *manual_rules_settings
+        - *run_manually
 
 test:macos-makefiles:
     <<:
         - *macos_makefiles
         - *cmake_test_unix
         - *macos_builder_tags
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - build:macos-makefiles
     needs:
@@ -146,7 +146,7 @@ test:macos-xcode:
         - *macos_xcode
         - *cmake_test_macos_external
         - *macos_builder_ext_tags
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - test:macos-ninja
     needs:
@@ -160,7 +160,7 @@ build:windows-vs2019-x64-ninja:
         - *cmake_build_windows
         - *cmake_build_artifacts
         - *windows_builder_tags
-    rules: *manual_rules_settings
+        - *run_manually
 
 test:windows-vs2019-x64-ninja:
     <<:
@@ -168,7 +168,7 @@ test:windows-vs2019-x64-ninja:
         - *cmake_test_windows
         - *windows_builder_tags
         - *cmake_test_artifacts
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - build:windows-vs2019-x64-ninja
     needs:
@@ -179,7 +179,7 @@ test:windows-vs2019-x64:
         - *windows_vs2019_x64
         - *cmake_test_windows_external
         - *windows_builder_ext_tags
-    rules: *rules_settings
+        - *run_automatically
     dependencies:
         - test:windows-vs2019-x64-ninja
     needs:
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index 6911e5e..3dc06f7 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -1,16 +1,18 @@
 # Rules for where jobs can run
 
-.manual_rules_settings: &manual_rules_settings
-    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
-      when: delayed
-      start_in: 5 minutes
-    - if: '$CI_MERGE_REQUEST_ID'
-      when: manual
-    - when: never
+.run_manually: &run_manually
+    rules:
+        - if: '$CI_PROJECT_PATH == "cmake/cmake"'
+          when: delayed
+          start_in: 5 minutes
+        - if: '$CI_MERGE_REQUEST_ID'
+          when: manual
+        - when: never
 
-.rules_settings: &rules_settings
-    - if: '$CI_PROJECT_PATH == "cmake/cmake"'
-      when: always
-    - if: '$CI_MERGE_REQUEST_ID'
-      when: always
-    - when: never
+.run_automatically: &run_automatically
+    rules:
+        - if: '$CI_PROJECT_PATH == "cmake/cmake"'
+          when: always
+        - if: '$CI_MERGE_REQUEST_ID'
+          when: always
+        - when: never
-- 
cgit v0.12


From fda8b79f880877a9f07839dcabc9cd7854685e92 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 12 Jun 2020 11:04:06 -0400
Subject: gitlab-ci: add a comment describing what goes into a job

---
 .gitlab-ci.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 22d3578..81f3c35 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,6 +14,22 @@ stages:
     - test
     - test-ext
 
+################################################################################
+# Job declarations
+#
+# Each job must pull in each of the following keys:
+#
+#   - a "base image"
+#   - a build script
+#   - tags for the jobs
+#   - rules for when to run the job
+#
+# Additionally, jobs may also contain:
+#
+#   - artifacts
+#   - dependency/needs jobs for required jobs
+################################################################################
+
 # Lint builds
 
 build:debian10-iwyu:
-- 
cgit v0.12


From a1fe6ad62129c14e9dcae5c61d40bea55c81a497 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 12 Jun 2020 12:50:12 -0400
Subject: gitlab-ci: use `extends`

YAML anchors are not supported across include files.
---
 .gitlab-ci.yml         | 186 ++++++++++++++++++++++++-------------------------
 .gitlab/artifacts.yml  |   6 +-
 .gitlab/os-linux.yml   |  34 ++++-----
 .gitlab/os-macos.yml   |  16 ++---
 .gitlab/os-unix.yml    |   4 +-
 .gitlab/os-windows.yml |  20 +++---
 .gitlab/rules.yml      |   4 +-
 7 files changed, 135 insertions(+), 135 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 81f3c35..f98f884 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,84 +33,84 @@ stages:
 # Lint builds
 
 build:debian10-iwyu:
-    <<:
-        - *debian10_iwyu
-        - *cmake_build_unix
-        - *linux_builder_tags
-        - *run_automatically
+    extends:
+        - .debian10_iwyu
+        - .cmake_build_unix
+        - .linux_builder_tags
+        - .run_automatically
 
 build:fedora31-tidy:
-    <<:
-        - *fedora31_tidy
-        - *cmake_build_unix
-        - *linux_builder_tags_qt
-        - *run_automatically
+    extends:
+        - .fedora31_tidy
+        - .cmake_build_unix
+        - .linux_builder_tags_qt
+        - .run_automatically
 
 build:fedora31-sphinx:
-    <<:
-        - *fedora31_sphinx
-        - *cmake_build_unix
-        - *linux_builder_tags_qt
-        - *run_automatically
+    extends:
+        - .fedora31_sphinx
+        - .cmake_build_unix
+        - .linux_builder_tags_qt
+        - .run_automatically
 
 # Linux builds
 
 build:centos6-release:
-    <<:
-        - *release_linux
-        - *cmake_build_release_linux
-        - *cmake_release_artifacts
-        - *linux_builder_tags
-        - *run_manually
+    extends:
+        - .release_linux
+        - .cmake_build_release_linux
+        - .cmake_release_artifacts
+        - .linux_builder_tags
+        - .run_manually
 
 test:fedora31-makefiles:
-    <<:
-        - *fedora31_makefiles
-        - *cmake_test_linux_package
-        - *linux_builder_tags_qt
-        - *run_automatically
+    extends:
+        - .fedora31_makefiles
+        - .cmake_test_linux_package
+        - .linux_builder_tags_qt
+        - .run_automatically
     dependencies:
         - build:centos6-release
     needs:
         - build:centos6-release
 
 test:cuda10.2-nvidia:
-    <<:
-        - *cuda10_2_nvidia
-        - *cmake_test_linux_package
-        - *linux_builder_tags_cuda
-        - *run_automatically
+    extends:
+        - .cuda10.2_nvidia
+        - .cmake_test_linux_package
+        - .linux_builder_tags_cuda
+        - .run_automatically
     dependencies:
         - build:centos6-release
     needs:
         - build:centos6-release
 
 build:fedora31-ninja:
-    <<:
-        - *fedora31_ninja
-        - *cmake_build_unix
-        - *cmake_build_artifacts
-        - *linux_builder_tags_qt
-        - *run_manually
+    extends:
+        - .fedora31_ninja
+        - .cmake_build_unix
+        - .cmake_build_artifacts
+        - .linux_builder_tags_qt
+        - .run_manually
 
 test:fedora31-ninja:
-    <<:
-        - *fedora31_ninja
-        - *cmake_test_unix
-        - *linux_builder_tags_qt
-        - *cmake_test_artifacts
-        - *run_automatically
+    extends:
+        - .fedora31_ninja
+        - .cmake_test_unix
+        - .linux_builder_tags_qt
+        - .cmake_test_artifacts
+        - .run_automatically
     dependencies:
         - build:fedora31-ninja
     needs:
         - build:fedora31-ninja
 
 test:fedora31-ninja-multi:
-    <<:
-        - *fedora31_ninja_multi
-        - *cmake_test_linux_external
-        - *linux_builder_tags_qt
-        - *run_automatically
+    extends:
+        - .fedora31_ninja_multi
+        - .cmake_test_linux_external
+        - .linux_builder_tags_qt
+        - .run_automatically
     dependencies:
         - test:fedora31-ninja
     needs:
@@ -119,50 +119,50 @@ test:fedora31-ninja-multi:
 # macOS builds
 
 build:macos-ninja:
-    <<:
-        - *macos_ninja
-        - *cmake_build_unix
-        - *cmake_build_artifacts
-        - *macos_builder_tags
-        - *run_manually
+    extends:
+        - .macos_ninja
+        - .cmake_build_unix
+        - .cmake_build_artifacts
+        - .macos_builder_tags
+        - .run_manually
 
 test:macos-ninja:
-    <<:
-        - *macos_ninja
-        - *cmake_test_unix
-        - *cmake_test_artifacts
-        - *macos_builder_tags
-        - *run_automatically
+    extends:
+        - .macos_ninja
+        - .cmake_test_unix
+        - .cmake_test_artifacts
+        - .macos_builder_tags
+        - .run_automatically
     dependencies:
         - build:macos-ninja
     needs:
         - build:macos-ninja
 
 build:macos-makefiles:
-    <<:
-        - *macos_makefiles
-        - *cmake_build_unix
-        - *cmake_build_artifacts
-        - *macos_builder_tags
-        - *run_manually
+    extends:
+        - .macos_makefiles
+        - .cmake_build_unix
+        - .cmake_build_artifacts
+        - .macos_builder_tags
+        - .run_manually
 
 test:macos-makefiles:
-    <<:
-        - *macos_makefiles
-        - *cmake_test_unix
-        - *macos_builder_tags
-        - *run_automatically
+    extends:
+        - .macos_makefiles
+        - .cmake_test_unix
+        - .macos_builder_tags
+        - .run_automatically
     dependencies:
         - build:macos-makefiles
     needs:
         - build:macos-makefiles
 
 test:macos-xcode:
-    <<:
-        - *macos_xcode
-        - *cmake_test_macos_external
-        - *macos_builder_ext_tags
-        - *run_automatically
+    extends:
+        - .macos_xcode
+        - .cmake_test_macos_external
+        - .macos_builder_ext_tags
+        - .run_automatically
     dependencies:
         - test:macos-ninja
     needs:
@@ -171,31 +171,31 @@ test:macos-xcode:
 # Windows builds
 
 build:windows-vs2019-x64-ninja:
-    <<:
-        - *windows_vs2019_x64_ninja
-        - *cmake_build_windows
-        - *cmake_build_artifacts
-        - *windows_builder_tags
-        - *run_manually
+    extends:
+        - .windows_vs2019_x64_ninja
+        - .cmake_build_windows
+        - .cmake_build_artifacts
+        - .windows_builder_tags
+        - .run_manually
 
 test:windows-vs2019-x64-ninja:
-    <<:
-        - *windows_vs2019_x64_ninja
-        - *cmake_test_windows
-        - *windows_builder_tags
-        - *cmake_test_artifacts
-        - *run_automatically
+    extends:
+        - .windows_vs2019_x64_ninja
+        - .cmake_test_windows
+        - .windows_builder_tags
+        - .cmake_test_artifacts
+        - .run_automatically
     dependencies:
         - build:windows-vs2019-x64-ninja
     needs:
         - build:windows-vs2019-x64-ninja
 
 test:windows-vs2019-x64:
-    <<:
-        - *windows_vs2019_x64
-        - *cmake_test_windows_external
-        - *windows_builder_ext_tags
-        - *run_automatically
+    extends:
+        - .windows_vs2019_x64
+        - .cmake_test_windows_external
+        - .windows_builder_ext_tags
+        - .run_automatically
     dependencies:
         - test:windows-vs2019-x64-ninja
     needs:
diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml
index b25e4ff..c2d28da 100644
--- a/.gitlab/artifacts.yml
+++ b/.gitlab/artifacts.yml
@@ -1,6 +1,6 @@
 # Lists of paths for artifacts of various stages.
 
-.cmake_build_artifacts: &cmake_build_artifacts
+.cmake_build_artifacts:
     artifacts:
         expire_in: 1d
         paths:
@@ -64,14 +64,14 @@
             - build/DartConfiguation.tcl
             - build/CTestCustom.cmake
 
-.cmake_release_artifacts: &cmake_release_artifacts
+.cmake_release_artifacts:
     artifacts:
         expire_in: 5d
         paths:
             # Any packages made.
             - build/cmake-*-Linux-x86_64.*
 
-.cmake_test_artifacts: &cmake_test_artifacts
+.cmake_test_artifacts:
     artifacts:
         expire_in: 1d
         paths:
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index 7f7e506..7caf507 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -4,7 +4,7 @@
 
 ### Release
 
-.release_linux: &release_linux
+.release_linux:
     image: "kitware/cmake:build-linux-x86_64-deps-2020-04-02@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157"
 
     variables:
@@ -13,13 +13,13 @@
 
 ### Debian
 
-.debian10: &debian10
+.debian10:
     image: "kitware/cmake:ci-debian10-x86_64-2020-04-27"
 
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
 
-.debian10_iwyu: &debian10_iwyu
+.debian10_iwyu:
     extends: .debian10
 
     variables:
@@ -29,7 +29,7 @@
 
 ### Fedora
 
-.fedora31: &fedora31
+.fedora31:
     image: "kitware/cmake:ci-fedora31-x86_64-2020-06-01"
 
     variables:
@@ -37,7 +37,7 @@
 
 #### Lint builds
 
-.fedora31_tidy: &fedora31_tidy
+.fedora31_tidy:
     extends: .fedora31
 
     variables:
@@ -45,7 +45,7 @@
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMake_SKIP_INSTALL: 1
 
-.fedora31_sphinx: &fedora31_sphinx
+.fedora31_sphinx:
     extends: .fedora31
 
     variables:
@@ -56,14 +56,14 @@
 
 #### Build and test
 
-.fedora31_ninja: &fedora31_ninja
+.fedora31_ninja:
     extends: .fedora31
 
     variables:
         CMAKE_CONFIGURATION: fedora31_ninja
         CTEST_NO_WARNINGS_ALLOWED: 1
 
-.fedora31_ninja_multi: &fedora31_ninja_multi
+.fedora31_ninja_multi:
     extends: .fedora31
 
     variables:
@@ -71,7 +71,7 @@
         CTEST_NO_WARNINGS_ALLOWED: 1
         CMAKE_GENERATOR: "Ninja Multi-Config"
 
-.fedora31_makefiles: &fedora31_makefiles
+.fedora31_makefiles:
     extends: .fedora31
 
     variables:
@@ -81,14 +81,14 @@
 
 ### CUDA builds
 
-.cuda10.2: &cuda
+.cuda10.2:
     image: "kitware/cmake:ci-cuda10.2-x86_64-2020-06-11"
 
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
         CTEST_LABELS: "CUDA"
 
-.cuda10.2_nvidia: &cuda10_2_nvidia
+.cuda10.2_nvidia:
     extends: .cuda10.2
 
     variables:
@@ -97,20 +97,20 @@
 
 ## Tags
 
-.linux_builder_tags: &linux_builder_tags
+.linux_builder_tags:
     tags:
         - build
         - docker
         - linux
 
-.linux_builder_tags_qt: &linux_builder_tags_qt
+.linux_builder_tags_qt:
     tags:
         - build
         - docker
         - linux
         - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
 
-.linux_builder_tags_cuda: &linux_builder_tags_cuda
+.linux_builder_tags_cuda:
     tags:
         - cuda-rt
         - docker
@@ -118,7 +118,7 @@
 
 ## Linux-specific scripts
 
-.cmake_build_release_linux: &cmake_build_release_linux
+.cmake_build_release_linux:
     stage: build
 
     script:
@@ -150,7 +150,7 @@
 
     interruptible: true
 
-.cmake_test_linux_package: &cmake_test_linux_package
+.cmake_test_linux_package:
     stage: test-ext
 
     script:
@@ -166,7 +166,7 @@
 
     interruptible: true
 
-.cmake_test_linux_external: &cmake_test_linux_external
+.cmake_test_linux_external:
     stage: test-ext
 
     script:
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index b36de98..69b1a07 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -2,7 +2,7 @@
 
 ## Base configurations
 
-.macos: &macos
+.macos:
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
         # TODO: Factor this out so that each job selects the Xcode version to
@@ -11,7 +11,7 @@
 
 ### Build and test
 
-.macos_build: &macos_build
+.macos_build:
     extends: .macos
 
     variables:
@@ -22,14 +22,14 @@
         # could run at the same time, so we drop it.
         GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
 
-.macos_ninja: &macos_ninja
+.macos_ninja:
     extends: .macos_build
 
     variables:
         CMAKE_CONFIGURATION: macos_ninja
         CTEST_NO_WARNINGS_ALLOWED: 1
 
-.macos_makefiles: &macos_makefiles
+.macos_makefiles:
     extends: .macos_build
 
     variables:
@@ -39,7 +39,7 @@
 
 ### External testing
 
-.macos_xcode: &macos_xcode
+.macos_xcode:
     extends: .macos
 
     variables:
@@ -48,7 +48,7 @@
 
 ## Tags
 
-.macos_builder_tags: &macos_builder_tags
+.macos_builder_tags:
     tags:
         - cmake # Since this is a bare runner, pin to a project.
         - macos
@@ -56,7 +56,7 @@
         - xcode-11.5
         - nonconcurrent
 
-.macos_builder_ext_tags: &macos_builder_ext_tags
+.macos_builder_ext_tags:
     tags:
         - cmake # Since this is a bare runner, pin to a project.
         - macos
@@ -66,7 +66,7 @@
 
 ## macOS-specific scripts
 
-.cmake_test_macos_external: &cmake_test_macos_external
+.cmake_test_macos_external:
     stage: test-ext
 
     script:
diff --git a/.gitlab/os-unix.yml b/.gitlab/os-unix.yml
index 902c428..c1f6bb7 100644
--- a/.gitlab/os-unix.yml
+++ b/.gitlab/os-unix.yml
@@ -10,7 +10,7 @@
     - "[ \"$( uname -s )\" = \"Darwin\" ] && cmake -P .gitlab/ci/download_qt.cmake"
     - "[ \"$( uname -s )\" = \"Darwin\" ] && export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt"
 
-.cmake_build_unix: &cmake_build_unix
+.cmake_build_unix:
     stage: build
 
     script:
@@ -25,7 +25,7 @@
 
     interruptible: true
 
-.cmake_test_unix: &cmake_test_unix
+.cmake_test_unix:
     stage: test
 
     script:
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index 90d4685..910a232 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -2,13 +2,13 @@
 
 ## Base configurations
 
-.windows: &windows
+.windows:
     variables:
         GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci ext\\$CI_CONCURRENT_ID"
 
 ### Build and test
 
-.windows_build: &windows_build
+.windows_build:
     extends: .windows
 
     variables:
@@ -19,7 +19,7 @@
         # could run at the same time, so we drop it.
         GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci"
 
-.windows_ninja: &windows_ninja
+.windows_ninja:
     extends: .windows_build
 
     variables:
@@ -29,7 +29,7 @@
         CMAKE_BUILD_TYPE: Release
         CTEST_NO_WARNINGS_ALLOWED: 1
 
-.windows_vs2019_x64_ninja: &windows_vs2019_x64_ninja
+.windows_vs2019_x64_ninja:
     extends: .windows_ninja
 
     variables:
@@ -40,7 +40,7 @@
 
 ### External testing
 
-.windows_vs2019_x64: &windows_vs2019_x64
+.windows_vs2019_x64:
     extends: .windows
 
     variables:
@@ -51,7 +51,7 @@
 
 ## Tags
 
-.windows_builder_tags: &windows_builder_tags
+.windows_builder_tags:
     tags:
         - cmake # Since this is a bare runner, pin to a project.
         - windows
@@ -60,7 +60,7 @@
         - msvc-19.25
         - nonconcurrent
 
-.windows_builder_ext_tags: &windows_builder_ext_tags
+.windows_builder_ext_tags:
     tags:
         - cmake # Since this is a bare runner, pin to a project.
         - windows
@@ -81,7 +81,7 @@
     - cmake -P .gitlab/ci/download_qt.cmake
     - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\qt\bin;$env:PATH"
 
-.cmake_build_windows: &cmake_build_windows
+.cmake_build_windows:
     stage: build
 
     script:
@@ -97,7 +97,7 @@
 
     interruptible: true
 
-.cmake_test_windows: &cmake_test_windows
+.cmake_test_windows:
     stage: test
 
     script:
@@ -107,7 +107,7 @@
 
     interruptible: true
 
-.cmake_test_windows_external: &cmake_test_windows_external
+.cmake_test_windows_external:
     stage: test-ext
 
     script:
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index 3dc06f7..96b95c8 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -1,6 +1,6 @@
 # Rules for where jobs can run
 
-.run_manually: &run_manually
+.run_manually:
     rules:
         - if: '$CI_PROJECT_PATH == "cmake/cmake"'
           when: delayed
@@ -9,7 +9,7 @@
           when: manual
         - when: never
 
-.run_automatically: &run_automatically
+.run_automatically:
     rules:
         - if: '$CI_PROJECT_PATH == "cmake/cmake"'
           when: always
-- 
cgit v0.12


From 6d168c41e3bac2c6445977e957772772429d6fb1 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Fri, 12 Jun 2020 12:54:06 -0400
Subject: gitlab-ci: split linux and macos shared before scripts

They're not actually the same anyways and the anchors can't be shared
between the files. We can figure out refactoring in the future.
---
 .gitlab-ci.yml       | 19 +++++++++----------
 .gitlab/os-linux.yml | 34 ++++++++++++++++++++++++++++++++--
 .gitlab/os-macos.yml | 36 +++++++++++++++++++++++++++++++++++-
 .gitlab/os-unix.yml  | 35 -----------------------------------
 4 files changed, 76 insertions(+), 48 deletions(-)
 delete mode 100644 .gitlab/os-unix.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f98f884..ec2393b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,6 @@ include:
     - local: .gitlab/artifacts.yml
 
     # OS builds.
-    - local: .gitlab/os-unix.yml
     - local: .gitlab/os-linux.yml
     - local: .gitlab/os-macos.yml
     - local: .gitlab/os-windows.yml
@@ -35,21 +34,21 @@ stages:
 build:debian10-iwyu:
     extends:
         - .debian10_iwyu
-        - .cmake_build_unix
+        - .cmake_build_linux
         - .linux_builder_tags
         - .run_automatically
 
 build:fedora31-tidy:
     extends:
         - .fedora31_tidy
-        - .cmake_build_unix
+        - .cmake_build_linux
         - .linux_builder_tags_qt
         - .run_automatically
 
 build:fedora31-sphinx:
     extends:
         - .fedora31_sphinx
-        - .cmake_build_unix
+        - .cmake_build_linux
         - .linux_builder_tags_qt
         - .run_automatically
 
@@ -88,7 +87,7 @@ test:cuda10.2-nvidia:
 build:fedora31-ninja:
     extends:
         - .fedora31_ninja
-        - .cmake_build_unix
+        - .cmake_build_linux
         - .cmake_build_artifacts
         - .linux_builder_tags_qt
         - .run_manually
@@ -96,7 +95,7 @@ build:fedora31-ninja:
 test:fedora31-ninja:
     extends:
         - .fedora31_ninja
-        - .cmake_test_unix
+        - .cmake_test_linux
         - .linux_builder_tags_qt
         - .cmake_test_artifacts
         - .run_automatically
@@ -121,7 +120,7 @@ test:fedora31-ninja-multi:
 build:macos-ninja:
     extends:
         - .macos_ninja
-        - .cmake_build_unix
+        - .cmake_build_macos
         - .cmake_build_artifacts
         - .macos_builder_tags
         - .run_manually
@@ -129,7 +128,7 @@ build:macos-ninja:
 test:macos-ninja:
     extends:
         - .macos_ninja
-        - .cmake_test_unix
+        - .cmake_test_macos
         - .cmake_test_artifacts
         - .macos_builder_tags
         - .run_automatically
@@ -141,7 +140,7 @@ test:macos-ninja:
 build:macos-makefiles:
     extends:
         - .macos_makefiles
-        - .cmake_build_unix
+        - .cmake_build_macos
         - .cmake_build_artifacts
         - .macos_builder_tags
         - .run_manually
@@ -149,7 +148,7 @@ build:macos-makefiles:
 test:macos-makefiles:
     extends:
         - .macos_makefiles
-        - .cmake_test_unix
+        - .cmake_test_macos
         - .macos_builder_tags
         - .run_automatically
     dependencies:
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index 7caf507..1c97377 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -118,6 +118,36 @@
 
 ## Linux-specific scripts
 
+.before_script_linux: &before_script_linux
+    - .gitlab/ci/cmake.sh
+    - .gitlab/ci/ninja.sh
+    - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
+    - cmake --version
+    - ninja --version
+
+.cmake_build_linux:
+    stage: build
+
+    script:
+        - *before_script_linux
+        - .gitlab/ci/sccache.sh
+        - sccache --start-server
+        - sccache --show-stats
+        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
+        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
+        - sccache --show-stats
+
+    interruptible: true
+
+.cmake_test_linux:
+    stage: test
+
+    script:
+        - *before_script_linux
+        - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
+
+    interruptible: true
+
 .cmake_build_release_linux:
     stage: build
 
@@ -154,7 +184,7 @@
     stage: test-ext
 
     script:
-        - *before_script_unix
+        - *before_script_linux
         # Make the CMake package available.
         - mkdir -p build/install
         - tar -C build/install --strip-components=1 -xzf build/cmake-*-Linux-x86_64.tar.gz
@@ -170,7 +200,7 @@
     stage: test-ext
 
     script:
-        - *before_script_unix
+        - *before_script_linux
         - .gitlab/ci/sccache.sh
         - sccache --start-server
         - sccache --show-stats
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index 69b1a07..9d123ec 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -66,11 +66,45 @@
 
 ## macOS-specific scripts
 
+.before_script_macos: &before_script_macos
+    - .gitlab/ci/cmake.sh
+    - .gitlab/ci/ninja.sh
+    - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
+    - cmake --version
+    - ninja --version
+    # Download Qt
+    - cmake -P .gitlab/ci/download_qt.cmake
+    - export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt
+
+.cmake_build_macos:
+    stage: build
+
+    script:
+        - *before_script_macos
+        - .gitlab/ci/sccache.sh
+        # Allow the server to already be running.
+        - "sccache --start-server || :"
+        - sccache --show-stats
+        - ctest -VV -S .gitlab/ci/ctest_configure.cmake
+        - ctest -VV -S .gitlab/ci/ctest_build.cmake
+        - sccache --show-stats
+
+    interruptible: true
+
+.cmake_test_macos:
+    stage: test
+
+    script:
+        - *before_script_macos
+        - ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake
+
+    interruptible: true
+
 .cmake_test_macos_external:
     stage: test-ext
 
     script:
-        - *before_script_unix
+        - *before_script_macos
         - .gitlab/ci/sccache.sh
         # Allow the server to already be running.
         - "sccache --start-server || :"
diff --git a/.gitlab/os-unix.yml b/.gitlab/os-unix.yml
deleted file mode 100644
index c1f6bb7..0000000
--- a/.gitlab/os-unix.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-# Unix-specific build commands
-
-.before_script_unix: &before_script_unix
-    - .gitlab/ci/cmake.sh
-    - .gitlab/ci/ninja.sh
-    - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH
-    - cmake --version
-    - ninja --version
-    # Download Qt on macOS
-    - "[ \"$( uname -s )\" = \"Darwin\" ] && cmake -P .gitlab/ci/download_qt.cmake"
-    - "[ \"$( uname -s )\" = \"Darwin\" ] && export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt"
-
-.cmake_build_unix:
-    stage: build
-
-    script:
-        - *before_script_unix
-        - .gitlab/ci/sccache.sh
-        # Allow the server to already be running.
-        - "sccache --start-server || :"
-        - sccache --show-stats
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
-        - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
-        - sccache --show-stats
-
-    interruptible: true
-
-.cmake_test_unix:
-    stage: test
-
-    script:
-        - *before_script_unix
-        - "$LAUNCHER ctest --output-on-failure -V -S .gitlab/ci/ctest_test.cmake"
-
-    interruptible: true
-- 
cgit v0.12