-
-
Notifications
You must be signed in to change notification settings - Fork 681
331 lines (276 loc) · 13.5 KB
/
ci-macvim.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
name: MacVim GitHub CI
on:
push:
pull_request:
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for
# pull requests or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
MACOSX_DEPLOYMENT_TARGET_LEGACY: '10.9'
MACVIM_ARCHS: "x86_64 arm64" # Universal app for Intel/Apple Silicon
MACVIM_ARCHS_LEGACY: "x86_64" # Legacy builds only need to build x86-64 because Apple Silicon can't run on these old OSes
CC: clang
VERSIONER_PERL_VERSION: '5.30'
VERSIONER_PYTHON_VERSION: '2.7'
vi_cv_path_python: /usr/local/bin/python
vi_cv_path_python3: /usr/local/bin/python3
vi_cv_path_plain_lua: /usr/local/bin/lua
vi_cv_path_ruby: /usr/local/opt/ruby/bin/ruby
vi_cv_dll_name_perl: /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/libperl.dylib
vi_cv_dll_name_python: /usr/local/Frameworks/Python.framework/Versions/2.7/Python
vi_cv_dll_name_python3: /usr/local/Frameworks/Python.framework/Versions/3.10/Python # Make sure to keep src/MacVim/vimrc synced with the Python version here for the Python DLL detection logic.
vi_cv_dll_name_python3_arm64: /opt/homebrew/Frameworks/Python.framework/Versions/3.10/Python
vi_cv_dll_name_ruby: /usr/local/opt/ruby/lib/libruby.dylib
vi_cv_dll_name_ruby_arm64: /opt/homebrew/opt/ruby/lib/libruby.dylib
vi_cv_dll_name_lua_arm64: /opt/homebrew/lib/liblua.dylib
VIM_BIN: src/MacVim/build/Release/MacVim.app/Contents/MacOS/Vim
MACVIM_BIN: src/MacVim/build/Release/MacVim.app/Contents/MacOS/MacVim
TERM: xterm
BASH_SILENCE_DEPRECATION_WARNING: 1
jobs:
# Builds and test MacVim
build-and-test:
# Test on macOS 11.x / 12.x, and also older versions of Xcode for compatibility testing.
strategy:
fail-fast: false
matrix:
include:
# Oldest version of Xcode supported on GitHub Action to test source code backwards compatibility
- os: macos-11
xcode: '11.7'
# Older version of Xcode, and used to publish legacy builds (for macOS 10.9 - 10.12)
- os: macos-12
xcode: '14.0' # last version of Xcode that uses the macOS 12 SDK, which still supports deploying to macOS 10.9
publish: true
legacy: true
publish_postfix: '_10.9'
# Most up to date OS and Xcode. Used to publish release for the main build.
- os: macos-12
xcode: '14.2'
publish: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up legacy build
if: matrix.legacy
run: |
# Set the correct build env vars to target the correct architectures and min OS targets.
echo "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET_LEGACY" >> $GITHUB_ENV
echo "MACVIM_ARCHS=$MACVIM_ARCHS_LEGACY" >> $GITHUB_ENV
# Use Sparkle 1 because Sparkle 2 requires newer OS version than our legacy build.
# Later, we pass the --enable-sparkle_1 flag to configure to set the corresponding ifdef.
ln -fhs Sparkle_1.framework src/MacVim/Sparkle.framework
- name: Set up Xcode
if: matrix.xcode != ''
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
xcode-select -p
xcodebuild -version
# Set up, install, and cache gettext library for localization.
#
# Instead of using the default binary installed by Homebrew, need to build our own because gettext is statically
# linked in MacVim, and need to be built against MACOSX_DEPLOYMENT_TARGET to ensure the built binary will work on
# supported macOS versions.
#
# In addition, to support building a universal MacVim, we need an arm64 version of gettext as well in order to
# create a universal gettext binary to link against (Homebrew only distributes thin binaries and therefore this
# has to be done manually). To do that, we will just pull the bottle directly from Homebrew and patch it in using
# lipo. We can't use normal brew commands to get the bottle because brew doesn't natively support cross-compiling
# and we are running CI on x86_64 Macs. We also don't need to worry about the min deployment target fix on arm64
# because all Apple Silicon Macs have to run on macOS 11+.
- name: Set up gettext
if: matrix.publish
uses: ./.github/actions/universal-package
with:
formula: gettext
contents: lib/libintl.a,lib/libintl.dylib
# Set up, install, and cache libsodium library for encryption.
- name: Set up libsodium
if: matrix.publish
uses: ./.github/actions/universal-package
with:
formula: libsodium
contents: lib/libsodium.a,lib/libsodium.dylib
# Set up remaining packages and tools
- name: Install packages
if: matrix.publish
run: |
brew install python3
brew install ruby
brew install lua
# CI sometimes have custom installed Python instead of using Homebrew. Forcefully re-
# link Python, and then check that we are using the Homebrew version. This avoids us
# using a mystery Python installation that we don't control.
brew unlink python3 && brew link --overwrite python3
readlink -f $vi_cv_path_python3 | grep "^$(brew --cellar python3)"
if [[ -d /usr/local/Cellar/perl ]]; then
# We just use system perl to reduce dependencies
brew unlink perl
fi
# All set up steps are done. Build and test MacVim below.
- name: Configure
run: |
set -o verbose
CONFOPT=(
--with-features=huge
--enable-netbeans
--with-tlib=ncurses
--enable-cscope
--enable-gui=macvim
--with-compiledby="GitHub Actions"
)
if ${{ matrix.publish == true }}; then
CONFOPT+=(
--enable-perlinterp=dynamic
--enable-pythoninterp=dynamic
--enable-python3interp=dynamic
--enable-rubyinterp=dynamic
--enable-luainterp=dynamic
--with-lua-prefix=/usr/local
--with-macarchs="$MACVIM_ARCHS"
)
else
CONFOPT+=(
--with-macarchs=x86_64
--disable-sparkle # Disable Sparkle for testing that this flag builds and works
)
fi
if ${{ matrix.legacy == true }}; then
CONFOPT+=(
--enable-sparkle_1
)
fi
echo "CONFOPT: ${CONFOPT[@]}"
./configure "${CONFOPT[@]}" --enable-fail-if-missing
sed -i.bak -f ci/config.mk.sed -f ci/config.mk.clang.sed src/auto/config.mk
if clang --version | grep -qs '^Apple clang version \(1[3-9]\|[2-9]\d\)\.'; then
sed -i.bak -f ci/config.mk.clang-12.sed src/auto/config.mk
fi
- name: Modify configure result
if: matrix.publish
run: |
# Ruby is keg-only in Homebrew, so need to manually link in the path so Vim will know where to look for the binaries.
perl -p -i -e "s#(?<=-DDYNAMIC_RUBY_DLL=\\\\\").*?(?=\\\\\")#${vi_cv_dll_name_ruby}#" src/auto/config.mk
grep -q -- "-DDYNAMIC_PERL_DLL=\\\\\"${vi_cv_dll_name_perl}\\\\\"" src/auto/config.mk
grep -q -- "-DDYNAMIC_PYTHON_DLL=\\\\\"${vi_cv_dll_name_python}\\\\\"" src/auto/config.mk
grep -q -- "-DDYNAMIC_PYTHON3_DLL=\\\\\"${vi_cv_dll_name_python3}\\\\\"" src/auto/config.mk
grep -q -- "-DDYNAMIC_RUBY_DLL=\\\\\"${vi_cv_dll_name_ruby}\\\\\"" src/auto/config.mk
# Also search for the arm64 overrides for the default library locations, which are different from x86_64
# because Homebrew puts them at a different place.
grep -q -- "-DDYNAMIC_PYTHON3_DLL_ARM64=\\\\\"${vi_cv_dll_name_python3_arm64}\\\\\"" src/auto/config.mk
grep -q -- "-DDYNAMIC_RUBY_DLL_ARM64=\\\\\"${vi_cv_dll_name_ruby_arm64}\\\\\"" src/auto/config.mk
grep -q -- "-DDYNAMIC_LUA_DLL_ARM64=\\\\\"${vi_cv_dll_name_lua_arm64}\\\\\"" src/auto/config.mk
- name: Show configure output
run: |
cat src/auto/config.mk
cat src/auto/config.h
# Build Vim first, separately from MacVim, so that we can use it to run
# vimtags afterwards to get the most correct help tags before we copy
# that into the MacVim bundle.
- name: Build Vim
env:
LC_ALL: C
run: |
set -o verbose
NPROC=$(getconf _NPROCESSORS_ONLN)
echo "Building Vim with ${NPROC} cores"
make -C src -j${NPROC} Vim
# Re-generate Vim help tags, because sometimes the Vim's runtime is not
# updated to have the latest tags.
- name: Update Vim help tags
if: matrix.publish
run: make -C runtime/doc vimtags VIMEXE=../../src/vim
- name: Build MacVim
env:
LC_ALL: C
run: |
set -o verbose
NPROC=$(getconf _NPROCESSORS_ONLN)
echo "Building MacVim with ${NPROC} cores"
make -j${NPROC}
- name: Check version
run: |
${VIM_BIN} --version
${VIM_BIN} -u NONE -i NONE --not-a-term -esNX -V1 -c 'echo "\nprof_nsec:" .. has("prof_nsec") .. "\n"' -c quit
${VIM_BIN} -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
${VIM_BIN} -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
- name: Smoketest
run: |
set -o verbose
# Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use
# static linkage to avoid dependency hell. Test that all those dylib's are in /usr/lib which is bundled with macOS and not third-party.
if otool -L ${VIM_BIN} | grep '\.dylib\s' | grep -v '^\s*/usr/lib/'; then
echo 'Found external dynamic linkage!'; false
fi
# Make sure that --disable-sparkle flag will properly exclude all references to Sparkle symbols. This is
# necessary because we still use weak linking to Sparkle when that flag is set and so references to Sparkle
# wouldn't fail the build (we just remove Sparkle.framework from the built app after the fact).
if ${{ matrix.publish == false }}; then
# Currently we pass --disable-sparkle flag when publish==false
if objdump -t ${MACVIM_BIN} | grep "_SPU\|_SUUpdate"; then
echo 'Found references to Sparkle even when using --disable-sparkle'; false
fi
fi
- name: Smoketest (publish)
if: matrix.publish
run: |
set -o verbose
macvim_excmd() {
${VIM_BIN} -u NONE -i NONE -g -f -X -V1 -es "$@" -c 'echo ""' -c 'qall!' 2>&1
}
# Smoketest scripting languages
macvim_excmd -c 'lua print("Test")' | grep Test
macvim_excmd -c 'perl VIM::Msg("Test")' | grep Test
macvim_excmd -c 'py print "Test"' | grep Test
macvim_excmd -c 'py3 print("Test")' | grep Test
macvim_excmd -c 'ruby puts("Test")' | grep Test
# Check that localized messages work by printing ':version' and checking against localized word
macvim_excmd -c 'lang es_ES' -c 'version' | grep Enlazado
# Check that libsodium is working
macvim_excmd -c 'set cryptmethod=xchacha20'
# Make sure we are building universal x86_64 / arm64 builds and didn't accidentally create a thin app.
check_arch() {
local archs=($(lipo -archs "$1"))
if [[ ${archs[@]} != "$MACVIM_ARCHS" ]]; then
echo "Wrong arch(s) in $1: ${archs[@]}"; false
else
lipo -info "$1"
fi
}
check_arch "${VIM_BIN}"
check_arch "${MACVIM_BIN}"
- name: Test
timeout-minutes: 20
run: make test
- name: Test GUI
timeout-minutes: 20
run: |
make -C src/testdir clean
make -C src testgui
# Creates a DMG package of MacVim. Note that this doesn't create a GitHub release for us, because we would prefer to
# do it manually, for two reasons: 1) signing / notarization are currently done out of CI, 2) we want to manually
# format our release notes and add pictures to make them look nice.
- name: Build MacVim dmg image
if: startsWith(github.ref, 'refs/tags/') && matrix.publish
run: |
# Use the --skip-jenkins flag to skip the prettify osascript calls which could fail due to permission issues in
# CI environment.
if ${{ matrix.legacy == true }}; then
make -C src macvim-dmg-legacy CREATEDMG_FLAGS=--skip-jenkins
else
make -C src macvim-dmg CREATEDMG_FLAGS=--skip-jenkins
fi
if ${{ matrix.publish_postfix != '' }}; then
mv src/MacVim/build/Release/MacVim.dmg src/MacVim/build/Release/MacVim${{ matrix.publish_postfix }}.dmg
fi
- name: Upload MacVim image
if: startsWith(github.ref, 'refs/tags/') && matrix.publish
uses: actions/upload-artifact@v3
with:
name: MacVim${{ matrix.publish_postfix }}.dmg
path: src/MacVim/build/Release/MacVim${{ matrix.publish_postfix }}.dmg