Skip to content

Commit 8f19e6e

Browse files
authored
Merge pull request #1478 from ychin/ci-macos-14-apple-silicon
Update CI to use macos-14 / Apple Silicon runners
2 parents 4e39985 + 9416d4f commit 8f19e6e

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed

.github/actions/universal-package/action.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,18 @@ runs:
4747
xcode_version=$(xcodebuild -version | tail -1 | sed -E 's/Build version (.*)/\1/')
4848
echo "xcode_version=$xcode_version" >> $GITHUB_OUTPUT
4949
50+
# Find Homebrew's install location which could be /usr/local or /opt/homebrew
51+
brew_prefix=$(brew --prefix)
52+
echo "brew_prefix=$brew_prefix" >> $GITHUB_OUTPUT
53+
5054
echo '::endgroup::'
5155
5256
- name: Cache keg
5357
id: cache-keg
5458
uses: actions/cache@v3
5559
with:
56-
path: /usr/local/Cellar/${{ inputs.formula }}
57-
key: ${{ inputs.formula }}-homebrew-cache-custom-unified-xcode${{ steps.setup-formula.outputs.xcode_version }}-${{ hashFiles(format('{0}.rb', inputs.formula)) }}
60+
path: ${{ steps.setup-formula.outputs.brew_prefix }}/Cellar/${{ inputs.formula }}
61+
key: ${{ inputs.formula }}-homebrew-cache-custom-unified-prefix${{ steps.setup-formula.outputs.brew_prefix }}-xcode${{ steps.setup-formula.outputs.xcode_version }}-${{ hashFiles(format('{0}.rb', inputs.formula)) }}
5862

5963
- name: Install formula
6064
shell: bash
@@ -65,7 +69,7 @@ runs:
6569
# This will be a no-op if formula was cached
6670
brew install --formula -s ./${formula}.rb
6771
68-
# If formula was cached, this step is necessary to relink it to /usr/local/
72+
# If formula was cached, this step is necessary to relink it to brew prefix (e.g. /usr/local)
6973
brew unlink ${formula} && brew link ${formula}
7074
echo '::endgroup::'
7175
@@ -74,11 +78,11 @@ runs:
7478
7579
for content in "${contents[@]}"; do
7680
# Print out the archs and verify they are universal fat binary.
77-
lipo -info /usr/local/${content} | grep 'x86_64 arm64'
81+
lipo -info $(brew --prefix)/${content} | grep 'x86_64 arm64'
7882
7983
# Make sure deployment target is correct. Later macOS versions have a different binary format (just search for
8084
# "minos") but for 10.13 we need to look for LC_VERSION_MIN_MACOSX.
81-
otool -l /usr/local/${content} | grep -A 2 LC_VERSION_MIN_MACOSX | tail -1 | grep "${MACOSX_DEPLOYMENT_TARGET}"
85+
otool -l $(brew --prefix)/${content} | grep -A 2 LC_VERSION_MIN_MACOSX | tail -1 | grep "${MACOSX_DEPLOYMENT_TARGET}"
8286
done
8387
8488
echo '::endgroup::'

.github/workflows/ci-macvim.yaml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ env:
2525
VERSIONER_PERL_VERSION: '5.30' # macOS default Perl installation uses this to determine which one to use
2626

2727
vi_cv_path_python: /Library/Frameworks/Python.framework/Versions/2.7/bin/python
28-
vi_cv_path_python3: /usr/local/bin/python3
29-
vi_cv_path_plain_lua: /usr/local/bin/lua
30-
vi_cv_path_ruby: /usr/local/opt/ruby/bin/ruby
28+
vi_cv_path_python3: "%s/bin/python3"
29+
vi_cv_path_plain_lua: "%s/bin/lua"
30+
vi_cv_path_ruby: "%s/opt/ruby/bin/ruby"
3131
vi_cv_dll_name_perl: /System/Library/Perl/%s/darwin-thread-multi-2level/CORE/libperl.dylib
3232
vi_cv_dll_name_python: /Library/Frameworks/Python.framework/Versions/2.7/Python
3333
vi_cv_dll_name_python3: /usr/local/Frameworks/Python.framework/Versions/Current/Python
@@ -65,10 +65,16 @@ jobs:
6565
legacy: true
6666
publish_postfix: '_10.9'
6767

