diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 603eaf2b6..39ad3cdd4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,6 +28,13 @@ jobs: fail-fast: false matrix: include: + - test_name: "lua5.4" + lua_version: "5.4" + lua_name: "lua5.4" + lua_library: "/usr/local/lib/liblua.a" + lua_include: "/usr/local/include" + manual_screens: true + - test_name: "codecov-lua5.3" lua_version: "5.3" lua_name: "lua5.3" @@ -136,24 +143,36 @@ jobs: run: sudo dpkg -i /var/cache/apt/archives/*.deb - name: Install Lua packages + if: matrix.lua_version != '5.4' run: | if [ "${{ matrix.lua_name }}" = "luajit" ]; then sudo apt-get install libluajit-5.1-dev luajit fi sudo apt-get install liblua${{ matrix.lua_version }}-dev lua${{ matrix.lua_version }} + # Ubuntu 20.04 hasn't a package for Lua 5.4, we need to build it from source. + - name: Build and Install Lua 5.4 + if: matrix.lua_version == '5.4' + run: | + wget -O /tmp/lua-5.4.3.tar.gz http://www.lua.org/ftp/lua-5.4.3.tar.gz + tar -xf /tmp/lua-5.4.3.tar.gz -C /tmp + cd /tmp/lua-5.4.3 + make all + make test + sudo make install + - name: Cache luarocks id: cache-luarocks uses: actions/cache@v2 with: path: /tmp/luarocks # The build input for luarocks changes per test, so we need separate caches - key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.test_name }}-luarocks-3.5.0 + key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.test_name }}-luarocks-3.8.0 - name: Install fresh Luarocks if: steps.cache-luarocks.outputs.cache-hit != 'true' run: | - wget -O /tmp/luarocks.tar.gz https://github.com/luarocks/luarocks/archive/v3.5.0.tar.gz + wget -O /tmp/luarocks.tar.gz https://github.com/luarocks/luarocks/archive/v3.8.0.tar.gz mkdir /tmp/luarocks tar -xf /tmp/luarocks.tar.gz -C /tmp/luarocks --strip-components=1 cd /tmp/luarocks @@ -189,9 +208,22 @@ jobs: cd /tmp/xcb-errors sudo make install + # Only LGI git master supports Lua 5.4. We need to build it from source. + - name: Build and Install LGI + if: matrix.lua_version == '5.4' + run: | + wget -O /tmp/lgi.zip https://github.com/pavouk/lgi/archive/refs/heads/master.zip + unzip /tmp/lgi.zip -d /tmp + cd /tmp/lgi-master + sed -i 's/5.1/5.4/' lgi/Makefile + make all + sudo make install + - name: Install rocks run: | - sudo -H luarocks install lgi ${{ matrix.lgi_version }} + if [ "${{ matrix.lua_name }}" != "lua5.4" ]; then + sudo -H luarocks install lgi ${{ matrix.lgi_version }} + fi sudo -H luarocks install ldoc sudo -H luarocks install busted diff --git a/awesome.c b/awesome.c index 07d8c82ea..2b17c725f 100644 --- a/awesome.c +++ b/awesome.c @@ -84,10 +84,16 @@ init_rng(void) lua_getfield(L, -1, "randomseed"); /* Push a seed */ - lua_pushnumber(L, g_random_int() + g_random_double()); + lua_pushnumber(L, g_random_int()); /* Call math.randomseed */ - lua_call(L, 1, 0); + if(lua_pcall(L, 1, 0, 0)) + { + warn("Random number generator initialization failed: %s", lua_tostring(L, -1)); + /* Remove error function and error string */ + lua_pop(L, 2); + return; + } /* Remove "math" global */ lua_pop(L, 1); diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 5f292aaa0..592c2b252 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -73,9 +73,9 @@ if (NOT LUA_FOUND) endif() set(LUA_FULL_VERSION "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") -# 5.1 <= LUA_VERSION < 5.4 -if(NOT ((LUA_FULL_VERSION VERSION_EQUAL 5.1.0 OR LUA_FULL_VERSION VERSION_GREATER 5.1.0) AND LUA_FULL_VERSION VERSION_LESS 5.4.0)) - message(FATAL_ERROR "Awesome only supports Lua versions 5.1-5.3, please refer to" +# 5.1 <= LUA_VERSION < 5.5 +if(NOT ((LUA_FULL_VERSION VERSION_EQUAL 5.1.0 OR LUA_FULL_VERSION VERSION_GREATER 5.1.0) AND LUA_FULL_VERSION VERSION_LESS 5.5.0)) + message(FATAL_ERROR "Awesome only supports Lua versions 5.1-5.4, please refer to" "https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") endif() diff --git a/luaa.h b/luaa.h index fae072702..04e283422 100644 --- a/luaa.h +++ b/luaa.h @@ -31,8 +31,8 @@ #include "common/lualib.h" #include "common/luaclass.h" -#if !(501 <= LUA_VERSION_NUM && LUA_VERSION_NUM < 504) -#error "Awesome only supports Lua versions 5.1-5.3 and LuaJIT2, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building" +#if !(501 <= LUA_VERSION_NUM && LUA_VERSION_NUM < 505) +#error "Awesome only supports Lua versions 5.1-5.4 and LuaJIT2, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building" #endif #define luaA_deprecate(L, repl) \