@@ -40,61 +40,64 @@ setup_ci_environment: &setup_ci_environment
4040 name : Set Up CI Environment After attach_workspace
4141 no_output_timeout : " 1h"
4242 command : ~/workspace/.circleci/scripts/setup_ci_environment.sh
43+ commands :
44+ brew_update :
45+ description : " Update Homebrew and install base formulae"
46+ steps :
47+ - run :
48+ name : Update Homebrew
49+ no_output_timeout : " 10m"
50+ command : |
51+ set -ex
4352
44- # Installs expect and moreutils so that we can call `unbuffer` and `ts`.
45- # Also installs OpenMP
46- # !!!!NOTE!!!! this is copied into a binary_macos_brew_update job which is the
47- # same but does not install libomp. If you are changing this, consider if you
48- # need to change that step as well.
49- macos_brew_update : &macos_brew_update
50- name : Brew update and install moreutils, expect and libomp
51- no_output_timeout : " 1h"
52- command : |
53- set -ex
54-
55- # Update repositories manually
56- for path in $(find /usr/local/Homebrew -type d -name .git)
57- do
58- cd $path/..
59- git fetch --depth=1 origin
60- git reset --hard origin/master
61- done
62-
63- export HOMEBREW_NO_AUTO_UPDATE=1
64-
65- # moreutils installs a `parallel` executable by default, which conflicts
66- # with the executable from the GNU `parallel`, so we must unlink GNU
67- # `parallel` first, and relink it afterwards
68- brew unlink parallel
69- brew install moreutils
70- brew link parallel --overwrite
71- brew install expect
72- brew install libomp
73-
74- ios_brew_update : &ios_brew_update
75- name : Brew update and install iOS toolchains
76- no_output_timeout : " 1h"
77- command : |
78- set -ex
79-
80- # Update repositories manually
81- for path in $(find /usr/local/Homebrew -type d -name .git)
82- do
83- cd $path/..
84- git fetch --depth=1 origin
85- git reset --hard origin/master
86- done
87-
88- export HOMEBREW_NO_AUTO_UPDATE=1
89-
90- # moreutils installs a `parallel` executable by default, which conflicts
91- # with the executable from the GNU `parallel`, so we must unlink GNU
92- # `parallel` first, and relink it afterwards
93- brew unlink parallel
94- brew install moreutils
95- brew link parallel --overwrite
96- brew install expect
97- brew install libtool
53+ # Update repositories manually.
54+ # Running `brew update` produces a comparison between the
55+ # current checkout and the updated checkout, which takes a
56+ # very long time because the existing checkout is 2y old.
57+ for path in $(find /usr/local/Homebrew -type d -name .git)
58+ do
59+ cd $path/..
60+ git fetch --depth=1 origin
61+ git reset --hard origin/master
62+ done
63+
64+ export HOMEBREW_NO_AUTO_UPDATE=1
65+
66+ # Install expect and moreutils so that we can call `unbuffer` and `ts`.
67+ # moreutils installs a `parallel` executable by default, which conflicts
68+ # with the executable from the GNU `parallel`, so we must unlink GNU
69+ # `parallel` first, and relink it afterwards.
70+ brew unlink parallel
71+ brew install moreutils
72+ brew link parallel --overwrite
73+ brew install expect
74+
75+ brew_install :
76+ description : " Install Homebrew formulae"
77+ parameters :
78+ formulae :
79+ type : string
80+ default : " "
81+ steps :
82+ - run :
83+ name : Install << parameters.formulae >>
84+ no_output_timeout : " 10m"
85+ command : |
86+ set -ex
87+ export HOMEBREW_NO_AUTO_UPDATE=1
88+ brew install << parameters.formulae >>
89+
90+ run_brew_for_macos_build :
91+ steps :
92+ - brew_update
93+ - brew_install :
94+ formulae : libomp
95+
96+ run_brew_for_ios_build :
97+ steps :
98+ - brew_update
99+ - brew_install :
100+ formulae : libtool
98101
99102# #############################################################################
100103# Binary build (nightlies nightly build) defaults
@@ -145,26 +148,6 @@ binary_run_in_docker: &binary_run_in_docker
145148 # This step only runs on circleci linux machine executors that themselves
146149 # need to start docker images
147150 command : ~/workspace/.circleci/scripts/binary_run_in_docker.sh
148-
149- # This is copied almost verbatim from the macos_brew_update job
150- # In version 2.1 and above we could make this a command and pass a parameter to
151- # it, but in this version there is no way to pass a parameter to a step
152- binary_macos_brew_update : &binary_macos_brew_update
153- name : Brew update and install moreutils and expect
154- no_output_timeout : " 1h"
155- command : |
156- set -eux -o pipefail
157- # See https://discourse.brew.sh/t/fetching-homebrew-repos-is-slow/5374/3
158- brew untap caskroom/homebrew-cask
159- # moreutils installs a `parallel` executable by default, which conflicts
160- # with the executable from the GNU `parallel`, so we must unlink GNU
161- # `parallel` first, and relink it afterwards
162- brew update
163- brew unlink parallel
164- brew install moreutils
165- brew link parallel --overwrite
166- brew install expect
167-
168151# #############################################################################
169152# Build parameters
170153# #############################################################################
@@ -541,8 +524,7 @@ jobs:
541524 - run :
542525 << : *should_run_job
543526 - checkout
544- - run :
545- << : *macos_brew_update
527+ - run_brew_for_macos_build
546528 - run :
547529 name : Build
548530 no_output_timeout : " 1h"
@@ -772,8 +754,7 @@ jobs:
772754 << : *binary_checkout
773755 - run :
774756 << : *binary_populate_env
775- - run :
776- << : *binary_macos_brew_update
757+ - brew_update
777758 - run :
778759 << : *binary_install_miniconda
779760 - run :
@@ -802,8 +783,7 @@ jobs:
802783 << : *binary_checkout
803784 - run :
804785 << : *binary_populate_env
805- - run :
806- << : *binary_macos_brew_update
786+ - brew_update
807787 - run :
808788 << : *binary_install_miniconda
809789
@@ -843,8 +823,7 @@ jobs:
843823 << : *binary_checkout
844824 - run :
845825 << : *binary_populate_env
846- - run :
847- << : *binary_macos_brew_update
826+ - brew_update
848827 - run :
849828 << : *binary_install_miniconda
850829 - attach_workspace : # TODO - we can `cp` from ~/workspace
@@ -1044,8 +1023,7 @@ jobs:
10441023 - run :
10451024 << : *should_run_job
10461025 - checkout
1047- - run :
1048- << : *macos_brew_update
1026+ - run_brew_for_macos_build
10491027 - run :
10501028 name : Build
10511029 no_output_timeout : " 1h"
@@ -1088,8 +1066,7 @@ jobs:
10881066 at : ~/workspace
10891067 - run :
10901068 << : *should_run_job
1091- - run :
1092- << : *macos_brew_update
1069+ - run_brew_for_macos_build
10931070 - run :
10941071 name : Test
10951072 no_output_timeout : " 1h"
@@ -1115,8 +1092,7 @@ jobs:
11151092 - run :
11161093 << : *should_run_job
11171094 - checkout
1118- - run :
1119- << : *macos_brew_update
1095+ - run_brew_for_macos_build
11201096 - run :
11211097 name : Build
11221098 no_output_timeout : " 1h"
@@ -1308,8 +1284,7 @@ jobs:
13081284 - run :
13091285 << : *should_run_job
13101286 - checkout
1311- - run :
1312- << : *ios_brew_update
1287+ - run_brew_for_ios_build
13131288 - run :
13141289 name : Build
13151290 no_output_timeout : " 1h"
0 commit comments