|
| 1 | +name: GitHub CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '*' |
| 7 | + pull_request: |
| 8 | + |
| 9 | +env: |
| 10 | + VCVARSALL: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat |
| 11 | + |
| 12 | + # Interfaces |
| 13 | + # Lua |
| 14 | + LUA_VER: 54 |
| 15 | + LUA_VER_DOT: '5.4' |
| 16 | + LUA_RELEASE: 5.4.0 |
| 17 | + LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip |
| 18 | + LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip |
| 19 | + LUA_DIR: D:\Lua |
| 20 | + # Python 2 |
| 21 | + PYTHON_VER: 27 |
| 22 | + PYTHON_VER_DOT: '2.7' |
| 23 | + # Python 3 |
| 24 | + PYTHON3_VER: 38 |
| 25 | + PYTHON3_VER_DOT: '3.8' |
| 26 | + |
| 27 | + # Other dependencies |
| 28 | + # winpty |
| 29 | + WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip |
| 30 | + |
| 31 | + # Escape sequences |
| 32 | + COL_RED: "\x1b[31m" |
| 33 | + COL_GREEN: "\x1b[32m" |
| 34 | + COL_YELLOW: "\x1b[33m" |
| 35 | + COL_RESET: "\x1b[m" |
| 36 | + |
| 37 | +jobs: |
| 38 | + build: |
| 39 | + runs-on: windows-latest |
| 40 | + |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + toolchain: [msvc, mingw] |
| 44 | + arch: [x64, x86] |
| 45 | + features: [HUGE, NORMAL] |
| 46 | + include: |
| 47 | + - arch: x64 |
| 48 | + vcarch: amd64 |
| 49 | + warch: x64 |
| 50 | + bits: 64 |
| 51 | + msystem: MINGW64 |
| 52 | + cygreg: registry |
| 53 | + pyreg: "" |
| 54 | + - arch: x86 |
| 55 | + vcarch: x86 |
| 56 | + warch: ia32 |
| 57 | + bits: 32 |
| 58 | + msystem: MINGW32 |
| 59 | + cygreg: registry32 |
| 60 | + pyreg: "-32" |
| 61 | + exclude: |
| 62 | + - toolchain: msvc |
| 63 | + arch: x64 |
| 64 | + features: NORMAL |
| 65 | + - toolchain: mingw |
| 66 | + arch: x86 |
| 67 | + features: NORMAL |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Initalize |
| 71 | + id: init |
| 72 | + shell: bash |
| 73 | + run: | |
| 74 | + git config --global core.autocrlf input |
| 75 | + python_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON_VER_DOT}/InstallPath/@") |
| 76 | + python3_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}${{ matrix.pyreg }}/InstallPath/@") |
| 77 | + echo "::set-env name=PYTHON_DIR::$python_dir" |
| 78 | + echo "::set-env name=PYTHON3_DIR::$python3_dir" |
| 79 | +
|
| 80 | + - uses: msys2/setup-msys2@v2 |
| 81 | + if: matrix.toolchain == 'mingw' |
| 82 | + with: |
| 83 | + msystem: ${{ matrix.msystem }} |
| 84 | + release: false |
| 85 | + |
| 86 | + - uses: actions/checkout@v2 |
| 87 | + |
| 88 | + - name: Create a list of download URLs |
| 89 | + shell: cmd |
| 90 | + run: | |
| 91 | + type NUL > urls.txt |
| 92 | + echo %LUA_RELEASE%>> urls.txt |
| 93 | + echo %WINPTY_URL%>> urls.txt |
| 94 | +
|
| 95 | + - name: Cache downloaded files |
| 96 | + uses: actions/cache@v2 |
| 97 | + with: |
| 98 | + path: downloads |
| 99 | + key: ${{ runner.os }}-${{ matrix.bits }}-${{ hashFiles('urls.txt') }} |
| 100 | + |
| 101 | + - name: Download dependencies |
| 102 | + shell: cmd |
| 103 | + run: | |
| 104 | + path C:\Program Files\7-Zip;%path% |
| 105 | + if not exist downloads mkdir downloads |
| 106 | +
|
| 107 | + echo %COL_GREEN%Download Lua%COL_RESET% |
| 108 | + call :downloadfile %LUA${{ matrix.bits }}_URL% downloads\lua.zip |
| 109 | + 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1 |
| 110 | +
|
| 111 | + echo %COL_GREEN%Download winpty%COL_RESET% |
| 112 | + call :downloadfile %WINPTY_URL% downloads\winpty.zip |
| 113 | + 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1 |
| 114 | + copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty.dll src\winpty${{ matrix.bits }}.dll |
| 115 | + copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty-agent.exe src\ |
| 116 | +
|
| 117 | + goto :eof |
| 118 | +
|
| 119 | + :downloadfile |
| 120 | + :: call :downloadfile <URL> <localfile> |
| 121 | + if not exist %2 ( |
| 122 | + curl -f -L %1 -o %2 |
| 123 | + ) |
| 124 | + if ERRORLEVEL 1 ( |
| 125 | + rem Retry once. |
| 126 | + curl -f -L %1 -o %2 || exit 1 |
| 127 | + ) |
| 128 | + goto :eof |
| 129 | +
|
| 130 | + - name: Build (MSVC) |
| 131 | + if: matrix.toolchain == 'msvc' |
| 132 | + shell: cmd |
| 133 | + run: | |
| 134 | + call "%VCVARSALL%" ${{ matrix.vcarch }} |
| 135 | + cd src |
| 136 | + :: Filter out the progress bar from the build log |
| 137 | + sed -e "s/@<<$/@<< | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak |
| 138 | + if "${{ matrix.features }}"=="HUGE" ( |
| 139 | + nmake -nologo -f Make_mvc2.mak ^ |
| 140 | + FEATURES=${{ matrix.features }} ^ |
| 141 | + GUI=yes IME=yes ICONV=yes VIMDLL=yes ^ |
| 142 | + DYNAMIC_LUA=yes LUA=%LUA_DIR% ^ |
| 143 | + DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^ |
| 144 | + DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% |
| 145 | + ) else ( |
| 146 | + nmake -nologo -f Make_mvc2.mak ^ |
| 147 | + FEATURES=${{ matrix.features }} ^ |
| 148 | + GUI=yes IME=yes ICONV=yes VIMDLL=yes |
| 149 | + ) |
| 150 | + if not exist vim${{ matrix.bits }}.dll ( |
| 151 | + echo %COL_RED%Build failure.%COL_RESET% |
| 152 | + exit 1 |
| 153 | + ) |
| 154 | +
|
| 155 | + - name: Build (MinGW) |
| 156 | + if: matrix.toolchain == 'mingw' |
| 157 | + shell: msys2 {0} |
| 158 | + run: | |
| 159 | + cd src |
| 160 | + if [ "${{ matrix.features }}" = "HUGE" ]; then |
| 161 | + mingw32-make -f Make_ming.mak -j2 \ |
| 162 | + FEATURES=${{ matrix.features }} \ |
| 163 | + GUI=yes IME=yes ICONV=yes VIMDLL=yes \ |
| 164 | + DYNAMIC_LUA=yes LUA=${LUA_DIR} \ |
| 165 | + DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \ |
| 166 | + DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \ |
| 167 | + STATIC_STDCPLUS=yes |
| 168 | + else |
| 169 | + mingw32-make -f Make_ming.mak -j2 \ |
| 170 | + FEATURES=${{ matrix.features }} \ |
| 171 | + GUI=yes IME=yes ICONV=yes VIMDLL=yes \ |
| 172 | + STATIC_STDCPLUS=yes |
| 173 | + fi |
| 174 | +
|
| 175 | +# - name: Prepare Artifact |
| 176 | +# shell: cmd |
| 177 | +# run: | |
| 178 | +# mkdir artifacts |
| 179 | +# copy src\*vim.exe artifacts |
| 180 | +# copy src\vim*.dll artifacts |
| 181 | +# |
| 182 | +# - name: Upload Artifact |
| 183 | +# uses: actions/upload-artifact@v1 |
| 184 | +# with: |
| 185 | +# name: vim${{ matrix.bits }}-${{ matrix.toolchain }} |
| 186 | +# path: ./artifacts |
| 187 | + |
| 188 | + - name: Test |
| 189 | + shell: cmd |
| 190 | + timeout-minutes: 20 |
| 191 | + run: | |
| 192 | + PATH %LUA_DIR%;C:\msys64\${{ matrix.msystem }}\bin;%PATH%;%PYTHON3_DIR% |
| 193 | + call "%VCVARSALL%" ${{ matrix.vcarch }} |
| 194 | + cd src |
| 195 | + echo. |
| 196 | + echo %COL_GREEN%vim version:%COL_RESET% |
| 197 | + .\vim --version || exit 1 |
| 198 | +
|
| 199 | + mkdir ..\src2 |
| 200 | + xcopy testdir ..\src2\testdir\ /E > nul || exit 1 |
| 201 | + copy evalfunc.c ..\src2 > nul |
| 202 | +
|
| 203 | + echo %COL_GREEN%Start testing vim in background.%COL_RESET% |
| 204 | + start cmd /c "cd ..\src2\testdir & nmake -nologo -f Make_dos.mak VIMPROG=..\..\src\vim > nul & echo done>done.txt" |
| 205 | +
|
| 206 | + echo %COL_GREEN%Test gvim:%COL_RESET% |
| 207 | + cd testdir |
| 208 | + nmake -nologo -f Make_dos.mak VIMPROG=..\gvim || exit 1 |
| 209 | + cd .. |
| 210 | +
|
| 211 | + echo %COL_GREEN%Wait for vim tests to finish.%COL_RESET% |
| 212 | + cd ..\src2\testdir |
| 213 | + :: Wait about 10 minutes. |
| 214 | + for /L %%i in (1,1,600) do ( |
| 215 | + if exist done.txt goto exitloop |
| 216 | + ping -n 2 localhost > nul |
| 217 | + ) |
| 218 | + set timeout=1 |
| 219 | + :exitloop |
| 220 | +
|
| 221 | + echo %COL_GREEN%Test results of vim:%COL_RESET% |
| 222 | + if exist messages type messages |
| 223 | + nmake -nologo -f Make_dos.mak report VIMPROG=..\..\src\vim || exit 1 |
| 224 | + if "%timeout%"=="1" ( |
| 225 | + echo %COL_RED%Timed out.%COL_RESET% |
| 226 | + exit 1 |
| 227 | + ) |
0 commit comments