feat(Github Action): Add all version in test action (#292)

This commit is contained in:
iThorgrim
2025-08-28 21:13:16 +02:00
committed by GitHub
parent 1f087fef39
commit df36094b97
5 changed files with 66 additions and 4 deletions

14
.github/workflows/build-lua51.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Build mod-eluna with Lua51 🌙
on:
push:
branches:
- 'master'
- 'main'
pull_request:
jobs:
build_lua51:
uses: ./.github/workflows/core-build-base.yml
with:
lua_version: 'lua51'

14
.github/workflows/build-lua53.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Build mod-eluna with Lua53 🌙
on:
push:
branches:
- 'master'
- 'main'
pull_request:
jobs:
build_lua53:
uses: ./.github/workflows/core-build-base.yml
with:
lua_version: 'lua53'

14
.github/workflows/build-lua54.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Build mod-eluna with Lua54 🌙
on:
push:
branches:
- 'master'
- 'main'
pull_request:
jobs:
build_lua54:
uses: ./.github/workflows/core-build-base.yml
with:
lua_version: 'lua54'

View File

@@ -54,9 +54,15 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(${LUA_VERSION})
# Easen warnings
# Easen warnings - disable Werror for Lua sources
string(REGEX REPLACE "( |^)/W[0-9]( |$)" "\\1/W2\\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "( |^)/W[0-9]( |$)" "\\1/W2\\2" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# Remove -Werror from flags for Lua compilation
string(REGEX REPLACE "-Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# Also remove any warning-as-error flags
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(LUA_SOURCE_FOLDER "${${LUA_VERSION}_SOURCE_DIR}/src")
@@ -100,10 +106,11 @@ if (WIN32)
endif()
elseif (APPLE)
target_compile_definitions(lualib PUBLIC LUA_USE_MACOSX)
target_compile_options(lualib PRIVATE -Wno-deprecated-declarations -Wno-empty-body)
target_compile_options(lualib PRIVATE -Wno-deprecated-declarations -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
target_link_libraries(lualib readline)
elseif (UNIX)
target_compile_definitions(lualib PUBLIC LUA_USE_LINUX)
target_compile_options(lualib PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
target_link_libraries(lualib ${CMAKE_DL_LIBS} m readline)
set_target_properties(lualib PROPERTIES OUTPUT_NAME ${LUA_VERSION})
endif()
@@ -111,6 +118,9 @@ endif()
add_executable(lua_interpreter ${LUA_SOURCE_FOLDER}/lua.c)
target_link_libraries(lua_interpreter lualib)
target_compile_definitions(lua_interpreter PRIVATE _CRT_SECURE_NO_WARNINGS)
if (NOT WIN32)
target_compile_options(lua_interpreter PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
endif()
set_target_properties(lua_interpreter PROPERTIES OUTPUT_NAME ${LUA_VERSION}_interpreter)
if (WIN32)
install(TARGETS lua_interpreter DESTINATION "${CMAKE_INSTALL_PREFIX}")
@@ -122,6 +132,9 @@ endif()
add_executable(lua_compiler ${LUA_SOURCE_FOLDER}/luac.c)
target_link_libraries(lua_compiler lualib)
target_compile_definitions(lua_compiler PRIVATE _CRT_SECURE_NO_WARNINGS)
if (NOT WIN32)
target_compile_options(lua_compiler PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
endif()
set_target_properties(lua_compiler PROPERTIES OUTPUT_NAME ${LUA_VERSION}_compiler)
if (WIN32)
install(TARGETS lua_compiler DESTINATION "${CMAKE_INSTALL_PREFIX}")

View File

@@ -29,6 +29,13 @@
project ( lua C )
# Remove -Werror from flags for LuaJIT compilation
string(REGEX REPLACE "-Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# Also remove any warning-as-error flags
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# Download source
include(FetchContent)
FetchContent_Declare(
@@ -131,7 +138,7 @@ if (UNIX OR APPLE)
add_custom_command(
OUTPUT ${LUAJIT_LIB_PATH}
# COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} PREFIX=${LUA_INSTALL_PATH}
COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} install PREFIX=${LUA_INSTALL_PATH}
COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} install PREFIX=${LUA_INSTALL_PATH} "CFLAGS=-O2 -fomit-frame-pointer -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int"
)
# endif()
add_custom_target(luajit_target DEPENDS ${LUAJIT_LIB_PATH})