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