[PATCH 3/3] ci: add macOS jobs to GitLab CI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add two macOS-based jobs to GitLab CI, one for Clang and one for GCC.
This matches equivalent jobs we have for GitHub Workflows, except that
we use macOS 14 instead of macOS 13.

Note that one test marked as `test_must_fail` is surprisingly passing:

  t7815-grep-binary.sh                             (Wstat: 0 Tests: 22 Failed: 0)
    TODO passed:   12

This seems to boil down to an unexpected difference in how regcomp(1)
works when matching NUL bytes. Cross-checking with the respective GitHub
job shows though that this is not an issue unique to the GitLab CI job
as it passes in the same way there.

Further note that we do not include the equivalent for the "osx-gcc" job
that we use with GitHub Workflows. This is because the runner for macOS
on GitLab is running on Apple M1 machines and thus uses the "arm64"
architecture. GCC does not support this platform yet.

Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
---
 .gitlab-ci.yml | 26 +++++++++++++++++++++++++-
 ci/lib.sh      |  9 ++++++++-
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 793243421c..9748970798 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,7 @@ workflow:
     - if: $CI_COMMIT_TAG
     - if: $CI_COMMIT_REF_PROTECTED == "true"
 
-test:
+test:linux:
   image: $image
   before_script:
     - ./ci/install-docker-dependencies.sh
@@ -52,6 +52,30 @@ test:
       - t/failed-test-artifacts
     when: on_failure
 
+test:osx:
+  image: $image
+  tags:
+    - saas-macos-medium-m1
+  before_script:
+    - ./ci/install-dependencies.sh
+  script:
+    - ./ci/run-build-and-tests.sh
+  after_script:
+    - |
+      if test "$CI_JOB_STATUS" != 'success'
+      then
+        ./ci/print-test-failures.sh
+      fi
+  parallel:
+    matrix:
+      - jobname: osx-clang
+        image: macos-13-xcode-14
+        CC: clang
+  artifacts:
+    paths:
+      - t/failed-test-artifacts
+    when: on_failure
+
 static-analysis:
   image: ubuntu:22.04
   variables:
diff --git a/ci/lib.sh b/ci/lib.sh
index f631206a44..d5dd2f2697 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -252,7 +252,14 @@ then
 	CI_COMMIT="$CI_COMMIT_SHA"
 	case "$CI_JOB_IMAGE" in
 	macos-*)
-		CI_OS_NAME=osx;;
+		# GitLab CI has Python installed via multiple package managers,
+		# most notably via asdf and Homebrew. Ensure that our builds
+		# pick up the Homebrew one by prepending it to our PATH as the
+		# asdf one breaks tests.
+		export PATH="$(brew --prefix)/bin:$PATH"
+
+		CI_OS_NAME=osx
+		;;
 	alpine:*|fedora:*|ubuntu:*)
 		CI_OS_NAME=linux;;
 	*)
-- 
2.43.GIT

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux