Skip to content

Commit 5bf293e

Browse files
committed
CI: Organize GitHub Actions
1 parent ec55b8d commit 5bf293e

File tree

1 file changed

+180
-145
lines changed

1 file changed

+180
-145
lines changed

.github/workflows/ci-macvim.yaml

Lines changed: 180 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ env:
88
MACOSX_DEPLOYMENT_TARGET: 10.9
99

1010
CC: clang
11-
CONFOPT: "--with-features=huge --enable-netbeans --with-tlib=ncurses --enable-cscope --enable-gui=macvim --with-macarchs=x86_64"
1211

1312
VERSIONER_PERL_VERSION: 5.18
1413
VERSIONER_PYTHON_VERSION: 2.7
@@ -20,173 +19,209 @@ env:
2019
vi_cv_dll_name_python: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
2120
vi_cv_dll_name_python3: /usr/local/Frameworks/Python.framework/Versions/3.9/Python
2221
vi_cv_dll_name_ruby: /usr/local/opt/ruby/lib/libruby.dylib
23-
LANGOPT: "--enable-perlinterp=dynamic --enable-pythoninterp=dynamic --enable-python3interp=dynamic --enable-rubyinterp=dynamic --enable-luainterp=dynamic --with-lua-prefix=/usr/local"
2422

25-
VIMCMD: src/MacVim/build/Release/MacVim.app/Contents/MacOS/Vim
23+
VIM_BIN: src/MacVim/build/Release/MacVim.app/Contents/MacOS/Vim
2624
MACVIM_BIN: src/MacVim/build/Release/MacVim.app/Contents/MacOS/MacVim
2725

28-
HAS_GETTEXT: 1
29-
3026
TERM: xterm
3127
BASH_SILENCE_DEPRECATION_WARNING: 1
3228

3329
jobs:
34-
3530
# Builds and test MacVim
36-
build:
31+
build-and-test:
3732

3833
# Test on macOS 10.15 / 11.0, and also older version of Xcode for compatibility testing.
3934
strategy:
4035
fail-fast: false
4136
matrix:
42-
xcode: ['']
43-
os: [macos-10.15, macos-11.0]
4437
include:
4538
- os: macos-10.15
4639
xcode: 11.7
4740
- os: macos-10.15
48-
xcode: ''
4941
publish: true
42+
- os: macos-11.0
5043

5144
runs-on: ${{ matrix.os }}
5245

