ci: Change macOS builds from Intel to ARM.
authorThomas Munro <tmunro@postgresql.org>
Sat, 31 Dec 2022 21:45:18 +0000 (10:45 +1300)
committerThomas Munro <tmunro@postgresql.org>
Sat, 31 Dec 2022 21:45:18 +0000 (10:45 +1300)
Cirrus is about to shut down its macOS-on-Intel support, so it's time to
move our CI testing over to ARM instances.  The Homebrew package manager
changed its default installation prefix for the new architecture, so a
couple of tests need tweaks to find binaries.

Back-patch to 15, where in-tree CI began.

Author: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/20221122225744.GF11463%40telsasoft.com

.cirrus.yml
src/test/kerberos/t/001_auth.pl
src/test/ldap/t/001_auth.pl

index 993af88865921e34701f63676297243fb71f0fb9..354102613d803ac017dd3e39bc61439d9e9e1eba 100644 (file)
@@ -407,7 +407,7 @@ task:
   name: macOS - Monterey - Meson
 
   env:
-    CPUS: 12 # always get that much for cirrusci macOS instances
+    CPUS: 4 # always get that much for cirrusci macOS instances
     BUILD_JOBS: $CPUS
     # Test performance regresses noticably when using all cores. 8 seems to
     # work OK. See
@@ -428,8 +428,8 @@ task:
   depends_on: SanityCheck
   only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
 
-  osx_instance:
-    image: monterey-base
+  macos_instance:
+    image: ghcr.io/cirruslabs/macos-monterey-base:latest
 
   sysinfo_script: |
     id
@@ -475,7 +475,7 @@ task:
   ccache_cache:
     folder: $CCACHE_DIR
   configure_script: |
-    brewpath="/usr/local"
+    brewpath="/opt/homebrew"
     PKG_CONFIG_PATH="${brewpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
 
     for pkg in icu4c krb5 openldap openssl zstd ; do
index a2bc8a5351e212b984f1b67d5b2381be88186ee5..298dc0c62b18ae65785f40390b2b3bb1d722f6ea 100644 (file)
@@ -32,8 +32,15 @@ elsif ($ENV{PG_TEST_EXTRA} !~ /\bkerberos\b/)
 
 my ($krb5_bin_dir, $krb5_sbin_dir);
 
-if ($^O eq 'darwin')
+if ($^O eq 'darwin' && -d "/opt/homebrew" )
 {
+   # typical paths for Homebrew on ARM
+   $krb5_bin_dir  = '/opt/homebrew/opt/krb5/bin';
+   $krb5_sbin_dir = '/opt/homebrew/opt/krb5/sbin';
+}
+elsif ($^O eq 'darwin')
+{
+   # typical paths for Homebrew on Intel
    $krb5_bin_dir  = '/usr/local/opt/krb5/bin';
    $krb5_sbin_dir = '/usr/local/opt/krb5/sbin';
 }
index 0ea274c383ec5dc2755633b08b2c5058b36133a5..39736e5116e9020c057978f4c5f9d7611b764c2d 100644 (file)
@@ -21,9 +21,15 @@ elsif ($ENV{PG_TEST_EXTRA} !~ /\bldap\b/)
 {
    plan skip_all => 'Potentially unsafe test LDAP not enabled in PG_TEST_EXTRA';
 }
+elsif ($^O eq 'darwin' && -d '/opt/homebrew/opt/openldap')
+{
+   # typical paths for Homebrew on ARM
+   $slapd           = '/opt/homebrew/opt/openldap/libexec/slapd';
+   $ldap_schema_dir = '/opt/homebrew/etc/openldap/schema';
+}
 elsif ($^O eq 'darwin' && -d '/usr/local/opt/openldap')
 {
-   # typical paths for Homebrew
+   # typical paths for Homebrew on Intel
    $slapd           = '/usr/local/opt/openldap/libexec/slapd';
    $ldap_schema_dir = '/usr/local/etc/openldap/schema';
 }