68-
# Most up to date OS and Xcode. Used to publish release for the main build.
6968
- os: macos-13
70-
xcode: '15.1'
69+
xcode: '15.2'
70+
optimized: true
71+
72+
# Most up to date OS and Xcode. Used to publish release for the main build.
73+
# This runner uses Apple Silicon.
74+
- os: macos-14
75+
xcode: '15.2'
7176
publish: true
77+
optimized: true
7278

7379
runs-on: ${{ matrix.os }}
7480

@@ -120,6 +126,10 @@ jobs:
120126
# Set up remaining packages and tools
121127

122128
- name: Install packages
129+
run: |
130+
brew install libtool
131+
132+
- name: Install scripting runtimes
123133
if: matrix.publish
124134
run: |
125135
# We no longer need to install/update Python 3, as it's guaranteed to
@@ -129,11 +139,15 @@ jobs:
129139
brew install ruby
130140
brew install lua
131141
132-
if [[ -d /usr/local/Cellar/perl ]]; then
142+
if [[ -d $(brew --prefix)/Cellar/perl ]]; then
133143
# We just use system perl to reduce dependencies
134144
brew unlink perl
135145
fi
136146
147+
echo "vi_cv_path_python3=$(printf $vi_cv_path_python3 $(brew --prefix))" >> $GITHUB_ENV
148+
echo "vi_cv_path_plain_lua=$(printf $vi_cv_path_plain_lua $(brew --prefix))" >> $GITHUB_ENV
149+
echo "vi_cv_path_ruby=$(printf $vi_cv_path_ruby $(brew --prefix))" >> $GITHUB_ENV
150+
137151
# With Perl, we need to manually specify the version number because the dylib path depends on it.
138152
echo "vi_cv_dll_name_perl=$(printf $vi_cv_dll_name_perl $VERSIONER_PERL_VERSION)" >> $GITHUB_ENV
139153
@@ -155,6 +169,7 @@ jobs:
155169
set -o verbose
156170
157171
CONFOPT=(
172+
--with-local-dir=$(brew --prefix)
158173
--with-features=huge
159174
--enable-netbeans
160175
--with-tlib=ncurses
@@ -170,12 +185,11 @@ jobs:
170185
--with-python3-stable-abi=3.9 # macOS and Xcode currently ships 3.9, so we don't want go higher than that.
171186
--enable-rubyinterp=dynamic
172187
--enable-luainterp=dynamic
173-
--with-lua-prefix=/usr/local
188+
--with-lua-prefix=$(brew --prefix)
174189
--with-macarchs="$MACVIM_ARCHS"
175190
)
176191
else
177192
CONFOPT+=(
178-
--with-macarchs=x86_64
179193
--disable-sparkle # Disable Sparkle for testing that this flag builds and works
180194
)
181195
fi
@@ -193,10 +207,8 @@ jobs:
193207
sed -i.bak -f ci/config.mk.clang-12.sed src/auto/config.mk
194208
fi
195209
196-
if ${{ matrix.publish == true && ! matrix.legacy }}; then
197-
# Only do O3/link-time optimizations for publish builds, so the other ones can still finish quickly to give
198-
# quick feedbacks. Only do this for non-legacy builds now as it seems the older toolchain doesn't work as
199-
# well for this.
210+
if ${{ matrix.optimized == true }}; then
211+
# Additional optimizations like link-time optimizations that are a bit slower to build.
200212
sed -i.bak -f ci/config.mk.optimized.sed src/auto/config.mk
201213
fi
202214
@@ -276,10 +288,16 @@ jobs:
276288
# Smoketest scripting languages
277289
macvim_excmd -c 'lua print("Test")' | grep Test
278290
macvim_excmd -c 'perl VIM::Msg("Test")' | grep Test
279-
macvim_excmd -c 'py print "Test"' | grep Test
280291
macvim_excmd -c 'py3 print("Test")' | grep Test
281292
macvim_excmd -c 'ruby puts("Test")' | grep Test
282293
294+
if [[ "$(uname -m)" == "x86_64" ]]; then
295+
macvim_excmd -c 'py print "x86 Test"' | grep Test
296+
else
297+
# Python2 doesn't work in Apple Silicon, test under Rosetta
298+
(VIM_BIN="arch -x86_64 ${VIM_BIN}"; macvim_excmd -c 'py print "rosetta Test"' | grep Test)
299+
fi
300+
283301
# Check that localized messages work by printing ':version' and checking against localized word
284302
macvim_excmd -c 'lang es_ES' -c 'version' | grep Enlazado
285303

0 commit comments

Comments
 (0)