diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 793243421c..43bfbd8834 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,38 @@ test: - t/failed-test-artifacts when: on_failure +test:osx: + image: $image + tags: + - saas-macos-medium-m1 + variables: + TEST_OUTPUT_DIRECTORY: "/Volumes/RAMDisk" + before_script: + # Create a 4GB RAM disk that we use to store test output on. This small hack + # significantly speeds up tests by more than a factor of 2 because the + # macOS runners use network-attached storage as disks, which is _really_ + # slow with the many small writes that our tests do. + - sudo diskutil apfs create $(hdiutil attach -nomount ram://8192000) RAMDisk + - ./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 + mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/ + 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;; *)