From 93cdd54195a6a5a101c9c37c3034916b710d71ba Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Fri, 20 Mar 2015 00:12:56 -0300 Subject: Adds integration with AppVeyor Adds a simple integration with AppVeyor, defines a matrix to test with Lua 5.1, 5.2 and 5.3, and runs a couple of tests. This last part (the actual running of the tests), should be moved to a different file. Some kind of test runner should be built. But this is a start. --- appveyor.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..d92c3699 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,50 @@ +version: 2.2.1.{build}-test + +os: +- Windows Server 2012 R2 + +shallow_clone: true + +environment: + LUAURL: http://www.lua.org/ftp + LUAROCKS_REPO: http://rocks.moonscript.org + #LUA_VER: 5.3.0 + #LUA_SHORTV: 5.3 + + matrix: + - LUA_VER: 5.3.0 + LUA_SHORTV: 5.3 + + - LUA_VER: 5.2.4 + LUA_SHORTV: 5.2 + + - LUA_VER: 5.1.5 + LUA_SHORTV: 5.1 + +init: +- appveyor DownloadFile %LUAURL%/lua-%LUA_VER%.tar.gz +- 7z x lua-%LUA_VER%.tar.gz +- 7z x lua-%LUA_VER%.tar +- cd lua-%LUA_VER% +- appveyor DownloadFile https://github.com/Tieske/luawinmake/archive/master.zip +- 7z x master.zip +- if not exist etc mkdir etc +- mv luawinmake-master\etc\winmake.bat %APPVEYOR_BUILD_FOLDER%\lua-%LUA_VER%\etc\winmake.bat +- '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86' +- etc\winmake.bat +- etc\winmake.bat install c:\lua%LUA_VER% +- cd %APPVEYOR_BUILD_FOLDER% + +build_script: +- install.bat /LUA c:\lua%LUA_VER% /Q /LV %LUA_SHORTV% +- set PATH=%PATH%;C:\Program Files (x86)\LuaRocks\2.2 +- set LUA_PATH="C:\Program Files (x86)\LuaRocks\2.2\lua\?.lua;C:\Program Files (x86)\LuaRocks\2.2\lua\?\init.lua;C:\Program Files (x86)\LuaRocks\systree\share\lua\%LUA_SHORTV%\?.lua;C:\Program Files (x86)\LuaRocks\systree\share\lua\%LUA_SHORTV%\?\init.lua" +- set LUA_CPATH="C:\Program Files (x86)\LuaRocks\systree\lib\lua\%LUA_SHORTV%\?.dll" +- luarocks +- cd test +# split this to a different file +# test_version +- luarocks --version +# test_build_command +- appveyor DownloadFile %LUAROCKS_REPO%/stdlib-41.0.0-1.src.rock +- luarocks build stdlib -- cgit v1.2.3-55-g6feb From e31c46b8430b10cdf01c2570de810b028c5895a7 Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Fri, 27 Mar 2015 12:34:19 -0300 Subject: Improved the CI scripts Ported back part of the work made [here](https://github.com/ignacio/lua-appveyor-example) by @moteus and me. I still need to write a test runner of sorts. --- .appveyor/build.bat | 112 +++++++++++++++++++++++++++++++++++++ .appveyor/install.bat | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++ appveyor.yml | 51 ++++++----------- test/testing.bat | 9 +++ 4 files changed, 289 insertions(+), 34 deletions(-) create mode 100644 .appveyor/build.bat create mode 100644 .appveyor/install.bat create mode 100644 test/testing.bat diff --git a/.appveyor/build.bat b/.appveyor/build.bat new file mode 100644 index 00000000..48e72514 --- /dev/null +++ b/.appveyor/build.bat @@ -0,0 +1,112 @@ +@echo off +Setlocal EnableDelayedExpansion EnableExtensions + +cd %APPVEYOR_BUILD_FOLDER% + +:: ========================================================= +:: Make sure some environment variables are set +if not defined LUA_VER call :die LUA_VER is not defined +if not defined LUA call :die LUA is not defined +if not defined LUA_SHORTV call :die LUA_SHORTV is not defined +if not defined LUA_DIR call :die LUA_DIR is not defined + +:: ========================================================= +:: Set some defaults. Infer some variables. +:: +if not defined LUAROCKS_VER set LUAROCKS_VER=2.2.1 + +set LUAROCKS_SHORTV=%LUAROCKS_VER:~0,3% + +if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external +if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%LUA_DIR%\LuaRocks +if not defined LR_ROOT set LR_ROOT=%LUAROCKS_INSTALL%\%LUAROCKS_SHORTV% +if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree + +:: +:: ========================================================= + + +if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe" + + + +:: ========================================================= +:: LuaRocks +:: ========================================================= + +cd %APPVEYOR_BUILD_FOLDER% +call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" + +if not exist "%LR_ROOT%" call :die "LuaRocks not found at %LR_ROOT%" + +set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH% + +:: Lua will use just the system rocks +set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua +set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua +set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua +set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll + +call luarocks --version || call :die "Error with LuaRocks installation" +call luarocks list + + +if not exist "%LR_EXTERNAL%" ( + mkdir "%LR_EXTERNAL%" + mkdir "%LR_EXTERNAL%\lib" + mkdir "%LR_EXTERNAL%\include" +) + +set PATH=%LR_EXTERNAL%;%PATH% + +:: Exports the following variables: +:: (beware of whitespace between & and ^ below) +endlocal & set PATH=%PATH%&^ +set LR_SYSTREE=%LR_SYSTREE%&^ +set LUA_PATH=%LUA_PATH%&^ +set LUA_CPATH=%LUA_CPATH%&^ +set LR_EXTERNAL=%LR_EXTERNAL% + +echo. +echo ====================================================== +echo Installation of LuaRocks %LUAROCKS_VER% done. +echo . +echo LUA_PATH - %LUA_PATH% +echo LUA_CPATH - %LUA_CPATH% +echo. +echo LR_EXTERNAL - %LR_EXTERNAL% +echo ====================================================== +echo. + +goto :eof + + + + + + + + + + + + + + + + + + +:: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'" +:: then try adding or removing blank lines lines above. +:: Yes, really. +:: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e + +:: helper functions: + +:: for bailing out when an error occurred +:die %1 +echo %1 +exit /B 1 +goto :eof + diff --git a/.appveyor/install.bat b/.appveyor/install.bat new file mode 100644 index 00000000..db4800f9 --- /dev/null +++ b/.appveyor/install.bat @@ -0,0 +1,151 @@ +@echo off + +cd %APPVEYOR_BUILD_FOLDER% + +:: ========================================================= +:: Set some defaults. Infer some variables. +:: +:: These are set globally +if "%LUA_VER%" NEQ "" ( + set LUA=lua + set LUA_SHORTV=%LUA_VER:~0,3% +) else ( + set LUA=luajit + set LJ_SHORTV=%LJ_VER:~0,3% + set LUA_SHORTV=5.1 +) + +:: defines LUA_DIR so Cmake can find this Lua install +if "%LUA%"=="luajit" ( + set LUA_DIR=c:\lua\%platform%\lj%LJ_SHORTV% +) else ( + set LUA_DIR=c:\lua\%platform%\%LUA_VER% +) + +:: Now we declare a scope +Setlocal EnableDelayedExpansion EnableExtensions + +if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp +if not defined LUAJIT_GIT_REPO set LUAJIT_GIT_REPO=http://luajit.org/git/luajit-2.0.git +if not defined LUAJIT_URL set LUAJIT_URL=http://luajit.org/download + +if not defined SEVENZIP set SEVENZIP=7z +:: +:: ========================================================= + +:: first create some necessary directories: +mkdir downloads 2>NUL + +:: Download and compile Lua (or LuaJIT) +if "%LUA%"=="luajit" ( + if not exist %LUA_DIR% ( + if "%LJ_SHORTV%"=="2.1" ( + :: Clone repository and checkout 2.1 branch + set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER% + if not exist !lj_source_folder! ( + echo Cloning git repo %LUAJIT_GIT_REPO% !lj_source_folder! + git clone %LUAJIT_GIT_REPO% !lj_source_folder! || call :die "Failed to clone repository" + ) + cd !lj_source_folder!\src + git checkout v2.1 || call :die + ) else ( + set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER% + if not exist !lj_source_folder! ( + echo Downloading... %LUAJIT_URL%/LuaJIT-%LJ_VER%.tar.gz + curl --silent --fail --max-time 120 --connect-timeout 30 %LUAJIT_URL%/LuaJIT-%LJ_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads + ) + cd !lj_source_folder!\src + ) + :: Compiles LuaJIT + call msvcbuild.bat + + mkdir %LUA_DIR% 2> NUL + for %%a in (bin include lib) do ( mkdir "%LUA_DIR%\%%a" ) + + for %%a in (luajit.exe lua51.dll) do ( move "!lj_source_folder!\src\%%a" "%LUA_DIR%\bin" ) + + move "!lj_source_folder!\src\lua51.lib" "%LUA_DIR%\lib" + for %%a in (lauxlib.h lua.h lua.hpp luaconf.h lualib.h luajit.h) do ( + copy "!lj_source_folder!\src\%%a" "%LUA_DIR%\include" + ) + + ) else ( + echo LuaJIT %LJ_VER% already installed at %LUA_DIR% + ) +) else ( + if not exist %LUA_DIR% ( + :: Download and compile Lua + if not exist downloads\lua-%LUA_VER% ( + curl --silent --fail --max-time 120 --connect-timeout 30 %LUA_URL%/lua-%LUA_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads + ) + + mkdir downloads\lua-%LUA_VER%\etc 2> NUL + if not exist downloads\lua-%LUA_VER%\etc\winmake.bat ( + curl --silent --location --insecure --fail --max-time 120 --connect-timeout 30 https://github.com/Tieske/luawinmake/archive/master.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% e -si -ttar -aoa -odownloads\lua-%LUA_VER%\etc luawinmake-master\etc\winmake.bat + ) + + cd downloads\lua-%LUA_VER% + call etc\winmake + call etc\winmake install %LUA_DIR% + ) else ( + echo Lua %LUA_VER% already installed at %LUA_DIR% + ) +) + +if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe" + +set PATH=%LUA_DIR%\bin;%PATH% +call %LUA% -v + + + +:: Exports the following variables: +endlocal & set PATH=%PATH% + +echo. +echo ====================================================== +if "%LUA%"=="luajit" ( + echo Installation of LuaJIT %LJ_VER% done. +) else ( + echo Installation of Lua %LUA_VER% done. +) +echo Platform - %platform% +echo LUA - %LUA% +echo LUA_SHORTV - %LUA_SHORTV% +echo LJ_SHORTV - %LJ_SHORTV% +echo. +echo ====================================================== +echo. + +goto :eof + + + + + + + + + + + + + + + + + + +:: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'" +:: then try adding or removing blank lines lines above. +:: Yes, really. +:: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e + +:: helper functions: + +:: for bailing out when an error occurred +:die %1 +echo %1 +exit /B 1 +goto :eof + diff --git a/appveyor.yml b/appveyor.yml index d92c3699..436c341b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,45 +6,28 @@ os: shallow_clone: true environment: - LUAURL: http://www.lua.org/ftp - LUAROCKS_REPO: http://rocks.moonscript.org - #LUA_VER: 5.3.0 - #LUA_SHORTV: 5.3 + LUAROCKS_VER: 2.2.1 matrix: - - LUA_VER: 5.3.0 - LUA_SHORTV: 5.3 - - - LUA_VER: 5.2.4 - LUA_SHORTV: 5.2 - - LUA_VER: 5.1.5 - LUA_SHORTV: 5.1 + - LUA_VER: 5.2.4 + - LUA_VER: 5.3.0 + - LJ_VER: 2.0.3 + - LJ_VER: 2.1 init: -- appveyor DownloadFile %LUAURL%/lua-%LUA_VER%.tar.gz -- 7z x lua-%LUA_VER%.tar.gz -- 7z x lua-%LUA_VER%.tar -- cd lua-%LUA_VER% -- appveyor DownloadFile https://github.com/Tieske/luawinmake/archive/master.zip -- 7z x master.zip -- if not exist etc mkdir etc -- mv luawinmake-master\etc\winmake.bat %APPVEYOR_BUILD_FOLDER%\lua-%LUA_VER%\etc\winmake.bat -- '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86' -- etc\winmake.bat -- etc\winmake.bat install c:\lua%LUA_VER% -- cd %APPVEYOR_BUILD_FOLDER% +# Setup Lua development/build environment +# Make VS 2013 command line tools available +- call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %platform% + +install: +# Setup Lua development/build environment +- call .appveyor\install.bat build_script: -- install.bat /LUA c:\lua%LUA_VER% /Q /LV %LUA_SHORTV% -- set PATH=%PATH%;C:\Program Files (x86)\LuaRocks\2.2 -- set LUA_PATH="C:\Program Files (x86)\LuaRocks\2.2\lua\?.lua;C:\Program Files (x86)\LuaRocks\2.2\lua\?\init.lua;C:\Program Files (x86)\LuaRocks\systree\share\lua\%LUA_SHORTV%\?.lua;C:\Program Files (x86)\LuaRocks\systree\share\lua\%LUA_SHORTV%\?\init.lua" -- set LUA_CPATH="C:\Program Files (x86)\LuaRocks\systree\lib\lua\%LUA_SHORTV%\?.dll" -- luarocks +- call .appveyor\build.bat + +test_script: +- echo "Testing..." - cd test -# split this to a different file -# test_version -- luarocks --version -# test_build_command -- appveyor DownloadFile %LUAROCKS_REPO%/stdlib-41.0.0-1.src.rock -- luarocks build stdlib +- call testing.bat diff --git a/test/testing.bat b/test/testing.bat new file mode 100644 index 00000000..319e12c3 --- /dev/null +++ b/test/testing.bat @@ -0,0 +1,9 @@ +@echo off +Setlocal EnableDelayedExpansion EnableExtensions + +if not defined LUAROCKS_REPO set LUAROCKS_REPO=http://rocks.moonscript.org + +appveyor DownloadFile %LUAROCKS_REPO%/stdlib-41.0.0-1.src.rock +luarocks build stdlib + +endlocal -- cgit v1.2.3-55-g6feb From ff68e9775ac2e5f9aae21535688d5355e4173e61 Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Fri, 27 Mar 2015 12:45:24 -0300 Subject: Fallback for platform variable --- .appveyor/install.bat | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.appveyor/install.bat b/.appveyor/install.bat index db4800f9..a2aefdd2 100644 --- a/.appveyor/install.bat +++ b/.appveyor/install.bat @@ -15,6 +15,9 @@ if "%LUA_VER%" NEQ "" ( set LUA_SHORTV=5.1 ) +:: unless we specify a platform on appveyor.yaml, we won't get this variable +if not defined platform set platform=x86 + :: defines LUA_DIR so Cmake can find this Lua install if "%LUA%"=="luajit" ( set LUA_DIR=c:\lua\%platform%\lj%LJ_SHORTV% -- cgit v1.2.3-55-g6feb