53-
env:
54-
XCODE_VER: ${{ matrix.xcode }}
55-
5646
steps:
57-
- uses: actions/checkout@v2
58-
59-
60-
# Set up and install gettext for localization.
61-
# Instead of using the default binary installed by Homebrew, need to build our own because gettext is statically
62-
# linked in MacVim, and need to be built against MACOSX_DEPLOYMENT_TARGET to ensure the built binary will work on
63-
# supported macOS versions.
64-
- name: Set up gettext
65-
run: |
66-
# Patch the official Homebrew gettext formula to explicitly build for min deployment target
67-
cp /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gettext.rb gettext.rb
68-
69-
cat << EOF > gettext_diff.patch
70-
--- gettext_orig.rb
71-
+++ gettext.rb
72-
@@ -24,2 +24,3 @@
73-
def install
74-
+ ENV["MACOSX_DEPLOYMENT_TARGET"] = "${MACOSX_DEPLOYMENT_TARGET}"
75-
args = [
76-
EOF
77-
78-
patch gettext.rb gettext_diff.patch
79-
80-
# Uninstall the already installed gettext because we want to build our own
81-
brew uninstall --ignore-dependencies gettext
82-
- name: Cache gettext
83-
uses: actions/cache@v2
84-
with:
85-
path: /usr/local/Cellar/gettext
86-
key: gettext-homebrew-cache-${{ runner.os }}-${{ hashFiles('gettext.rb') }}
87-
- name: Install gettext
88-
env:
89-
HOMEBREW_NO_AUTO_UPDATE: 1
90-
run: |
91-
brew install -s gettext.rb # This will be a no-op if gettext was cached
92-
brew link gettext # If gettext was cached, this step is necessary to relink it to /usr/local/
93-
94-
95-
- name: Install packages
96-
env:
97-
HOMEBREW_NO_AUTO_UPDATE: 1
98-
run: |
99-
brew install python
100-
brew install ruby
101-
brew install lua
102-
brew unlink perl # We just use system perl to reduce dependencies
103-
104-
105-
- name: Configure
106-
run: |
107-
set -o errexit
108-
set -o verbose
109-
110-
if [[ -n "${XCODE_VER}" ]]; then
111-
sudo xcode-select -s /Applications/Xcode_${XCODE_VER}.app/Contents/Developer
112-
fi
113-
xcode-select -p
114-
115-
./configure ${CONFOPT} ${LANGOPT} --enable-fail-if-missing
116-
sed -i.bak -f ci/config.mk.sed -f ci/config.mk.clang.sed src/auto/config.mk
117-
# Ruby is keg-only in Homebrew, so need to manually link in the path so Vim will know where to look for the binaries.
118-
perl -p -i -e "s#(?<=-DDYNAMIC_RUBY_DLL=\\\\\").*?(?=\\\\\")#${vi_cv_dll_name_ruby}#" src/auto/config.mk
119-
if [[ -n "${LANGOPT}" ]]; then
47+
- uses: actions/checkout@v2
48+
49+
# Set up and install gettext for localization.
50+
# Instead of using the default binary installed by Homebrew, need to build our own because gettext is statically
51+
# linked in MacVim, and need to be built against MACOSX_DEPLOYMENT_TARGET to ensure the built binary will work on
52+
# supported macOS versions.
53+
- name: Set up gettext
54+
if: matrix.publish
55+
run: |
56+
# Patch the official Homebrew gettext formula to explicitly build for min deployment target
57+
cp /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gettext.rb gettext.rb
58+
59+
cat << EOF > gettext_diff.patch
60+
--- gettext_orig.rb
61+
+++ gettext.rb
62+
@@ -24,2 +24,3 @@
63+
def install
64+
+ ENV["MACOSX_DEPLOYMENT_TARGET"] = "${MACOSX_DEPLOYMENT_TARGET}"
65+
args = [
66+
EOF
67+
68+
patch gettext.rb gettext_diff.patch
69+
70+
# Uninstall the already installed gettext because we want to build our own
71+
brew uninstall --ignore-dependencies gettext
72+
73+
- name: Cache gettext
74+
if: matrix.publish
75+
uses: actions/cache@v2
76+
with:
77+
path: /usr/local/Cellar/gettext
78+
key: gettext-homebrew-cache-${{ runner.os }}-${{ hashFiles('gettext.rb') }}
79+
80+
- name: Install gettext
81+
if: matrix.publish
82+
env:
83+
HOMEBREW_NO_AUTO_UPDATE: 1
84+
run: |
85+
brew install -s gettext.rb # This will be a no-op if gettext was cached
86+
brew link gettext # If gettext was cached, this step is necessary to relink it to /usr/local/
87+
88+
- name: Install packages
89+
if: matrix.publish
90+
env:
91+
HOMEBREW_NO_AUTO_UPDATE: 1
92+
run: |
93+
brew install python
94+
brew install ruby
95+
brew install lua
96+
brew unlink perl # We just use system perl to reduce dependencies
97+
98+
- name: Set up Xcode
99+
if: matrix.xcode != ''
100+
run: |
101+
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
102+
xcode-select -p
103+
104+
- name: Configure
105+
run: |
106+
set -o verbose
107+
108+
CONFOPT=(
109+
--with-features=huge
110+
--enable-netbeans
111+
--with-tlib=ncurses
112+
--enable-cscope
113+
--enable-gui=macvim
114+
--with-macarchs=x86_64
115+
)
116+
if ${{ matrix.publish == true }}; then
117+
CONFOPT+=(
118+
--enable-perlinterp=dynamic
119+
--enable-pythoninterp=dynamic
120+
--enable-python3interp=dynamic
121+
--enable-rubyinterp=dynamic
122+
--enable-luainterp=dynamic
123+
--with-lua-prefix=/usr/local
124+
)
125+
fi
126+
echo "CONFOPT: ${CONFOPT[@]}"
127+
128+
./configure "${CONFOPT[@]}" --enable-fail-if-missing
129+
130+
sed -i.bak -f ci/config.mk.sed -f ci/config.mk.clang.sed src/auto/config.mk
131+
132+
- name: Modify configure result
133+
if: matrix.publish
134+
run: |
135+
# Ruby is keg-only in Homebrew, so need to manually link in the path so Vim will know where to look for the binaries.
136+
perl -p -i -e "s#(?<=-DDYNAMIC_RUBY_DLL=\\\\\").*?(?=\\\\\")#${vi_cv_dll_name_ruby}#" src/auto/config.mk
120137
grep -q -- "-DDYNAMIC_PERL_DLL=\\\\\"${vi_cv_dll_name_perl}\\\\\"" src/auto/config.mk
121138
grep -q -- "-DDYNAMIC_PYTHON_DLL=\\\\\"${vi_cv_dll_name_python}\\\\\"" src/auto/config.mk
122139
grep -q -- "-DDYNAMIC_PYTHON3_DLL=\\\\\"${vi_cv_dll_name_python3}\\\\\"" src/auto/config.mk
123140
grep -q -- "-DDYNAMIC_RUBY_DLL=\\\\\"${vi_cv_dll_name_ruby}\\\\\"" src/auto/config.mk
124-
fi
125-
- name: Show configure output
126-
run: |
127-
cat src/auto/config.mk
128-
cat src/auto/config.h
129-
- name: Make
130-
run: |
131-
set -o errexit
132-
set -o verbose
133-
NPROC=$(getconf _NPROCESSORS_ONLN) && echo "Building MacVim with ${NPROC} cores"
134-
make -j${NPROC}
135-
- name: Check version
136-
run: |
137-
${VIMCMD} --version
138-
${VIMCMD} -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
139-
${VIMCMD} -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
140-
- name: Smoketest
141-
run: |
142-
set -o errexit
143-
set -o verbose
144-
145-
# Smoketest scripting languages
146-
macvim_excmd() {
147-
${VIMCMD} -u NONE -i NONE -g -f -X -V1 -es "$@" -c 'echo ""' -c 'qall!' 2>&1
148-
}
149-
if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'lua print("Test")'; fi
150-
if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'perl VIM::Msg("Test")'; fi
151-
if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'py import sys; print("Test")'; fi
152-
if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'py3 import sys; print("Test")'; fi
153-
if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'ruby puts("Test")'; fi
154-
155-
# Check that localized messages work by printing ':version' and checking against localized word
156-
if [[ -n "${HAS_GETTEXT}" ]]; then macvim_excmd -c 'lang es_ES' -c 'version' | grep Enlazado; fi
157-
158-
# Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use
159-
# 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.
160-
if (otool -L ${VIMCMD} | grep '\.dylib\s' | grep -v '^\s*/usr/lib/'); then echo 'Found external dynamic linkage!' && exit 1; fi
161-
162-
# Make sure we are building x86_64 only. arm64 builds don't work properly now, so we don't want to accidentally build
163-
# it as it will get prioritized by Apple Silicon Macs.
164-
(lipo -archs ${VIMCMD} | grep '^x86_64$')
165-
(lipo -archs ${MACVIM_BIN} | grep '^x86_64$')
166-
167-
- name: Update Vim help tags
168-
run: make -C runtime/doc vimtags VIMEXE=../../src/MacVim/build/Release/MacVim.app/Contents/bin/vim
169-
170-
- name: Test
171-
timeout-minutes: 20
172-
run: make test
173-
- name: Test GUI
174-
timeout-minutes: 20
175-
run: make -C src/testdir clean && make -C src testgui
176-
177-
# Creates a DMG package of MacVim. Note that this doesn't create a GitHub release for us, because we would prefer to
178-
# do it manually, for two reasons: 1) signing / notarization are currently done out of CI, 2) we want to manually
179-
# format our release notes and add pictures to make them look nice.
180-
- name: Build MacVim dmg image
181-
if: startsWith(github.ref, 'refs/tags/') && matrix.publish
182-
run: |
183-
# Use the --skip-jenkins flag to skip the prettify osascript calls which could fail due to permission issues in
184-
# CI environment.
185-
make -C src macvim-dmg CREATEDMG_FLAGS=--skip-jenkins
186-
187-
- name: Upload MacVim image
188-
if: startsWith(github.ref, 'refs/tags/') && matrix.publish
189-
uses: actions/upload-artifact@v2
190-
with:
191-
name: MacVim.dmg
192-
path: src/MacVim/build/Release/MacVim.dmg
141+
142+
- name: Show configure output
143+
run: |
144+
cat src/auto/config.mk
145+
cat src/auto/config.h
146+
147+
- name: Build
148+
run: |
149+
set -o verbose
150+
151+
NPROC=$(getconf _NPROCESSORS_ONLN)
152+
echo "Building MacVim with ${NPROC} cores"
153+
154+
make -j${NPROC}
155+
156+
- name: Check version
157+
run: |
158+
${VIM_BIN} --version
159+
${VIM_BIN} -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
160+
${VIM_BIN} -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
161+
162+
- name: Smoketest
163+
if: matrix.publish
164+
run: |
165+
set -o verbose
166+
167+
macvim_excmd() {
168+
${VIM_BIN} -u NONE -i NONE -g -f -X -V1 -es "$@" -c 'echo ""' -c 'qall!' 2>&1
169+
}
170+
171+
# Smoketest scripting languages
172+
macvim_excmd -c 'lua print("Test")'
173+
macvim_excmd -c 'perl VIM::Msg("Test")'
174+
macvim_excmd -c 'py import sys; print("Test")'
175+
macvim_excmd -c 'py3 import sys; print("Test")'
176+
macvim_excmd -c 'ruby puts("Test")'
177+
178+
# Check that localized messages work by printing ':version' and checking against localized word
179+
macvim_excmd -c 'lang es_ES' -c 'version' | grep Enlazado
180+
181+
# Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use
182+
# 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.
183+
if otool -L ${VIM_BIN} | grep '\.dylib\s' | grep -v '^\s*/usr/lib/'; then
184+
echo 'Found external dynamic linkage!'; false
185+
fi
186+
187+
# Make sure we are building x86_64 only. arm64 builds don't work properly now, so we don't want to accidentally build
188+
# it as it will get prioritized by Apple Silicon Macs.
189+
check_arch() {
190+
local archs=($(lipo -archs "$1"))
191+
if [[ ${archs[@]} != x86_64 ]]; then
192+
echo "Found unexpected arch(s) in $1: ${archs[@]}"; false
193+
fi
194+
}
195+
check_arch "${VIM_BIN}"
196+
check_arch "${MACVIM_BIN}"
197+
198+
- name: Update Vim help tags
199+
if: matrix.publish
200+
run: make -C runtime/doc vimtags VIMEXE=../../${VIM_BIN}
201+
202+
- name: Test
203+
timeout-minutes: 20
204+
run: make test
205+
206+
- name: Test GUI
207+
timeout-minutes: 20
208+
run: |
209+
make -C src/testdir clean
210+
make -C src testgui
211+
212+
# Creates a DMG package of MacVim. Note that this doesn't create a GitHub release for us, because we would prefer to
213+
# do it manually, for two reasons: 1) signing / notarization are currently done out of CI, 2) we want to manually
214+
# format our release notes and add pictures to make them look nice.
215+
- name: Build MacVim dmg image
216+
if: startsWith(github.ref, 'refs/tags/') && matrix.publish
217+
run: |
218+
# Use the --skip-jenkins flag to skip the prettify osascript calls which could fail due to permission issues in
219+
# CI environment.
220+
make -C src macvim-dmg CREATEDMG_FLAGS=--skip-jenkins
221+
222+
- name: Upload MacVim image
223+
if: startsWith(github.ref, 'refs/tags/') && matrix.publish
224+
uses: actions/upload-artifact@v2
225+
with:
226+
name: MacVim.dmg
227+
path: src/MacVim/build/Release/MacVim.dmg

0 commit comments

Comments
 (0)