|
| 1 | +name: MacVim GitHub CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +env: |
| 8 | + MACOSX_DEPLOYMENT_TARGET: 10.9 |
| 9 | + |
| 10 | + VERSIONER_PERL_VERSION: 5.18 |
| 11 | + VERSIONER_PYTHON_VERSION: 2.7 |
| 12 | + vi_cv_path_python: /usr/bin/python |
| 13 | + vi_cv_path_python3: /usr/local/bin/python3 |
| 14 | + vi_cv_path_plain_lua: /usr/local/bin/lua |
| 15 | + vi_cv_path_ruby: /usr/local/opt/ruby/bin/ruby |
| 16 | + vi_cv_dll_name_perl: /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/libperl.dylib |
| 17 | + vi_cv_dll_name_python: /System/Library/Frameworks/Python.framework/Versions/2.7/Python |
| 18 | + vi_cv_dll_name_python3: /usr/local/Frameworks/Python.framework/Versions/3.9/Python |
| 19 | + vi_cv_dll_name_ruby: /usr/local/opt/ruby/lib/libruby.dylib |
| 20 | + |
| 21 | + VIMCMD: src/MacVim/build/Release/MacVim.app/Contents/MacOS/Vim |
| 22 | + MACVIM_BIN: src/MacVim/build/Release/MacVim.app/Contents/MacOS/MacVim |
| 23 | + |
| 24 | + CONFOPT: "--with-features=huge --enable-netbeans --with-tlib=ncurses --enable-cscope --enable-gui=macvim --with-macarchs=x86_64" |
| 25 | + LANGOPT: "--enable-perlinterp=dynamic --enable-pythoninterp=dynamic --enable-python3interp=dynamic --enable-rubyinterp=dynamic --enable-luainterp=dynamic --with-lua-prefix=/usr/local" |
| 26 | + |
| 27 | + HAS_GETTEXT: 1 |
| 28 | + |
| 29 | + BASH_SILENCE_DEPRECATION_WARNING: 1 |
| 30 | + |
| 31 | +jobs: |
| 32 | + |
| 33 | + # Builds and test MacVim |
| 34 | + build: |
| 35 | + runs-on: macos-latest |
| 36 | + |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + |
| 40 | + |
| 41 | + # Set up and install gettext for localization. |
| 42 | + # Instead of using the default binary installed by Homebrew, need to build our own because gettext is statically |
| 43 | + # linked in MacVim, and need to be built against MACOSX_DEPLOYMENT_TARGET to ensure the built binary will work on |
| 44 | + # supported macOS versions. |
| 45 | + - name: Set up gettext |
| 46 | + run: | |
| 47 | + # Patch the official Homebrew gettext formula to explicitly build for min deployment target |
| 48 | + cp /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gettext.rb gettext.rb |
| 49 | +
|
| 50 | + cat << EOF > gettext_diff.patch |
| 51 | + --- gettext_orig.rb |
| 52 | + +++ gettext.rb |
| 53 | + @@ -24,2 +24,3 @@ |
| 54 | + def install |
| 55 | + + ENV["MACOSX_DEPLOYMENT_TARGET"] = "${MACOSX_DEPLOYMENT_TARGET}" |
| 56 | + args = [ |
| 57 | + EOF |
| 58 | +
|
| 59 | + patch gettext.rb gettext_diff.patch |
| 60 | +
|
| 61 | + # Uninstall the already installed gettext because we want to build our own |
| 62 | + brew uninstall --ignore-dependencies gettext |
| 63 | + - name: Cache gettext |
| 64 | + uses: actions/cache@v2 |
| 65 | + with: |
| 66 | + path: /usr/local/Cellar/gettext |
| 67 | + key: gettext-homebrew-cache-${{ runner.os }}-${{ hashFiles('gettext.rb') }} |
| 68 | + - name: Install gettext |
| 69 | + env: |
| 70 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 71 | + run: | |
| 72 | + brew install -s gettext.rb # This will be a no-op if gettext was cached |
| 73 | + brew link gettext # If gettext was cached, this step is necessary to relink it to /usr/local/ |
| 74 | +
|
| 75 | +
|
| 76 | + - name: Install packages |
| 77 | + env: |
| 78 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 79 | + run: | |
| 80 | + brew install python |
| 81 | + brew install ruby |
| 82 | + brew install lua |
| 83 | + brew unlink perl # We just use system perl to reduce dependencies |
| 84 | +
|
| 85 | +
|
| 86 | + - name: Configure |
| 87 | + run: | |
| 88 | + set -o errexit |
| 89 | + set -o verbose |
| 90 | +
|
| 91 | + ./configure ${CONFOPT} ${LANGOPT} --enable-fail-if-missing |
| 92 | + sed -i.bak -f ci/config.mk.sed -f ci/config.mk.clang.sed src/auto/config.mk |
| 93 | + # Ruby is keg-only in Homebrew, so need to manually link in the path so Vim will know where to look for the binaries. |
| 94 | + perl -p -i -e "s#(?<=-DDYNAMIC_RUBY_DLL=\\\\\").*?(?=\\\\\")#${vi_cv_dll_name_ruby}#" src/auto/config.mk |
| 95 | + if [[ -n "${LANGOPT}" ]]; then |
| 96 | + grep -q -- "-DDYNAMIC_PERL_DLL=\\\\\"${vi_cv_dll_name_perl}\\\\\"" src/auto/config.mk |
| 97 | + grep -q -- "-DDYNAMIC_PYTHON_DLL=\\\\\"${vi_cv_dll_name_python}\\\\\"" src/auto/config.mk |
| 98 | + grep -q -- "-DDYNAMIC_PYTHON3_DLL=\\\\\"${vi_cv_dll_name_python3}\\\\\"" src/auto/config.mk |
| 99 | + grep -q -- "-DDYNAMIC_RUBY_DLL=\\\\\"${vi_cv_dll_name_ruby}\\\\\"" src/auto/config.mk |
| 100 | + fi |
| 101 | + - name: Show configure output |
| 102 | + run: | |
| 103 | + cat src/auto/config.mk |
| 104 | + cat src/auto/config.h |
| 105 | + - name: Make |
| 106 | + run: | |
| 107 | + set -o errexit |
| 108 | + set -o verbose |
| 109 | + NPROC=$(getconf _NPROCESSORS_ONLN) && echo "Building MacVim with ${NPROC} cores" |
| 110 | + make -j${NPROC} |
| 111 | + - name: Show Vim version |
| 112 | + run: ${VIMCMD} --version |
| 113 | + - name: Smoketest |
| 114 | + run: | |
| 115 | + set -o errexit |
| 116 | + set -o verbose |
| 117 | +
|
| 118 | + # Smoketest scripting languages |
| 119 | + macvim_excmd() { |
| 120 | + ${VIMCMD} -u NONE -i NONE -g -f -X -V1 -es "$@" -c 'echo ""' -c 'qall!' 2>&1 |
| 121 | + } |
| 122 | + if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'lua print("Test")'; fi |
| 123 | + if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'perl VIM::Msg("Test")'; fi |
| 124 | + if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'py import sys; print("Test")'; fi |
| 125 | + if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'py3 import sys; print("Test")'; fi |
| 126 | + if [[ -n "${LANGOPT}" ]]; then macvim_excmd -c 'ruby puts("Test")'; fi |
| 127 | +
|
| 128 | + # Check that localized messages work by printing ':version' and checking against localized word |
| 129 | + if [[ -n "${HAS_GETTEXT}" ]]; then macvim_excmd -c 'lang es_ES' -c 'version' | grep Enlazado; fi |
| 130 | +
|
| 131 | + # Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use |
| 132 | + # 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. |
| 133 | + if (otool -L ${VIMCMD} | grep '\.dylib\s' | grep -v '^\s*/usr/lib/'); then echo 'Found external dynamic linkage!' && exit 1; fi |
| 134 | +
|
| 135 | + # Make sure we are building x86_64 only. arm64 builds don't work properly now, so we don't want to accidentally build |
| 136 | + # it as it will get prioritized by Apple Silicon Macs. |
| 137 | + (lipo -archs ${VIMCMD} | grep '^x86_64$') |
| 138 | + (lipo -archs ${MACVIM_BIN} | grep '^x86_64$') |
| 139 | +
|
| 140 | + - name: Update Vim help tags |
| 141 | + run: make -C runtime/doc vimtags VIMEXE=../../src/MacVim/build/Release/MacVim.app/Contents/bin/vim |
| 142 | + |
| 143 | + - name: Test |
| 144 | + if: false # TODO: Tests are failing, turn off temporarily to unblock |
| 145 | + timeout-minutes: 20 |
| 146 | + run: make test |
| 147 | + - name: Test GUI |
| 148 | + if: false # TODO: Tests are failing, turn off temporarily to unblock |
| 149 | + timeout-minutes: 20 |
| 150 | + run: make -C src/testdir clean && make -C src testgui |
| 151 | + |
| 152 | + # Creates a DMG package of MacVim. Note that this doesn't create a GitHub release for us, because we would prefer to |
| 153 | + # do it manually, for two reasons: 1) signing / notarization are currently done out of CI, 2) we want to manually |
| 154 | + # format our release notes and add pictures to make them look nice. |
| 155 | + - name: Build MacVim dmg image |
| 156 | + if: startsWith(github.ref, 'refs/tags/') |
| 157 | + run: | |
| 158 | + # Use the --skip-jenkins flag to skip the prettify osascript calls which could fail due to permission issues in |
| 159 | + # CI environment. |
| 160 | + make -C src macvim-dmg CREATEDMG_FLAGS=--skip-jenkins |
| 161 | +
|
| 162 | + - name: Upload MacVim image |
| 163 | + if: startsWith(github.ref, 'refs/tags/') |
| 164 | + uses: actions/upload-artifact@v2 |
| 165 | + with: |
| 166 | + name: MacVim.dmg |
| 167 | + path: src/MacVim/build/Release/MacVim.dmg |
0 commit comments