diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2020-05-14 18:36:04 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2020-05-22 15:34:14 (GMT) |
commit | 02c56b71a1f2f66be0ba79f0b3da66bfa3107ce7 (patch) | |
tree | 567b777f6fa3123c6cea3f450fafee56dc4076a2 | |
parent | a1b1fc611bc8aeb519b79b3e1b86ce4e4dbc55e9 (diff) | |
download | CMake-02c56b71a1f2f66be0ba79f0b3da66bfa3107ce7.zip CMake-02c56b71a1f2f66be0ba79f0b3da66bfa3107ce7.tar.gz CMake-02c56b71a1f2f66be0ba79f0b3da66bfa3107ce7.tar.bz2 |
gitlab-ci: add a macos builder
-rw-r--r-- | .gitlab-ci.yml | 112 | ||||
-rwxr-xr-x | .gitlab/ci/cmake.sh | 30 | ||||
-rw-r--r-- | .gitlab/ci/configure_macos_makefiles.cmake | 1 | ||||
-rw-r--r-- | .gitlab/ci/configure_macos_ninja.cmake | 1 | ||||
-rwxr-xr-x | .gitlab/ci/ninja.sh | 26 | ||||
-rwxr-xr-x | .gitlab/ci/sccache.sh | 28 |
6 files changed, 164 insertions, 34 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6ef553a..421c3f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,49 @@ CTEST_NO_WARNINGS_ALLOWED: 1 CMAKE_GENERATOR: "Unix Makefiles" +.macos: &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/gitlab-kitware-cmake ci" + +.macos_ninja: &macos_ninja + extends: .macos + + variables: + CMAKE_CONFIGURATION: macos_ninja + CTEST_NO_WARNINGS_ALLOWED: 1 + +.macos_makefiles: &macos_makefiles + extends: .macos + + variables: + CMAKE_CONFIGURATION: macos_makefiles + CTEST_NO_WARNINGS_ALLOWED: 1 + CMAKE_GENERATOR: "Unix Makefiles" + +.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. + +.macos_builder_tags: &macos_builder_tags + tags: + - cmake # Since this is a bare runner, pin to a project. + - macos + - shell + before_script: - .gitlab/ci/cmake.sh - .gitlab/ci/ninja.sh @@ -65,14 +108,11 @@ before_script: .cmake_build_unix: &cmake_build_unix stage: build only: *only_settings - tags: - - build - - docker - - linux script: - .gitlab/ci/sccache.sh - - sccache --start-server + # 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" @@ -143,10 +183,6 @@ before_script: .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" @@ -161,38 +197,33 @@ build:debian10-iwyu: <<: - *debian10_iwyu - *cmake_build_unix + - *linux_builder_tags build:fedora31-tidy: <<: - *fedora31_tidy - *cmake_build_unix + - *linux_builder_tags build:fedora31-sphinx: <<: - *fedora31_sphinx - *cmake_build_unix - tags: - - build - - docker - - linux - - linux-3.17 # Needed to be able to load Fedora's Qt libraries. + - *linux_builder_tags_qt build:fedora31-ninja: <<: - *fedora31_ninja - *cmake_build_unix - *cmake_build_artifacts + - *linux_builder_tags 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. + - *linux_builder_tags_qt dependencies: - build:fedora31-ninja needs: @@ -203,18 +234,51 @@ build:fedora31-makefiles: - *fedora31_makefiles - *cmake_build_unix - *cmake_build_artifacts + - *linux_builder_tags 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. + - *linux_builder_tags_qt dependencies: - build:fedora31-makefiles needs: - build:fedora31-makefiles + +build:macos-ninja: + <<: + - *macos_ninja + - *cmake_build_unix + - *cmake_build_artifacts + - *macos_builder_tags + when: manual + +test:macos-ninja: + <<: + - *macos_ninja + - *cmake_test_unix + - *macos_builder_tags + dependencies: + - build:macos-ninja + needs: + - build:macos-ninja + +build:macos-makefiles: + <<: + - *macos_makefiles + - *cmake_build_unix + - *cmake_build_artifacts + - *macos_builder_tags + when: manual + +test:macos-makefiles: + <<: + - *macos_makefiles + - *cmake_test_unix + - *macos_builder_tags + dependencies: + - build:macos-makefiles + needs: + - build:macos-makefiles diff --git a/.gitlab/ci/cmake.sh b/.gitlab/ci/cmake.sh index 4b2f53f..658a62a 100755 --- a/.gitlab/ci/cmake.sh +++ b/.gitlab/ci/cmake.sh @@ -3,14 +3,38 @@ set -e readonly version="3.17.2" -readonly sha256sum="dc57f3cc448ca67fc8776b4ad4c22b087b9c6a8e459938b9622b8c7f4ef6b21e" -readonly filename="cmake-$version-Linux-x86_64" + +case "$( uname -s )" in + Linux) + shatool="sha256sum" + sha256sum="dc57f3cc448ca67fc8776b4ad4c22b087b9c6a8e459938b9622b8c7f4ef6b21e" + platform="Linux" + ;; + Darwin) + shatool="shasum -a 256" + sha256sum="139500e20b080444fcafe57f24f57248c691c5187cce6695bee2b9aad6792c7d" + platform="Darwin" + ;; + *) + echo "Unrecognized platform $( uname -s )" + exit 1 + ;; +esac +readonly shatool +readonly sha256sum +readonly platform + +readonly filename="cmake-$version-$platform-x86_64" readonly tarball="$filename.tar.gz" cd .gitlab echo "$sha256sum $tarball" > cmake.sha256sum curl -OL "https://github.com/Kitware/CMake/releases/download/v$version/$tarball" -sha256sum --check cmake.sha256sum +$shatool --check cmake.sha256sum tar xf "$tarball" mv "$filename" cmake + +if [ "$( uname -s )" = "Darwin" ]; then + ln -s CMake.app/Contents/bin cmake/bin +fi diff --git a/.gitlab/ci/configure_macos_makefiles.cmake b/.gitlab/ci/configure_macos_makefiles.cmake new file mode 100644 index 0000000..33f0db0 --- /dev/null +++ b/.gitlab/ci/configure_macos_makefiles.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/configure_macos_ninja.cmake b/.gitlab/ci/configure_macos_ninja.cmake new file mode 100644 index 0000000..33f0db0 --- /dev/null +++ b/.gitlab/ci/configure_macos_ninja.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/ninja.sh b/.gitlab/ci/ninja.sh index 31da12b..93c1ee9 100755 --- a/.gitlab/ci/ninja.sh +++ b/.gitlab/ci/ninja.sh @@ -3,13 +3,33 @@ set -e readonly version="1.10.0" -readonly sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82" -readonly filename="ninja-linux" + +case "$( uname -s )" in + Linux) + shatool="sha256sum" + sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82" + platform="linux" + ;; + Darwin) + shatool="shasum -a 256" + sha256sum="2ee405c0e205d55666c60cc9c0d8d04c8ede06d3ef2e2c2aabe08fd81c17d22e" + platform="mac" + ;; + *) + echo "Unrecognized platform $( uname -s )" + exit 1 + ;; +esac +readonly shatool +readonly sha256sum +readonly platform + +readonly filename="ninja-$platform" readonly tarball="$filename.zip" cd .gitlab echo "$sha256sum $tarball" > ninja.sha256sum curl -OL "https://github.com/ninja-build/ninja/releases/download/v$version/$tarball" -sha256sum --check ninja.sha256sum +$shatool --check ninja.sha256sum ./cmake/bin/cmake -E tar xf "$tarball" diff --git a/.gitlab/ci/sccache.sh b/.gitlab/ci/sccache.sh index c88cdcc..f7d51ff 100755 --- a/.gitlab/ci/sccache.sh +++ b/.gitlab/ci/sccache.sh @@ -2,15 +2,35 @@ set -e -readonly version="0.2.12" -readonly sha256sum="26fd04c1273952cc2a0f359a71c8a1857137f0ee3634058b3f4a63b69fc8eb7f" -readonly filename="sccache-$version-x86_64-unknown-linux-musl" +readonly version="0.2.13" + +case "$( uname -s )" in + Linux) + shatool="sha256sum" + sha256sum="28a5499e340865b08b632306b435913beb590fbd7b49a3f887a623b459fabdeb" + platform="x86_64-unknown-linux-musl" + ;; + Darwin) + shatool="shasum -a 256" + sha256sum="f564e948abadfc9e409eb1cd7babf24c6784057d5506c3b0a04cdd37cd830ae9" + platform="x86_64-apple-darwin" + ;; + *) + echo "Unrecognized platform $( uname -s )" + exit 1 + ;; +esac +readonly shatool +readonly sha256sum +readonly platform + +readonly filename="sccache-$version-$platform" readonly tarball="$filename.tar.gz" cd .gitlab echo "$sha256sum $tarball" > sccache.sha256sum curl -OL "https://github.com/mozilla/sccache/releases/download/$version/$tarball" -sha256sum --check sccache.sha256sum +$shatool --check sccache.sha256sum tar xf "$tarball" mv "$filename/sccache" . |