diff options
| author | Ignacio Burgueño <ignaciob@inconcertcc.com> | 2015-03-27 12:34:19 -0300 |
|---|---|---|
| committer | Ignacio Burgueño <ignaciob@inconcertcc.com> | 2015-03-27 12:34:19 -0300 |
| commit | e31c46b8430b10cdf01c2570de810b028c5895a7 (patch) | |
| tree | 57823c4c02ff23f00144bfcda821f727ba5dc923 | |
| parent | 93cdd54195a6a5a101c9c37c3034916b710d71ba (diff) | |
| download | luarocks-e31c46b8430b10cdf01c2570de810b028c5895a7.tar.gz luarocks-e31c46b8430b10cdf01c2570de810b028c5895a7.tar.bz2 luarocks-e31c46b8430b10cdf01c2570de810b028c5895a7.zip | |
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.
| -rw-r--r-- | .appveyor/build.bat | 112 | ||||
| -rw-r--r-- | .appveyor/install.bat | 151 | ||||
| -rw-r--r-- | appveyor.yml | 51 | ||||
| -rw-r--r-- | test/testing.bat | 9 |
4 files changed, 289 insertions, 34 deletions
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 @@ | |||
| 1 | @echo off | ||
| 2 | Setlocal EnableDelayedExpansion EnableExtensions | ||
| 3 | |||
| 4 | cd %APPVEYOR_BUILD_FOLDER% | ||
| 5 | |||
| 6 | :: ========================================================= | ||
| 7 | :: Make sure some environment variables are set | ||
| 8 | if not defined LUA_VER call :die LUA_VER is not defined | ||
| 9 | if not defined LUA call :die LUA is not defined | ||
| 10 | if not defined LUA_SHORTV call :die LUA_SHORTV is not defined | ||
| 11 | if not defined LUA_DIR call :die LUA_DIR is not defined | ||
| 12 | |||
| 13 | :: ========================================================= | ||
| 14 | :: Set some defaults. Infer some variables. | ||
| 15 | :: | ||
| 16 | if not defined LUAROCKS_VER set LUAROCKS_VER=2.2.1 | ||
| 17 | |||
| 18 | set LUAROCKS_SHORTV=%LUAROCKS_VER:~0,3% | ||
| 19 | |||
| 20 | if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external | ||
| 21 | if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%LUA_DIR%\LuaRocks | ||
| 22 | if not defined LR_ROOT set LR_ROOT=%LUAROCKS_INSTALL%\%LUAROCKS_SHORTV% | ||
| 23 | if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree | ||
| 24 | |||
| 25 | :: | ||
| 26 | :: ========================================================= | ||
| 27 | |||
| 28 | |||
| 29 | if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe" | ||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | :: ========================================================= | ||
| 34 | :: LuaRocks | ||
| 35 | :: ========================================================= | ||
| 36 | |||
| 37 | cd %APPVEYOR_BUILD_FOLDER% | ||
| 38 | call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" | ||
| 39 | |||
| 40 | if not exist "%LR_ROOT%" call :die "LuaRocks not found at %LR_ROOT%" | ||
| 41 | |||
| 42 | set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH% | ||
| 43 | |||
| 44 | :: Lua will use just the system rocks | ||
| 45 | set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua | ||
| 46 | set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua | ||
| 47 | set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua | ||
| 48 | set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll | ||
| 49 | |||
| 50 | call luarocks --version || call :die "Error with LuaRocks installation" | ||
| 51 | call luarocks list | ||
| 52 | |||
| 53 | |||
| 54 | if not exist "%LR_EXTERNAL%" ( | ||
| 55 | mkdir "%LR_EXTERNAL%" | ||
| 56 | mkdir "%LR_EXTERNAL%\lib" | ||
| 57 | mkdir "%LR_EXTERNAL%\include" | ||
| 58 | ) | ||
| 59 | |||
| 60 | set PATH=%LR_EXTERNAL%;%PATH% | ||
| 61 | |||
| 62 | :: Exports the following variables: | ||
| 63 | :: (beware of whitespace between & and ^ below) | ||
| 64 | endlocal & set PATH=%PATH%&^ | ||
| 65 | set LR_SYSTREE=%LR_SYSTREE%&^ | ||
| 66 | set LUA_PATH=%LUA_PATH%&^ | ||
| 67 | set LUA_CPATH=%LUA_CPATH%&^ | ||
| 68 | set LR_EXTERNAL=%LR_EXTERNAL% | ||
| 69 | |||
| 70 | echo. | ||
| 71 | echo ====================================================== | ||
| 72 | echo Installation of LuaRocks %LUAROCKS_VER% done. | ||
| 73 | echo . | ||
| 74 | echo LUA_PATH - %LUA_PATH% | ||
| 75 | echo LUA_CPATH - %LUA_CPATH% | ||
| 76 | echo. | ||
| 77 | echo LR_EXTERNAL - %LR_EXTERNAL% | ||
| 78 | echo ====================================================== | ||
| 79 | echo. | ||
| 80 | |||
| 81 | goto :eof | ||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | :: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'" | ||
| 101 | :: then try adding or removing blank lines lines above. | ||
| 102 | :: Yes, really. | ||
| 103 | :: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e | ||
| 104 | |||
| 105 | :: helper functions: | ||
| 106 | |||
| 107 | :: for bailing out when an error occurred | ||
| 108 | :die %1 | ||
| 109 | echo %1 | ||
| 110 | exit /B 1 | ||
| 111 | goto :eof | ||
| 112 | |||
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 @@ | |||
| 1 | @echo off | ||
| 2 | |||
| 3 | cd %APPVEYOR_BUILD_FOLDER% | ||
| 4 | |||
| 5 | :: ========================================================= | ||
| 6 | :: Set some defaults. Infer some variables. | ||
| 7 | :: | ||
| 8 | :: These are set globally | ||
| 9 | if "%LUA_VER%" NEQ "" ( | ||
| 10 | set LUA=lua | ||
| 11 | set LUA_SHORTV=%LUA_VER:~0,3% | ||
| 12 | ) else ( | ||
| 13 | set LUA=luajit | ||
| 14 | set LJ_SHORTV=%LJ_VER:~0,3% | ||
| 15 | set LUA_SHORTV=5.1 | ||
| 16 | ) | ||
| 17 | |||
| 18 | :: defines LUA_DIR so Cmake can find this Lua install | ||
| 19 | if "%LUA%"=="luajit" ( | ||
| 20 | set LUA_DIR=c:\lua\%platform%\lj%LJ_SHORTV% | ||
| 21 | ) else ( | ||
| 22 | set LUA_DIR=c:\lua\%platform%\%LUA_VER% | ||
| 23 | ) | ||
| 24 | |||
| 25 | :: Now we declare a scope | ||
| 26 | Setlocal EnableDelayedExpansion EnableExtensions | ||
| 27 | |||
| 28 | if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp | ||
| 29 | if not defined LUAJIT_GIT_REPO set LUAJIT_GIT_REPO=http://luajit.org/git/luajit-2.0.git | ||
| 30 | if not defined LUAJIT_URL set LUAJIT_URL=http://luajit.org/download | ||
| 31 | |||
| 32 | if not defined SEVENZIP set SEVENZIP=7z | ||
| 33 | :: | ||
| 34 | :: ========================================================= | ||
| 35 | |||
| 36 | :: first create some necessary directories: | ||
| 37 | mkdir downloads 2>NUL | ||
| 38 | |||
| 39 | :: Download and compile Lua (or LuaJIT) | ||
| 40 | if "%LUA%"=="luajit" ( | ||
| 41 | if not exist %LUA_DIR% ( | ||
| 42 | if "%LJ_SHORTV%"=="2.1" ( | ||
| 43 | :: Clone repository and checkout 2.1 branch | ||
| 44 | set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER% | ||
| 45 | if not exist !lj_source_folder! ( | ||
| 46 | echo Cloning git repo %LUAJIT_GIT_REPO% !lj_source_folder! | ||
| 47 | git clone %LUAJIT_GIT_REPO% !lj_source_folder! || call :die "Failed to clone repository" | ||
| 48 | ) | ||
| 49 | cd !lj_source_folder!\src | ||
| 50 | git checkout v2.1 || call :die | ||
| 51 | ) else ( | ||
| 52 | set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER% | ||
| 53 | if not exist !lj_source_folder! ( | ||
| 54 | echo Downloading... %LUAJIT_URL%/LuaJIT-%LJ_VER%.tar.gz | ||
| 55 | 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 | ||
| 56 | ) | ||
| 57 | cd !lj_source_folder!\src | ||
| 58 | ) | ||
| 59 | :: Compiles LuaJIT | ||
| 60 | call msvcbuild.bat | ||
| 61 | |||
| 62 | mkdir %LUA_DIR% 2> NUL | ||
| 63 | for %%a in (bin include lib) do ( mkdir "%LUA_DIR%\%%a" ) | ||
| 64 | |||
| 65 | for %%a in (luajit.exe lua51.dll) do ( move "!lj_source_folder!\src\%%a" "%LUA_DIR%\bin" ) | ||
| 66 | |||
| 67 | move "!lj_source_folder!\src\lua51.lib" "%LUA_DIR%\lib" | ||
| 68 | for %%a in (lauxlib.h lua.h lua.hpp luaconf.h lualib.h luajit.h) do ( | ||
| 69 | copy "!lj_source_folder!\src\%%a" "%LUA_DIR%\include" | ||
| 70 | ) | ||
| 71 | |||
| 72 | ) else ( | ||
| 73 | echo LuaJIT %LJ_VER% already installed at %LUA_DIR% | ||
| 74 | ) | ||
| 75 | ) else ( | ||
| 76 | if not exist %LUA_DIR% ( | ||
| 77 | :: Download and compile Lua | ||
| 78 | if not exist downloads\lua-%LUA_VER% ( | ||
| 79 | 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 | ||
| 80 | ) | ||
| 81 | |||
| 82 | mkdir downloads\lua-%LUA_VER%\etc 2> NUL | ||
| 83 | if not exist downloads\lua-%LUA_VER%\etc\winmake.bat ( | ||
| 84 | 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 | ||
| 85 | ) | ||
| 86 | |||
| 87 | cd downloads\lua-%LUA_VER% | ||
| 88 | call etc\winmake | ||
| 89 | call etc\winmake install %LUA_DIR% | ||
| 90 | ) else ( | ||
| 91 | echo Lua %LUA_VER% already installed at %LUA_DIR% | ||
| 92 | ) | ||
| 93 | ) | ||
| 94 | |||
| 95 | if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe" | ||
| 96 | |||
| 97 | set PATH=%LUA_DIR%\bin;%PATH% | ||
| 98 | call %LUA% -v | ||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | :: Exports the following variables: | ||
| 103 | endlocal & set PATH=%PATH% | ||
| 104 | |||
| 105 | echo. | ||
| 106 | echo ====================================================== | ||
| 107 | if "%LUA%"=="luajit" ( | ||
| 108 | echo Installation of LuaJIT %LJ_VER% done. | ||
| 109 | ) else ( | ||
| 110 | echo Installation of Lua %LUA_VER% done. | ||
| 111 | ) | ||
| 112 | echo Platform - %platform% | ||
| 113 | echo LUA - %LUA% | ||
| 114 | echo LUA_SHORTV - %LUA_SHORTV% | ||
| 115 | echo LJ_SHORTV - %LJ_SHORTV% | ||
| 116 | echo. | ||
| 117 | echo ====================================================== | ||
| 118 | echo. | ||
| 119 | |||
| 120 | goto :eof | ||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | :: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'" | ||
| 140 | :: then try adding or removing blank lines lines above. | ||
| 141 | :: Yes, really. | ||
| 142 | :: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e | ||
| 143 | |||
| 144 | :: helper functions: | ||
| 145 | |||
| 146 | :: for bailing out when an error occurred | ||
| 147 | :die %1 | ||
| 148 | echo %1 | ||
| 149 | exit /B 1 | ||
| 150 | goto :eof | ||
| 151 | |||
diff --git a/appveyor.yml b/appveyor.yml index d92c3699..436c341b 100644 --- a/appveyor.yml +++ b/appveyor.yml | |||
| @@ -6,45 +6,28 @@ os: | |||
| 6 | shallow_clone: true | 6 | shallow_clone: true |
| 7 | 7 | ||
| 8 | environment: | 8 | environment: |
| 9 | LUAURL: http://www.lua.org/ftp | 9 | LUAROCKS_VER: 2.2.1 |
| 10 | LUAROCKS_REPO: http://rocks.moonscript.org | ||
| 11 | #LUA_VER: 5.3.0 | ||
| 12 | #LUA_SHORTV: 5.3 | ||
| 13 | 10 | ||
| 14 | matrix: | 11 | matrix: |
| 15 | - LUA_VER: 5.3.0 | ||
| 16 | LUA_SHORTV: 5.3 | ||
| 17 | |||
| 18 | - LUA_VER: 5.2.4 | ||
| 19 | LUA_SHORTV: 5.2 | ||
| 20 | |||
| 21 | - LUA_VER: 5.1.5 | 12 | - LUA_VER: 5.1.5 |
| 22 | LUA_SHORTV: 5.1 | 13 | - LUA_VER: 5.2.4 |
| 14 | - LUA_VER: 5.3.0 | ||
| 15 | - LJ_VER: 2.0.3 | ||
| 16 | - LJ_VER: 2.1 | ||
| 23 | 17 | ||
| 24 | init: | 18 | init: |
| 25 | - appveyor DownloadFile %LUAURL%/lua-%LUA_VER%.tar.gz | 19 | # Setup Lua development/build environment |
| 26 | - 7z x lua-%LUA_VER%.tar.gz | 20 | # Make VS 2013 command line tools available |
| 27 | - 7z x lua-%LUA_VER%.tar | 21 | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %platform% |
| 28 | - cd lua-%LUA_VER% | 22 | |
| 29 | - appveyor DownloadFile https://github.com/Tieske/luawinmake/archive/master.zip | 23 | install: |
| 30 | - 7z x master.zip | 24 | # Setup Lua development/build environment |
| 31 | - if not exist etc mkdir etc | 25 | - call .appveyor\install.bat |
| 32 | - mv luawinmake-master\etc\winmake.bat %APPVEYOR_BUILD_FOLDER%\lua-%LUA_VER%\etc\winmake.bat | ||
| 33 | - '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86' | ||
| 34 | - etc\winmake.bat | ||
| 35 | - etc\winmake.bat install c:\lua%LUA_VER% | ||
| 36 | - cd %APPVEYOR_BUILD_FOLDER% | ||
| 37 | 26 | ||
| 38 | build_script: | 27 | build_script: |
| 39 | - install.bat /LUA c:\lua%LUA_VER% /Q /LV %LUA_SHORTV% | 28 | - call .appveyor\build.bat |
| 40 | - set PATH=%PATH%;C:\Program Files (x86)\LuaRocks\2.2 | 29 | |
| 41 | - 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" | 30 | test_script: |
| 42 | - set LUA_CPATH="C:\Program Files (x86)\LuaRocks\systree\lib\lua\%LUA_SHORTV%\?.dll" | 31 | - echo "Testing..." |
| 43 | - luarocks | ||
| 44 | - cd test | 32 | - cd test |
| 45 | # split this to a different file | 33 | - call testing.bat |
| 46 | # test_version | ||
| 47 | - luarocks --version | ||
| 48 | # test_build_command | ||
| 49 | - appveyor DownloadFile %LUAROCKS_REPO%/stdlib-41.0.0-1.src.rock | ||
| 50 | - luarocks build stdlib | ||
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 @@ | |||
| 1 | @echo off | ||
| 2 | Setlocal EnableDelayedExpansion EnableExtensions | ||
| 3 | |||
| 4 | if not defined LUAROCKS_REPO set LUAROCKS_REPO=http://rocks.moonscript.org | ||
| 5 | |||
| 6 | appveyor DownloadFile %LUAROCKS_REPO%/stdlib-41.0.0-1.src.rock | ||
| 7 | luarocks build stdlib | ||
| 8 | |||
| 9 | endlocal | ||
