diff options
author | luau-project <luau.project@gmail.com> | 2025-03-07 22:04:25 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2025-03-09 20:20:41 -0300 |
commit | 0d6705b1069cc38fda36fc831465485b6cda01b0 (patch) | |
tree | 13f2b5c6204d9d5b6dcc4e05b2ee08785c9fbdb2 | |
parent | ac2a322b59ff612a74bae144fc553b673f2345f6 (diff) | |
download | luarocks-0d6705b1069cc38fda36fc831465485b6cda01b0.tar.gz luarocks-0d6705b1069cc38fda36fc831465485b6cda01b0.tar.bz2 luarocks-0d6705b1069cc38fda36fc831465485b6cda01b0.zip |
ci(windows): add windows job to the testing workflow on GH
-rw-r--r-- | .github/workflows/test.yml | 548 |
1 files changed, 548 insertions, 0 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c1e5d98..46472181 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
@@ -112,3 +112,551 @@ jobs: | |||
112 | ./makedist dev $(dirname $(dirname $(which lua))) | 112 | ./makedist dev $(dirname $(dirname $(which lua))) |
113 | ./smoke_test.sh luarocks-dev.tar.gz binary | 113 | ./smoke_test.sh luarocks-dev.tar.gz binary |
114 | 114 | ||
115 | ############################################################################## | ||
116 | WindowsTest: | ||
117 | runs-on: "windows-latest" | ||
118 | defaults: | ||
119 | run: | ||
120 | shell: cmd | ||
121 | strategy: | ||
122 | fail-fast: false | ||
123 | matrix: | ||
124 | include: | ||
125 | # | ||
126 | # Visual Studio x64 | ||
127 | # | ||
128 | |||
129 | # quick tests | ||
130 | - LUAV: "2.1" | ||
131 | LUAT: "luajit" | ||
132 | COMPILER: "vs" | ||
133 | FILES: "" | ||
134 | EXCLUDE: "integration,unit" | ||
135 | TESTTYPE: "" | ||
136 | ARCH: x64 | ||
137 | # Lua 5.4 tests | ||
138 | - LUAV: "5.4" | ||
139 | LUAT: "lua" | ||
140 | COMPILER: "vs" | ||
141 | FILES: "" | ||
142 | EXCLUDE: "integration,quick" | ||
143 | TESTTYPE: "unit" | ||
144 | ARCH: x64 | ||
145 | - LUAV: "5.4" | ||
146 | LUAT: "lua" | ||
147 | COMPILER: "vs" | ||
148 | FILES: "" | ||
149 | EXCLUDE: "unit,quick" | ||
150 | TESTTYPE: "" | ||
151 | ARCH: x64 | ||
152 | - LUAV: "5.4" | ||
153 | LUAT: "lua" | ||
154 | COMPILER: "vs" | ||
155 | FILES: "spec//build_spec.lua" | ||
156 | EXCLUDE: "" | ||
157 | TESTTYPE: "" | ||
158 | ARCH: x64 | ||
159 | # LuaJIT 2.1 tests | ||
160 | - LUAV: "2.1" | ||
161 | LUAT: "luajit" | ||
162 | COMPILER: "vs" | ||
163 | FILES: "" | ||
164 | EXCLUDE: "integration,quick" | ||
165 | TESTTYPE: "unit" | ||
166 | ARCH: x64 | ||
167 | - LUAV: "2.1" | ||
168 | LUAT: "luajit" | ||
169 | COMPILER: "vs" | ||
170 | FILES: "" | ||
171 | EXCLUDE: "unit,quick" | ||
172 | TESTTYPE: "" | ||
173 | ARCH: x64 | ||
174 | - LUAV: "2.1" | ||
175 | LUAT: "luajit" | ||
176 | COMPILER: "vs" | ||
177 | FILES: "spec//build_spec.lua" | ||
178 | EXCLUDE: "" | ||
179 | TESTTYPE: "" | ||
180 | ARCH: x64 | ||
181 | |||
182 | # | ||
183 | # Visual Studio x86 | ||
184 | # | ||
185 | |||
186 | # quick tests | ||
187 | - LUAV: "2.1" | ||
188 | LUAT: "luajit" | ||
189 | COMPILER: "vs" | ||
190 | FILES: "" | ||
191 | EXCLUDE: "integration,unit" | ||
192 | TESTTYPE: "" | ||
193 | ARCH: x86 | ||
194 | # Lua 5.4 tests | ||
195 | - LUAV: "5.4" | ||
196 | LUAT: "lua" | ||
197 | COMPILER: "vs" | ||
198 | FILES: "" | ||
199 | EXCLUDE: "integration,quick" | ||
200 | TESTTYPE: "unit" | ||
201 | ARCH: x86 | ||
202 | - LUAV: "5.4" | ||
203 | LUAT: "lua" | ||
204 | COMPILER: "vs" | ||
205 | FILES: "" | ||
206 | EXCLUDE: "unit,quick" | ||
207 | TESTTYPE: "" | ||
208 | ARCH: x86 | ||
209 | - LUAV: "5.4" | ||
210 | LUAT: "lua" | ||
211 | COMPILER: "vs" | ||
212 | FILES: "spec//build_spec.lua" | ||
213 | EXCLUDE: "" | ||
214 | TESTTYPE: "" | ||
215 | ARCH: x86 | ||
216 | # LuaJIT 2.1 tests | ||
217 | - LUAV: "2.1" | ||
218 | LUAT: "luajit" | ||
219 | COMPILER: "vs" | ||
220 | FILES: "" | ||
221 | EXCLUDE: "integration,quick" | ||
222 | TESTTYPE: "unit" | ||
223 | ARCH: x86 | ||
224 | - LUAV: "2.1" | ||
225 | LUAT: "luajit" | ||
226 | COMPILER: "vs" | ||
227 | FILES: "" | ||
228 | EXCLUDE: "unit,quick" | ||
229 | TESTTYPE: "" | ||
230 | ARCH: x86 | ||
231 | - LUAV: "2.1" | ||
232 | LUAT: "luajit" | ||
233 | COMPILER: "vs" | ||
234 | FILES: "spec//build_spec.lua" | ||
235 | EXCLUDE: "" | ||
236 | TESTTYPE: "" | ||
237 | ARCH: x86 | ||
238 | |||
239 | # | ||
240 | # MinGW-w64 with Universal C Run Time | ||
241 | # provided by MSYS2 | ||
242 | # | ||
243 | |||
244 | # quick tests | ||
245 | - LUAV: "2.1" | ||
246 | LUAT: "luajit" | ||
247 | COMPILER: "mingw" | ||
248 | FILES: "" | ||
249 | EXCLUDE: "integration,unit" | ||
250 | TESTTYPE: "" | ||
251 | # Lua 5.4 tests | ||
252 | - LUAV: "5.4" | ||
253 | LUAT: "lua" | ||
254 | COMPILER: "mingw" | ||
255 | FILES: "" | ||
256 | EXCLUDE: "integration,quick" | ||
257 | TESTTYPE: "unit" | ||
258 | - LUAV: "5.4" | ||
259 | LUAT: "lua" | ||
260 | COMPILER: "mingw" | ||
261 | FILES: "" | ||
262 | EXCLUDE: "unit,quick" | ||
263 | TESTTYPE: "" | ||
264 | - LUAV: "5.4" | ||
265 | LUAT: "lua" | ||
266 | COMPILER: "mingw" | ||
267 | FILES: "spec//build_spec.lua" | ||
268 | EXCLUDE: "" | ||
269 | TESTTYPE: "" | ||
270 | # LuaJIT 2.1 tests | ||
271 | - LUAV: "2.1" | ||
272 | LUAT: "luajit" | ||
273 | COMPILER: "mingw" | ||
274 | FILES: "" | ||
275 | EXCLUDE: "integration,quick" | ||
276 | TESTTYPE: "unit" | ||
277 | - LUAV: "2.1" | ||
278 | LUAT: "luajit" | ||
279 | COMPILER: "mingw" | ||
280 | FILES: "" | ||
281 | EXCLUDE: "unit,quick" | ||
282 | TESTTYPE: "" | ||
283 | - LUAV: "2.1" | ||
284 | LUAT: "luajit" | ||
285 | COMPILER: "mingw" | ||
286 | FILES: "spec//build_spec.lua" | ||
287 | EXCLUDE: "" | ||
288 | TESTTYPE: "" | ||
289 | env: | ||
290 | # The following env variables | ||
291 | # only applies to Visual Studio | ||
292 | LUAROCKS_DEPS_DIR: c:\external | ||
293 | LUAROCKS_DEPS_OPENSSL_VER: "3.4.1" | ||
294 | LUAROCKS_DEPS_ZLIB_VER: "1.3.1" | ||
295 | # The following env variable | ||
296 | # applies to both Visual Studio and MinGW-w64 | ||
297 | LUAROCKS_WINDOWS_GH_CI: "ci-windows" | ||
298 | steps: | ||
299 | - name: Checkout | ||
300 | uses: actions/checkout@v4 | ||
301 | |||
302 | - name: Setup MSVC dev prompt | ||
303 | if: ${{ matrix.COMPILER == 'vs' }} | ||
304 | uses: ilammy/msvc-dev-cmd@v1 | ||
305 | with: | ||
306 | arch: ${{ matrix.ARCH }} | ||
307 | |||
308 | - name: Add bin directory of dependencies to system PATH environment variable | ||
309 | if: ${{ matrix.COMPILER == 'vs' }} | ||
310 | run: echo ${{ env.LUAROCKS_DEPS_DIR }}\bin>>${{ github.path }} | ||
311 | |||
312 | - name: Restore zlib tarball | ||
313 | if: ${{ matrix.COMPILER == 'vs' }} | ||
314 | id: restore-zlib-tarball | ||
315 | uses: actions/cache/restore@v4 | ||
316 | with: | ||
317 | path: zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz | ||
318 | key: zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }} | ||
319 | |||
320 | - name: Download zlib | ||
321 | if: ${{ matrix.COMPILER == 'vs' && steps.restore-zlib-tarball.outputs.cache-hit != 'true' }} | ||
322 | run: | | ||
323 | curl -o "${{ github.workspace }}\zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz" ^ | ||
324 | "https://zlib.net/zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz" | ||
325 | |||
326 | - name: Save zlib tarball | ||
327 | if: ${{ matrix.COMPILER == 'vs' && steps.restore-zlib-tarball.outputs.cache-hit != 'true' }} | ||
328 | uses: actions/cache/save@v4 | ||
329 | with: | ||
330 | path: zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz | ||
331 | key: zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }} | ||
332 | |||
333 | - name: Install dependency (zlib) | ||
334 | if: ${{ matrix.COMPILER == 'vs' }} | ||
335 | run: | | ||
336 | cd "${{ runner.temp }}" && mkdir zlib && cd zlib && ^ | ||
337 | tar -xf "${{ github.workspace }}\zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }}.tar.gz" | ||
338 | |||
339 | IF "${{ matrix.COMPILER }}"=="vs" ( | ||
340 | SET CMAKE_GENERATOR=NMake Makefiles | ||
341 | SET CC=cl | ||
342 | ) ELSE ( | ||
343 | SET CMAKE_GENERATOR=MinGW Makefiles | ||
344 | SET CC=gcc | ||
345 | ) | ||
346 | |||
347 | cmake -G "%CMAKE_GENERATOR%" ^ | ||
348 | -DCMAKE_C_COMPILER=%CC% ^ | ||
349 | -DCMAKE_BUILD_TYPE=Release ^ | ||
350 | -DBUILD_SHARED_LIBS=ON ^ | ||
351 | -DBUILD_STATIC_LIBS=OFF ^ | ||
352 | --install-prefix "${{ env.LUAROCKS_DEPS_DIR }}" ^ | ||
353 | -S zlib-${{ env.LUAROCKS_DEPS_ZLIB_VER }} ^ | ||
354 | -B _build-zlib && ^ | ||
355 | cmake --build _build-zlib --config Release && ^ | ||
356 | cmake --install _build-zlib --config Release | ||
357 | |||
358 | IF "${{ matrix.COMPILER }}"=="vs" ( | ||
359 | copy "${{ env.LUAROCKS_DEPS_DIR }}\lib\zlib.lib" ^ | ||
360 | "${{ env.LUAROCKS_DEPS_DIR }}\lib\z.lib" | ||
361 | ) | ||
362 | |||
363 | - name: Restore bzip2 tarball | ||
364 | if: ${{ matrix.COMPILER == 'vs' }} | ||
365 | id: restore-bzip2-tarball | ||
366 | uses: actions/cache/restore@v4 | ||
367 | with: | ||
368 | path: bzip2.tar.gz | ||
369 | key: bzip2 | ||
370 | |||
371 | - name: Download bzip2 | ||
372 | if: ${{ matrix.COMPILER == 'vs' && steps.restore-bzip2-tarball.outputs.cache-hit != 'true' }} | ||
373 | run: | | ||
374 | cd "${{ runner.temp }}" && ^ | ||
375 | git clone https://gitlab.com/bzip2/bzip2 && ^ | ||
376 | tar -czvf "${{ github.workspace }}\bzip2.tar.gz" bzip2 | ||
377 | |||
378 | - name: Save bzip2 tarball | ||
379 | if: ${{ matrix.COMPILER == 'vs' && steps.restore-bzip2-tarball.outputs.cache-hit != 'true' }} | ||
380 | uses: actions/cache/save@v4 | ||
381 | with: | ||
382 | path: bzip2.tar.gz | ||
383 | key: bzip2 | ||
384 | |||
385 | - name: Install dependency (libbz2) | ||
386 | if: ${{ matrix.COMPILER == 'vs' }} | ||
387 | run: | | ||
388 | cd "${{ runner.temp }}" && ^ | ||
389 | tar -xf "${{ github.workspace }}\bzip2.tar.gz" | ||
390 | |||
391 | IF "${{ matrix.COMPILER }}"=="vs" ( | ||
392 | SET CMAKE_GENERATOR=NMake Makefiles | ||
393 | SET CC=cl | ||
394 | ) ELSE ( | ||
395 | SET CMAKE_GENERATOR=MinGW Makefiles | ||
396 | SET CC=gcc | ||
397 | ) | ||
398 | |||
399 | cmake -G "%CMAKE_GENERATOR%" ^ | ||
400 | -DCMAKE_C_COMPILER=%CC% ^ | ||
401 | -DCMAKE_BUILD_TYPE=Release ^ | ||
402 | -DENABLE_SHARED_LIB=ON ^ | ||
403 | -DENABLE_LIB_ONLY=ON ^ | ||
404 | --install-prefix "${{ env.LUAROCKS_DEPS_DIR }}" ^ | ||
405 | -S bzip2 ^ | ||
406 | -B _build-bz2 && ^ | ||
407 | cmake --build _build-bz2 --config Release && ^ | ||
408 | cmake --install _build-bz2 --config Release | ||
409 | |||
410 | IF EXIST "${{ env.LUAROCKS_DEPS_DIR }}\lib\bz2.dll" ( | ||
411 | copy /Y "${{ env.LUAROCKS_DEPS_DIR }}\lib\bz2.dll" ^ | ||
412 | "${{ env.LUAROCKS_DEPS_DIR }}\bin" | ||
413 | ) | ||
414 | |||
415 | - name: Restore OpenSSL installer | ||
416 | if: ${{ matrix.COMPILER == 'vs' }} | ||
417 | id: restore-openssl-installer | ||
418 | uses: actions/cache/restore@v4 | ||
419 | with: | ||
420 | path: build\openssl-installer-${{ env.LUAROCKS_DEPS_OPENSSL_VER }}-${{ matrix.ARCH }}.exe | ||
421 | key: openssl-${{ env.LUAROCKS_DEPS_OPENSSL_VER }}-${{ matrix.ARCH }} | ||
422 | |||
423 | # On Windows, up to date (OpenSSL 3.4.1), the process | ||
424 | # to build OpenSSL from source code is quite slow (20min ~ 30min). | ||
425 | # In order to get pre-built binaries (CI purposes) for the OpenSSL library | ||
426 | # ABI-compatible with MSVC, a faster approach can be achieved | ||
427 | # by downloading the binaries from a known third-party. | ||
428 | # slproweb ( https://slproweb.com/products/Win32OpenSSL.html ) is a long | ||
429 | # time third-party providing pre-built OpenSSL binaries through | ||
430 | # Windows installers. | ||
431 | # Note: AppVeyor pre-built binaries for OpenSSL | ||
432 | # also come from this provider. | ||
433 | |||
434 | # Below, we follow the idea contained at | ||
435 | # https://github.com/actions/runner-images/blob/a88fc4db06ae2350cb3128627b7fe4b5ee847f8e/images/windows/scripts/build/Install-OpenSSL.ps1 | ||
436 | # to install OpenSSL from slproweb in a suitable directory. | ||
437 | - name: Download OpenSSL installer | ||
438 | if: ${{ matrix.COMPILER == 'vs' && steps.restore-openssl-installer.outputs.cache-hit != 'true' }} | ||
439 | shell: pwsh | ||
440 | run: | | ||
441 | $installerName = "${{ github.workspace }}\build\openssl-installer-${{ env.LUAROCKS_DEPS_OPENSSL_VER }}-${{ matrix.ARCH }}.exe"; | ||
442 | |||
443 | $arch = 'INTEL'; | ||
444 | |||
445 | if ("${{ matrix.ARCH }}" -eq "x86") | ||
446 | { | ||
447 | $bits = '32'; | ||
448 | } | ||
449 | else | ||
450 | { | ||
451 | $bits = '64'; | ||
452 | } | ||
453 | |||
454 | $light = $false; | ||
455 | $version = "${{ env.LUAROCKS_DEPS_OPENSSL_VER }}"; | ||
456 | |||
457 | # Fetch available installers list | ||
458 | $jsonUrl = 'https://raw.githubusercontent.com/slproweb/opensslhashes/master/win32_openssl_hashes.json'; | ||
459 | |||
460 | $installersAvailable = (Invoke-RestMethod $jsonUrl).files; | ||
461 | $installerNames = $installersAvailable | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name; | ||
462 | |||
463 | $installerUrl = $null; | ||
464 | $installerHash = $null; | ||
465 | |||
466 | foreach ($key in $installerNames) { | ||
467 | $installer = $installersAvailable.$key; | ||
468 | if (($installer.light -eq $light) -and ($installer.arch -eq $arch) -and ($installer.bits -eq $bits) -and ($installer.installer -eq "exe") -and ($installer.basever -eq $version)) { | ||
469 | $installerUrl = $installer.url; | ||
470 | $installerHash = $installer.sha512.Replace("-", "").ToLower(); | ||
471 | break; | ||
472 | } | ||
473 | } | ||
474 | |||
475 | if ($installerUrl -eq $null) { | ||
476 | throw "Installer not found for version $version"; | ||
477 | } | ||
478 | |||
479 | # Download the installer | ||
480 | curl "--create-dirs" "-o" "${installerName}" "${installerUrl}"; | ||
481 | |||
482 | # Validate sha512 checksum | ||
483 | $downloadedHash = Get-FileHash -Path "${installerName}" -Algorithm "SHA512" | | ||
484 | Select-Object -ExpandProperty Hash; | ||
485 | |||
486 | $downloadedHash = $downloadedHash.Replace("-", "").ToLower(); | ||
487 | |||
488 | if ("${downloadedHash}" -ne "${installerHash}") | ||
489 | { | ||
490 | throw "Installer SHA512 hash mismatch: (Expected ${installerHash}), (Got ${downloadedHash})"; | ||
491 | } | ||
492 | |||
493 | - name: Save OpenSSL installer | ||
494 | if: ${{ matrix.COMPILER == 'vs' && steps.restore-openssl-installer.outputs.cache-hit != 'true' }} | ||
495 | uses: actions/cache/save@v4 | ||
496 | with: | ||
497 | path: build\openssl-installer-${{ env.LUAROCKS_DEPS_OPENSSL_VER }}-${{ matrix.ARCH }}.exe | ||
498 | key: openssl-${{ env.LUAROCKS_DEPS_OPENSSL_VER }}-${{ matrix.ARCH }} | ||
499 | |||
500 | - name: Install dependency (OpenSSL) | ||
501 | if: ${{ matrix.COMPILER == 'vs' }} | ||
502 | shell: pwsh | ||
503 | run: | | ||
504 | Start-Process ` | ||
505 | -FilePath "${{ github.workspace }}\build\openssl-installer-${{ env.LUAROCKS_DEPS_OPENSSL_VER }}-${{ matrix.ARCH }}.exe" ` | ||
506 | -ArgumentList "/verysilent", "/sp-", "/suppressmsgboxes", "/DIR=`"${{ env.LUAROCKS_DEPS_DIR }}`"" ` | ||
507 | -Wait; | ||
508 | |||
509 | $deps_lib_dir = Join-Path -Path "${{ env.LUAROCKS_DEPS_DIR }}" -ChildPath "lib"; | ||
510 | if (Test-Path -Path $deps_lib_dir) | ||
511 | { | ||
512 | foreach ($imp_lib in "libssl.lib", "libcrypto.lib") | ||
513 | { | ||
514 | $current_imp_lib = Join-Path -Path "${deps_lib_dir}" -ChildPath "${imp_lib}"; | ||
515 | if (-not (Test-Path -Path $current_imp_lib)) | ||
516 | { | ||
517 | $current_imp_lib = Get-ChildItem -Path $deps_lib_dir -Recurse -File | | ||
518 | Where-Object Name -EQ "${imp_lib}" | | ||
519 | Select-Object -ExpandProperty FullName -First 1; | ||
520 | |||
521 | Copy-Item -Path $current_imp_lib -Destination $deps_lib_dir; | ||
522 | } | ||
523 | } | ||
524 | } | ||
525 | |||
526 | # When running many concurrent jobs, | ||
527 | # pacman might fail to download packages | ||
528 | # from MSYS2 servers due a high load. | ||
529 | # So, retry the installation a few times | ||
530 | - name: Setup mingw-w64 and dependencies | ||
531 | if: ${{ matrix.COMPILER == 'mingw' }} | ||
532 | run: | | ||
533 | SET PKGS_TO_INSTALL=mingw-w64-ucrt-x86_64-cc ^ | ||
534 | mingw-w64-ucrt-x86_64-make ^ | ||
535 | mingw-w64-ucrt-x86_64-zlib ^ | ||
536 | mingw-w64-ucrt-x86_64-bzip2 ^ | ||
537 | mingw-w64-ucrt-x86_64-openssl | ||
538 | |||
539 | SET "TRIES=0" | ||
540 | SET "MAX_TRIES=5" | ||
541 | SET "SECS_TO_WAIT=1" | ||
542 | |||
543 | GOTO :INSTALL_FROM_MSYS2 | ||
544 | |||
545 | :INSTALL_FROM_MSYS2 | ||
546 | C:\msys64\usr\bin\bash "-lc" ^ | ||
547 | "pacman -S %PKGS_TO_INSTALL% --noconfirm" | ||
548 | |||
549 | IF %ERRORLEVEL% EQU 0 ( | ||
550 | echo C:\msys64\ucrt64\bin>>${{ github.path }} | ||
551 | ) ELSE ( | ||
552 | SET /A "TRIES=TRIES+1" | ||
553 | IF %TRIES% LSS %MAX_TRIES% ( | ||
554 | echo Attempt %TRIES% out of %MAX_TRIES% to install packages failed | ||
555 | SET /A "SECS_TO_WAIT*=2" | ||
556 | echo Waiting %SECS_TO_WAIT% seconds to retry | ||
557 | SLEEP %SECS_TO_WAIT% | ||
558 | GOTO :INSTALL_FROM_MSYS2 | ||
559 | ) ELSE ( | ||
560 | echo Failed to install mingw-w64 and dependencies from MSYS2 | ||
561 | EXIT /B 1 | ||
562 | ) | ||
563 | ) | ||
564 | |||
565 | - name: Setup Python | ||
566 | uses: actions/setup-python@v5 | ||
567 | with: | ||
568 | # employ the latest Python version | ||
569 | # described at https://pypi.org/project/hererocks/ | ||
570 | python-version: '3.11' | ||
571 | |||
572 | - name: Install SSL certificate | ||
573 | run: | | ||
574 | pip install --upgrade certifi | ||
575 | FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import certifi;print(certifi.where())"`) DO ( | ||
576 | echo SSL_CERT_FILE=%%F>>${{ github.env }} | ||
577 | ) | ||
578 | |||
579 | - name: Install ${{ matrix.LUAT }} ${{ matrix.LUAV }} | ||
580 | run: | | ||
581 | SET "CURRENT_LUA_DIRNAME=lua_install-${{ matrix.LUAV }}" | ||
582 | SET "CURRENT_LUA_DIR=${{ github.workspace }}\%CURRENT_LUA_DIRNAME%" | ||
583 | SET "CURRENT_LUA_BIN=%CURRENT_LUA_DIR%\bin" | ||
584 | SET "CURRENT_LUA_INTERPRETER=%CURRENT_LUA_BIN%\lua.exe" | ||
585 | |||
586 | pip install hererocks && ^ | ||
587 | hererocks ^ | ||
588 | "%CURRENT_LUA_DIRNAME%" ^ | ||
589 | "--${{ matrix.LUAT }}" "${{ matrix.LUAV }}" ^ | ||
590 | --luarocks latest ^ | ||
591 | "--target=${{ matrix.COMPILER }}" | ||
592 | |||
593 | IF %ERRORLEVEL% NEQ 0 ( | ||
594 | echo Failed to install Lua / LuaRocks | ||
595 | EXIT /B 1 | ||
596 | ) | ||
597 | |||
598 | echo %CURRENT_LUA_BIN%>>${{ github.path }} | ||
599 | echo CURRENT_LUA_DIR=%CURRENT_LUA_DIR%>>${{ github.env }} | ||
600 | echo CURRENT_LUA_BIN=%CURRENT_LUA_BIN%>>${{ github.env }} | ||
601 | echo CURRENT_LUA_INTERPRETER=%CURRENT_LUA_INTERPRETER%>>${{ github.env }} | ||
602 | echo BUSTED_BAT=%CURRENT_LUA_BIN%\busted.bat>>${{ github.env }} | ||
603 | echo LUACOV_BAT=%CURRENT_LUA_BIN%\luacov.bat>>${{ github.env }} | ||
604 | |||
605 | - name: Configure MSVCRT to build dependencies | ||
606 | if: ${{ matrix.COMPILER == 'mingw' }} | ||
607 | run: | | ||
608 | SET MSVCRT_LUA_CODE=local pe = require [[win32.pe-parser]]; ^ | ||
609 | local rt, _ = pe.msvcrt [[${{ env.CURRENT_LUA_INTERPRETER }}]]; ^ | ||
610 | print(rt or 'nil') | ||
611 | |||
612 | FOR /F "tokens=* USEBACKQ" %%I IN (`lua -e "%MSVCRT_LUA_CODE%"`) DO ( | ||
613 | IF NOT "%%I"=="nil" ( | ||
614 | luarocks config variables.MSVCRT "%%I" | ||
615 | ) | ||
616 | ) | ||
617 | |||
618 | - name: Install compat53 | ||
619 | run: luarocks install compat53 | ||
620 | |||
621 | - name: Install busted | ||
622 | run: IF NOT EXIST "${{ env.BUSTED_BAT }}" luarocks install busted | ||
623 | |||
624 | - name: Install cluacov | ||
625 | run: IF NOT EXIST "${{ env.LUACOV_BAT }}" luarocks install cluacov | ||
626 | |||
627 | - name: Install busted-htest | ||
628 | run: luarocks install busted-htest | ||
629 | |||
630 | - name: Run test | ||
631 | run: | | ||
632 | busted ^ | ||
633 | -o htest ^ | ||
634 | -v "--lpath=.//?.lua" ^ | ||
635 | "--exclude-tags=ssh,unix,${{ matrix.EXCLUDE }}" ^ | ||
636 | -Xhelper ^ | ||
637 | "lua_dir=${{ env.CURRENT_LUA_DIR }},${{ env.LUAROCKS_WINDOWS_GH_CI }},${{ matrix.COMPILER }}" ^ | ||
638 | ${{ matrix.FILES }} | ||
639 | |||
640 | - name: Run unit test | ||
641 | if: ${{ matrix.TESTTYPE == 'unit' }} | ||
642 | run: | | ||
643 | busted ^ | ||
644 | -o htest ^ | ||
645 | -v "--lpath=.//?.lua" ^ | ||
646 | "--exclude-tags=ssh,unix,${{ matrix.EXCLUDE }}" ^ | ||
647 | -Xhelper ^ | ||
648 | "lua_dir=${{ env.CURRENT_LUA_DIR }},${{ env.LUAROCKS_WINDOWS_GH_CI }},${{ matrix.COMPILER }},env=full" ^ | ||
649 | ${{ matrix.FILES }} | ||
650 | |||
651 | - name: Generate coverage report | ||
652 | working-directory: testrun | ||
653 | run: luacov -c "luacov.config" | ||
654 | |||
655 | - name: Install Codecov | ||
656 | run: pip install codecov | ||
657 | |||
658 | - name: Upload coverage report | ||
659 | working-directory: testrun | ||
660 | env: | ||
661 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
662 | run: codecov -t "%CODECOV_TOKEN%" -f "luacov.report.out" -X gcov \ No newline at end of file | ||