Skip to content

Commit dc4d15a

Browse files
committed
Additional github workflow action for automatic test under Windows
1 parent 80b0675 commit dc4d15a

14 files changed

+403
-13
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*.tar.gz
2+
/*.zst
3+
/pkg
4+
/src
5+
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
diff file generated from Sutou Kouhei PR -> https://github.com/luarocks/luarocks/pull/1230/files
2+
diff -Naur luarocks-3.7.0.orig/spec/util/test_env.lua luarocks-3.7.0/spec/util/test_env.lua
3+
--- luarocks-3.7.0.orig/spec/util/test_env.lua 2021-04-13 23:53:36.000000000 +0200
4+
+++ luarocks-3.7.0/spec/util/test_env.lua 2021-07-25 17:43:16.413491100 +0200
5+
@@ -248,6 +248,8 @@
6+
test_env.MINGW = true
7+
elseif argument == "vs" then
8+
test_env.MINGW = false
9+
+ elseif argument == "msys2_mingw_w64" then
10+
+ test_env.MSYS2_MINGW_W64 = true
11+
elseif argument:find("^lua_dir=") then
12+
test_env.LUA_DIR = argument:match("^lua_dir=(.*)$")
13+
elseif argument:find("^lua_interpreter=") then
14+
@@ -429,7 +431,9 @@
15+
return execute_output("find " .. path .. " -type f -exec stat -f \"%z %N\" {} \\; | md5")
16+
elseif test_env.TEST_TARGET_OS == "windows" then
17+
return execute_output("\"" .. Q(test_env.testing_paths.win_tools .. "/find") .. " " .. Q(path)
18+
- .. " -printf \"%s %p\"\" > temp_sum.txt && certUtil -hashfile temp_sum.txt && del temp_sum.txt")
19+
+ .. " -printf \"%s %p\"\" > temp_sum.txt && "
20+
+ .. "C:\\Windows\\System32\\certUtil -hashfile temp_sum.txt && "
21+
+ .. "del temp_sum.txt")
22+
end
23+
end
24+
25+
@@ -823,10 +827,14 @@
26+
if test_env.TEST_TARGET_OS == "windows" then
27+
if test_env.MINGW then
28+
table.insert(lines, [[SYSTEM = "mingw",]])
29+
+ elseif test_env.MSYS2_MINGW_W64 then
30+
+ table.insert(lines, [[SYSTEM = "msys2_mingw_w64",]])
31+
else
32+
table.insert(lines, [[SYSTEM = "windows",]])
33+
end
34+
- table.insert(lines, ("WIN_TOOLS = %q,"):format(testing_paths.win_tools))
35+
+ if not test_env.MSYS2_MINGW_W64 then
36+
+ table.insert(lines, ("WIN_TOOLS = %q,"):format(testing_paths.win_tools))
37+
+ end
38+
end
39+
40+
table.insert(lines, "}")
41+
diff -Naur luarocks-3.7.0.orig/src/luarocks/core/cfg.lua luarocks-3.7.0/src/luarocks/core/cfg.lua
42+
--- luarocks-3.7.0.orig/src/luarocks/core/cfg.lua 2021-04-13 23:53:36.000000000 +0200
43+
+++ luarocks-3.7.0/src/luarocks/core/cfg.lua 2021-07-25 17:51:51.829906200 +0200
44+
@@ -414,6 +414,7 @@
45+
defaults.makefile = "Makefile"
46+
defaults.cmake_generator = "MSYS Makefiles"
47+
defaults.local_cache = home.."/.cache/luarocks"
48+
+ defaults.variables.PWD = "cd"
49+
defaults.variables.MAKE = "make"
50+
defaults.variables.CC = "gcc"
51+
defaults.variables.RC = "windres"
52+
@@ -745,7 +749,7 @@
53+
54+
local defaults = make_defaults(cfg.lua_version, processor, platforms, cfg.home)
55+
56+
- if platforms.windows and hardcoded.WIN_TOOLS then
57+
+ if platforms.windows and not platforms.msys2_mingw_w64 and hardcoded.WIN_TOOLS then
58+
local tools = { "SEVENZ", "CP", "FIND", "LS", "MD5SUM", "WGET", }
59+
for _, tool in ipairs(tools) do
60+
defaults.variables[tool] = '"' .. hardcoded.WIN_TOOLS .. "/" .. defaults.variables[tool] .. '.exe"'
61+
diff -Naur luarocks-3.7.0.orig/src/luarocks/fs/msys2_mingw_w64.lua luarocks-3.7.0/src/luarocks/fs/msys2_mingw_w64.lua
62+
--- luarocks-3.7.0.orig/src/luarocks/fs/msys2_mingw_w64.lua 1970-01-01 01:00:00.000000000 +0100
63+
+++ luarocks-3.7.0/src/luarocks/fs/msys2_mingw_w64.lua 2021-07-25 17:52:51.477791300 +0200
64+
@@ -0,0 +1,12 @@
65+
+--- MSYS2 + Mingw-w64 implementation of filesystem and platform abstractions.
66+
+local msys2_mingw_w64 = {}
67+
+
68+
+local unix_tools = require("luarocks.fs.unix.tools")
69+
+
70+
+msys2_mingw_w64.zip = unix_tools.zip
71+
+msys2_mingw_w64.unzip = unix_tools.unzip
72+
+msys2_mingw_w64.gunzip = unix_tools.gunzip
73+
+msys2_mingw_w64.bunzip2 = unix_tools.bunzip2
74+
+msys2_mingw_w64.copy_contents = unix_tools.copy_contents
75+
+
76+
+return msys2_mingw_w64
77+
\ No newline at end of file
78+
diff -Naur luarocks-3.7.0.orig/src/luarocks/fs/unix/tools.lua luarocks-3.7.0/src/luarocks/fs/unix/tools.lua
79+
--- luarocks-3.7.0.orig/src/luarocks/fs/unix/tools.lua 2021-04-13 23:53:36.000000000 +0200
80+
+++ luarocks-3.7.0/src/luarocks/fs/unix/tools.lua 2021-07-25 17:54:45.618437900 +0200
81+
@@ -152,13 +152,13 @@
82+
end
83+
end
84+
85+
-local function uncompress(default_ext, program, infile, outfile)
86+
+local function uncompress(default_ext, program, uncompress_flag, infile, outfile)
87+
assert(type(infile) == "string")
88+
assert(outfile == nil or type(outfile) == "string")
89+
if not outfile then
90+
outfile = infile:gsub("%."..default_ext.."$", "")
91+
end
92+
- if fs.execute(fs.Q(program).." -c "..fs.Q(infile).." > "..fs.Q(outfile)) then
93+
+ if fs.execute(fs.Q(program).." "..fs.Q(uncompress_flag).." -c "..fs.Q(infile).." > "..fs.Q(outfile)) then
94+
return true
95+
else
96+
return nil, "failed extracting " .. infile
97+
@@ -171,7 +171,7 @@
98+
-- If not given, name is derived from input file.
99+
-- @return boolean: true on success; nil and error message on failure.
100+
function tools.gunzip(infile, outfile)
101+
- return uncompress("gz", "gunzip", infile, outfile)
102+
+ return uncompress("gz", "gzip", "-d", infile, outfile)
103+
end
104+
105+
--- Uncompresses a .bz2 file.
106+
@@ -180,7 +180,7 @@
107+
-- If not given, name is derived from input file.
108+
-- @return boolean: true on success; nil and error message on failure.
109+
function tools.bunzip2(infile, outfile)
110+
- return uncompress("bz2", "bunzip2", infile, outfile)
111+
+ return uncompress("bz2", "bzip2", "-d", infile, outfile)
112+
end
113+
114+
do
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Modified PKGBUILD, see https://github.com/msys2/MINGW-packages/pull/12002
3+
#
4+
# Maintainer: Ricky Wu <[email protected]>
5+
# Contributor: ImperatorS79 <[email protected]>
6+
# Contributoor: Ray Donnelly <[email protected]>
7+
8+
_realname=luarocks
9+
pkgbase=mingw-w64-lua-${_realname}
10+
pkgname=("${MINGW_PACKAGE_PREFIX}-lua-${_realname}")
11+
pkgver=3.9.0
12+
pkgrel=2
13+
pkgdesc="the package manager for Lua modules (mingw-w64)"
14+
arch=('any')
15+
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
16+
install=${_realname}-${MSYSTEM}.install
17+
url="https://luarocks.org"
18+
license=("MIT")
19+
depends=("${MINGW_PACKAGE_PREFIX}-lua"
20+
"unzip"
21+
"zip")
22+
makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-autotools")
23+
options=('staticlibs' 'strip')
24+
source=("https://luarocks.org/releases/${_realname}-${pkgver}.tar.gz"
25+
"0001-luarocks_msys2_mingw_w64.patch")
26+
sha256sums=('5e840f0224891de96be4139e9475d3b1de7af3a32b95c1bdf05394563c60175f'
27+
'4ac1ec6372899693548d2d7d575f312d704b6883b50c8d4d3740f47a8e08eef3')
28+
29+
prepare() {
30+
cd "${srcdir}/${_realname}-${pkgver}"
31+
patch -p1 -i "${srcdir}"/0001-luarocks_msys2_mingw_w64.patch
32+
}
33+
34+
build() {
35+
cd "${srcdir}/${_realname}-${pkgver}"
36+
./configure --prefix=${MINGW_PREFIX} --lua-version=5.4 --with-lua-interpreter=lua.exe
37+
make ./build/luarocks ./build/luarocks-admin ./build/config-5.4.lua
38+
make LUA_VERSION=5.1 LUA_INTERPRETER=lua5.1.exe LUA_INCDIR=${MINGW_PREFIX}/include/lua5.1 ./build/config-5.1.lua
39+
}
40+
41+
package() {
42+
cd "${srcdir}/${_realname}-${pkgver}"
43+
make DESTDIR="${pkgdir}" install
44+
make DESTDIR="$pkgdir" LUA_VERSION=5.1 install-config
45+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MINGW_PREFIX=/clang32
2+
3+
post_install() {
4+
PREFIX_WIN=$(cygpath -m ${MINGW_PREFIX})
5+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
6+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.1.lua
7+
8+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
9+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.4.lua
10+
11+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
12+
-i ${MINGW_PREFIX}/bin/luarocks
13+
14+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
15+
-i ${MINGW_PREFIX}/bin/luarocks-admin
16+
17+
}
18+
19+
post_upgrade() {
20+
post_install
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MINGW_PREFIX=/clang64
2+
3+
post_install() {
4+
PREFIX_WIN=$(cygpath -m ${MINGW_PREFIX})
5+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
6+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.1.lua
7+
8+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
9+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.4.lua
10+
11+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
12+
-i ${MINGW_PREFIX}/bin/luarocks
13+
14+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
15+
-i ${MINGW_PREFIX}/bin/luarocks-admin
16+
17+
}
18+
19+
post_upgrade() {
20+
post_install
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MINGW_PREFIX=/mingw32
2+
3+
post_install() {
4+
PREFIX_WIN=$(cygpath -m ${MINGW_PREFIX})
5+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
6+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.1.lua
7+
8+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
9+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.4.lua
10+
11+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
12+
-i ${MINGW_PREFIX}/bin/luarocks
13+
14+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
15+
-i ${MINGW_PREFIX}/bin/luarocks-admin
16+
17+
}
18+
19+
post_upgrade() {
20+
post_install
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MINGW_PREFIX=/mingw64
2+
3+
post_install() {
4+
PREFIX_WIN=$(cygpath -m ${MINGW_PREFIX})
5+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
6+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.1.lua
7+
8+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
9+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.4.lua
10+
11+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
12+
-i ${MINGW_PREFIX}/bin/luarocks
13+
14+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
15+
-i ${MINGW_PREFIX}/bin/luarocks-admin
16+
17+
}
18+
19+
post_upgrade() {
20+
post_install
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MINGW_PREFIX=/ucrt64
2+
3+
post_install() {
4+
PREFIX_WIN=$(cygpath -m ${MINGW_PREFIX})
5+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
6+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.1.lua
7+
8+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
9+
-i ${MINGW_PREFIX}/etc/luarocks/config-5.4.lua
10+
11+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
12+
-i ${MINGW_PREFIX}/bin/luarocks
13+
14+
sed -s "s|${MINGW_PREFIX}|${PREFIX_WIN}|g" \
15+
-i ${MINGW_PREFIX}/bin/luarocks-admin
16+
17+
}
18+
19+
post_upgrade() {
20+
post_install
21+
}

.github/workflows/test-windows.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: test-windows
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
test:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
os: [windows-latest]
11+
luaVersion: ["5.4"]
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
defaults:
16+
run:
17+
shell: msys2 {0}
18+
19+
steps:
20+
- shell: cmd
21+
run: git config --global core.autocrlf input
22+
23+
- uses: actions/checkout@master
24+
25+
- uses: msys2/setup-msys2@v2
26+
with:
27+
msystem: mingw64
28+
pacboy: >-
29+
binutils:
30+
patch:
31+
zip:
32+
unzip:
33+
cc:p
34+
libltdl:p
35+
libtool:p
36+
pkgconf:p
37+
autotools:p
38+
lua:p
39+
cairo:p
40+
41+
- name: setup-luarocks
42+
shell: msys2 {0}
43+
run: |
44+
uname -a
45+
pwd
46+
echo "-----------------------------------------------------------"
47+
echo "-- Workaround for msys2-luarocks bug, "
48+
echo "-- see: https://github.com/msys2/MINGW-packages/pull/12002 "
49+
echo "-----------------------------------------------------------"
50+
cd .github/workflows/mingw-w64-lua-luarocks
51+
makepkg-mingw -isCf --noconfirm
52+
cd -
53+
echo "-----------------------------------------------------------"
54+
type lua
55+
type luarocks
56+
lua -v
57+
luarocks
58+
luarocks install luafilesystem
59+
60+
- name: setup-lwtk
61+
shell: msys2 {0}
62+
run: |
63+
luarocks install lpath
64+
luarocks install oocairo
65+
luarocks install https://luarocks.org/manifests/xavier-wang/luautf8-0.1.5-2.rockspec
66+
luarocks --server=https://luarocks.org/dev install lpugl
67+
luarocks --server=https://luarocks.org/dev install lpugl_cairo
68+
luarocks --server=https://luarocks.org/dev install lpugl_opengl
69+
echo "-----------------------------------------------------------"
70+
luarocks make lwtk-scm-0.rockspec
71+
echo "-----------------------------------------------------------"
72+
73+
- name: alltests
74+
shell: msys2 {0}
75+
run: |
76+
set -e
77+
lua -v
78+
echo "-----------------------------------------------------------"
79+
lua src/alltests.lua src/tests
80+
echo "-----------------------------------------------------------"
81+
82+
- name: doctest
83+
shell: msys2 {0}
84+
run: |
85+
set -e
86+
lua -v
87+
cd src
88+
lua -e 'print("package.path=", package.path)'
89+
export LUA_PATH='.\?.lua;.\?\init.lua;'"$(lua -e 'print(package.path)')"
90+
echo "LUA_PATH=$LUA_PATH"
91+
lua -e 'print("package.path=", package.path)'
92+
echo "-----------------------------------------------------------"
93+
lua doctest.lua
94+
echo "-----------------------------------------------------------"
95+

0 commit comments

Comments
 (0)