blob: 4a470624b893fc28afcfcb6bb152601460449b27 [file] [log] [blame]
Bram Moolenaarac7bf8c2020-07-29 17:43:55 +02001name: GitHub CI
Bram Moolenaarf9a343f2020-07-29 16:32:21 +02002
3on:
4 push:
Bram Moolenaar7b7f78f2020-07-29 19:29:23 +02005 branches:
Bram Moolenaar15ab48f2020-10-22 17:33:17 +02006 - '**'
Bram Moolenaarf9a343f2020-07-29 16:32:21 +02007 pull_request:
8
9env:
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
37jobs:
38 build:
39 runs-on: windows-latest
40
41 strategy:
Bram Moolenaar15ab48f2020-10-22 17:33:17 +020042 fail-fast: false
Bram Moolenaarf9a343f2020-07-29 16:32:21 +020043 matrix:
44 toolchain: [msvc, mingw]
45 arch: [x64, x86]
46 features: [HUGE, NORMAL]
47 include:
48 - arch: x64
49 vcarch: amd64
50 warch: x64
51 bits: 64
52 msystem: MINGW64
53 cygreg: registry
54 pyreg: ""
55 - arch: x86
56 vcarch: x86
57 warch: ia32
58 bits: 32
59 msystem: MINGW32
60 cygreg: registry32
61 pyreg: "-32"
62 exclude:
63 - toolchain: msvc
64 arch: x64
65 features: NORMAL
66 - toolchain: mingw
67 arch: x86
68 features: NORMAL
69
70 steps:
71 - name: Initalize
72 id: init
73 shell: bash
74 run: |
75 git config --global core.autocrlf input
76 python_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON_VER_DOT}/InstallPath/@")
77 python3_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}${{ matrix.pyreg }}/InstallPath/@")
Bram Moolenaarbd6428b2020-10-10 22:34:36 +020078 echo "PYTHON_DIR=$python_dir" >> $GITHUB_ENV
79 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
Bram Moolenaarf9a343f2020-07-29 16:32:21 +020080
81 - uses: msys2/setup-msys2@v2
82 if: matrix.toolchain == 'mingw'
83 with:
84 msystem: ${{ matrix.msystem }}
85 release: false
86
87 - uses: actions/checkout@v2
88
89 - name: Create a list of download URLs
90 shell: cmd
91 run: |
92 type NUL > urls.txt
93 echo %LUA_RELEASE%>> urls.txt
94 echo %WINPTY_URL%>> urls.txt
95
96 - name: Cache downloaded files
97 uses: actions/cache@v2
98 with:
99 path: downloads
100 key: ${{ runner.os }}-${{ matrix.bits }}-${{ hashFiles('urls.txt') }}
101
102 - name: Download dependencies
103 shell: cmd
104 run: |
105 path C:\Program Files\7-Zip;%path%
106 if not exist downloads mkdir downloads
107
108 echo %COL_GREEN%Download Lua%COL_RESET%
109 call :downloadfile %LUA${{ matrix.bits }}_URL% downloads\lua.zip
110 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
111
112 echo %COL_GREEN%Download winpty%COL_RESET%
113 call :downloadfile %WINPTY_URL% downloads\winpty.zip
114 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
115 copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty.dll src\winpty${{ matrix.bits }}.dll
116 copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty-agent.exe src\
117
118 goto :eof
119
120 :downloadfile
121 :: call :downloadfile <URL> <localfile>
122 if not exist %2 (
123 curl -f -L %1 -o %2
124 )
125 if ERRORLEVEL 1 (
126 rem Retry once.
127 curl -f -L %1 -o %2 || exit 1
128 )
129 goto :eof
130
Bram Moolenaar7d697962020-08-31 21:30:32 +0200131 - name: Copy src directory to src2
132 shell: cmd
133 run: |
134 xcopy src src2\ /E > nul
135
Bram Moolenaarf9a343f2020-07-29 16:32:21 +0200136 - name: Build (MSVC)
137 if: matrix.toolchain == 'msvc'
138 shell: cmd
139 run: |
140 call "%VCVARSALL%" ${{ matrix.vcarch }}
141 cd src
142 :: Filter out the progress bar from the build log
143 sed -e "s/@<<$/@<< | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak
144 if "${{ matrix.features }}"=="HUGE" (
145 nmake -nologo -f Make_mvc2.mak ^
146 FEATURES=${{ matrix.features }} ^
147 GUI=yes IME=yes ICONV=yes VIMDLL=yes ^
148 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
149 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
150 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
151 ) else (
152 nmake -nologo -f Make_mvc2.mak ^
153 FEATURES=${{ matrix.features }} ^
154 GUI=yes IME=yes ICONV=yes VIMDLL=yes
155 )
156 if not exist vim${{ matrix.bits }}.dll (
157 echo %COL_RED%Build failure.%COL_RESET%
158 exit 1
159 )
160
161 - name: Build (MinGW)
162 if: matrix.toolchain == 'mingw'
163 shell: msys2 {0}
164 run: |
165 cd src
166 if [ "${{ matrix.features }}" = "HUGE" ]; then
167 mingw32-make -f Make_ming.mak -j2 \
168 FEATURES=${{ matrix.features }} \
169 GUI=yes IME=yes ICONV=yes VIMDLL=yes \
170 DYNAMIC_LUA=yes LUA=${LUA_DIR} \
171 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
172 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
173 STATIC_STDCPLUS=yes
174 else
175 mingw32-make -f Make_ming.mak -j2 \
176 FEATURES=${{ matrix.features }} \
177 GUI=yes IME=yes ICONV=yes VIMDLL=yes \
178 STATIC_STDCPLUS=yes
179 fi
180
181# - name: Prepare Artifact
182# shell: cmd
183# run: |
184# mkdir artifacts
185# copy src\*vim.exe artifacts
186# copy src\vim*.dll artifacts
187#
188# - name: Upload Artifact
189# uses: actions/upload-artifact@v1
190# with:
191# name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
192# path: ./artifacts
193
194 - name: Test
195 shell: cmd
196 timeout-minutes: 20
197 run: |
198 PATH %LUA_DIR%;C:\msys64\${{ matrix.msystem }}\bin;%PATH%;%PYTHON3_DIR%
199 call "%VCVARSALL%" ${{ matrix.vcarch }}
200 cd src
201 echo.
202 echo %COL_GREEN%vim version:%COL_RESET%
203 .\vim --version || exit 1
Bram Moolenaar3a53ec82020-07-31 22:17:32 +0200204
Bram Moolenaar3a53ec82020-07-31 22:17:32 +0200205 echo %COL_GREEN%Start testing vim in background.%COL_RESET%
206 start cmd /c "cd ..\src2\testdir & nmake -nologo -f Make_dos.mak VIMPROG=..\..\src\vim > nul & echo done>done.txt"
207
Bram Moolenaarf9a343f2020-07-29 16:32:21 +0200208 echo %COL_GREEN%Test gvim:%COL_RESET%
Bram Moolenaar3a53ec82020-07-31 22:17:32 +0200209 cd testdir
Bram Moolenaarf9a343f2020-07-29 16:32:21 +0200210 nmake -nologo -f Make_dos.mak VIMPROG=..\gvim || exit 1
Bram Moolenaar3a53ec82020-07-31 22:17:32 +0200211 cd ..
212
213 echo %COL_GREEN%Wait for vim tests to finish.%COL_RESET%
214 cd ..\src2\testdir
Bram Moolenaarb53da792020-08-01 12:26:04 +0200215 :: Wait about 10 minutes.
Bram Moolenaar851d1082020-09-23 22:27:22 +0200216 for /L %%i in (1,1,60) do (
Bram Moolenaar3a53ec82020-07-31 22:17:32 +0200217 if exist done.txt goto exitloop
Bram Moolenaar5ee09812020-11-25 12:43:28 +0100218 timeout 10 > NUL 2>&1
219 if ERRORLEVEL 1 ping -n 11 localhost > NUL
Bram Moolenaarf9a343f2020-07-29 16:32:21 +0200220 )
Bram Moolenaarb53da792020-08-01 12:26:04 +0200221 set timeout=1
Bram Moolenaar3a53ec82020-07-31 22:17:32 +0200222 :exitloop
223
224 echo %COL_GREEN%Test results of vim:%COL_RESET%
225 if exist messages type messages
226 nmake -nologo -f Make_dos.mak report VIMPROG=..\..\src\vim || exit 1
Bram Moolenaarb53da792020-08-01 12:26:04 +0200227 if "%timeout%"=="1" (
228 echo %COL_RED%Timed out.%COL_RESET%
229 exit 1
230 )