Bram Moolenaar | ac7bf8c | 2020-07-29 17:43:55 +0200 | [diff] [blame] | 1 | name: GitHub CI |
Bram Moolenaar | f9a343f | 2020-07-29 16:32:21 +0200 | [diff] [blame] | 2 | |
| 3 | on: |
| 4 | push: |
Bram Moolenaar | 7b7f78f | 2020-07-29 19:29:23 +0200 | [diff] [blame] | 5 | branches: |
| 6 | - '*' |
Bram Moolenaar | f9a343f | 2020-07-29 16:32:21 +0200 | [diff] [blame] | 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 | |
Bram Moolenaar | 7d69796 | 2020-08-31 21:30:32 +0200 | [diff] [blame^] | 130 | - name: Copy src directory to src2 |
| 131 | shell: cmd |
| 132 | run: | |
| 133 | xcopy src src2\ /E > nul |
| 134 | |
Bram Moolenaar | f9a343f | 2020-07-29 16:32:21 +0200 | [diff] [blame] | 135 | - name: Build (MSVC) |
| 136 | if: matrix.toolchain == 'msvc' |
| 137 | shell: cmd |
| 138 | run: | |
| 139 | call "%VCVARSALL%" ${{ matrix.vcarch }} |
| 140 | cd src |
| 141 | :: Filter out the progress bar from the build log |
| 142 | sed -e "s/@<<$/@<< | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak |
| 143 | if "${{ matrix.features }}"=="HUGE" ( |
| 144 | nmake -nologo -f Make_mvc2.mak ^ |
| 145 | FEATURES=${{ matrix.features }} ^ |
| 146 | GUI=yes IME=yes ICONV=yes VIMDLL=yes ^ |
| 147 | DYNAMIC_LUA=yes LUA=%LUA_DIR% ^ |
| 148 | DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^ |
| 149 | DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% |
| 150 | ) else ( |
| 151 | nmake -nologo -f Make_mvc2.mak ^ |
| 152 | FEATURES=${{ matrix.features }} ^ |
| 153 | GUI=yes IME=yes ICONV=yes VIMDLL=yes |
| 154 | ) |
| 155 | if not exist vim${{ matrix.bits }}.dll ( |
| 156 | echo %COL_RED%Build failure.%COL_RESET% |
| 157 | exit 1 |
| 158 | ) |
| 159 | |
| 160 | - name: Build (MinGW) |
| 161 | if: matrix.toolchain == 'mingw' |
| 162 | shell: msys2 {0} |
| 163 | run: | |
| 164 | cd src |
| 165 | if [ "${{ matrix.features }}" = "HUGE" ]; then |
| 166 | mingw32-make -f Make_ming.mak -j2 \ |
| 167 | FEATURES=${{ matrix.features }} \ |
| 168 | GUI=yes IME=yes ICONV=yes VIMDLL=yes \ |
| 169 | DYNAMIC_LUA=yes LUA=${LUA_DIR} \ |
| 170 | DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \ |
| 171 | DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \ |
| 172 | STATIC_STDCPLUS=yes |
| 173 | else |
| 174 | mingw32-make -f Make_ming.mak -j2 \ |
| 175 | FEATURES=${{ matrix.features }} \ |
| 176 | GUI=yes IME=yes ICONV=yes VIMDLL=yes \ |
| 177 | STATIC_STDCPLUS=yes |
| 178 | fi |
| 179 | |
| 180 | # - name: Prepare Artifact |
| 181 | # shell: cmd |
| 182 | # run: | |
| 183 | # mkdir artifacts |
| 184 | # copy src\*vim.exe artifacts |
| 185 | # copy src\vim*.dll artifacts |
| 186 | # |
| 187 | # - name: Upload Artifact |
| 188 | # uses: actions/upload-artifact@v1 |
| 189 | # with: |
| 190 | # name: vim${{ matrix.bits }}-${{ matrix.toolchain }} |
| 191 | # path: ./artifacts |
| 192 | |
| 193 | - name: Test |
| 194 | shell: cmd |
| 195 | timeout-minutes: 20 |
| 196 | run: | |
| 197 | PATH %LUA_DIR%;C:\msys64\${{ matrix.msystem }}\bin;%PATH%;%PYTHON3_DIR% |
| 198 | call "%VCVARSALL%" ${{ matrix.vcarch }} |
| 199 | cd src |
| 200 | echo. |
| 201 | echo %COL_GREEN%vim version:%COL_RESET% |
| 202 | .\vim --version || exit 1 |
Bram Moolenaar | 3a53ec8 | 2020-07-31 22:17:32 +0200 | [diff] [blame] | 203 | |
Bram Moolenaar | 3a53ec8 | 2020-07-31 22:17:32 +0200 | [diff] [blame] | 204 | echo %COL_GREEN%Start testing vim in background.%COL_RESET% |
| 205 | start cmd /c "cd ..\src2\testdir & nmake -nologo -f Make_dos.mak VIMPROG=..\..\src\vim > nul & echo done>done.txt" |
| 206 | |
Bram Moolenaar | f9a343f | 2020-07-29 16:32:21 +0200 | [diff] [blame] | 207 | echo %COL_GREEN%Test gvim:%COL_RESET% |
Bram Moolenaar | 3a53ec8 | 2020-07-31 22:17:32 +0200 | [diff] [blame] | 208 | cd testdir |
Bram Moolenaar | f9a343f | 2020-07-29 16:32:21 +0200 | [diff] [blame] | 209 | nmake -nologo -f Make_dos.mak VIMPROG=..\gvim || exit 1 |
Bram Moolenaar | 3a53ec8 | 2020-07-31 22:17:32 +0200 | [diff] [blame] | 210 | cd .. |
| 211 | |
| 212 | echo %COL_GREEN%Wait for vim tests to finish.%COL_RESET% |
| 213 | cd ..\src2\testdir |
Bram Moolenaar | b53da79 | 2020-08-01 12:26:04 +0200 | [diff] [blame] | 214 | :: Wait about 10 minutes. |
| 215 | for /L %%i in (1,1,600) do ( |
Bram Moolenaar | 3a53ec8 | 2020-07-31 22:17:32 +0200 | [diff] [blame] | 216 | if exist done.txt goto exitloop |
| 217 | ping -n 2 localhost > nul |
Bram Moolenaar | f9a343f | 2020-07-29 16:32:21 +0200 | [diff] [blame] | 218 | ) |
Bram Moolenaar | b53da79 | 2020-08-01 12:26:04 +0200 | [diff] [blame] | 219 | set timeout=1 |
Bram Moolenaar | 3a53ec8 | 2020-07-31 22:17:32 +0200 | [diff] [blame] | 220 | :exitloop |
| 221 | |
| 222 | echo %COL_GREEN%Test results of vim:%COL_RESET% |
| 223 | if exist messages type messages |
| 224 | nmake -nologo -f Make_dos.mak report VIMPROG=..\..\src\vim || exit 1 |
Bram Moolenaar | b53da79 | 2020-08-01 12:26:04 +0200 | [diff] [blame] | 225 | if "%timeout%"=="1" ( |
| 226 | echo %COL_RED%Timed out.%COL_RESET% |
| 227 | exit 1 |
| 228 | ) |