Skip to content

Commit 04bd7d7

Browse files
committed
CI Test on Windows (Mingw64)
1 parent 3575ad6 commit 04bd7d7

File tree

2 files changed

+76
-5
lines changed

2 files changed

+76
-5
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: "Unix build"
1+
name: "CI"
22

33
on: [push, pull_request]
44

55
jobs:
6-
test:
6+
unix:
77
strategy:
88
fail-fast: false
99
matrix:
@@ -44,3 +44,66 @@ jobs:
4444
- name: Busted tests
4545
run: |
4646
make test
47+
48+
49+
windows:
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
lua: [
54+
#{name: "lua51", exe: "lua5.1", version: 5.1, incdir: "/mingw64/include/lua5.1/"}, #(two tests are failing)
55+
{name: "lua53", exe: "lua5.3", version: 5.3, incdir: "/mingw64/include/lua5.3/"},
56+
{name: "lua", exe: "lua", version: 5.4, incdir: "/mingw64/include/"},
57+
{name: "luajit", exe: "luajit", version: 5.1, incdir: "/mingw64/include/luajit-2.1/"}
58+
]
59+
60+
runs-on: windows-latest
61+
defaults:
62+
run:
63+
shell: msys2 {0}
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: msys2/setup-msys2@v2
67+
with:
68+
msystem: MINGW64
69+
update: true
70+
install: git
71+
make
72+
mingw-w64-x86_64-toolchain
73+
mingw-w64-x86_64-libvips
74+
mingw-w64-x86_64-openslide
75+
mingw-w64-x86_64-libheif
76+
mingw-w64-x86_64-libjxl
77+
mingw-w64-x86_64-imagemagick
78+
mingw-w64-x86_64-poppler
79+
mingw-w64-x86_64-lua-luarocks
80+
mingw-w64-x86_64-${{ matrix.lua.name }}
81+
82+
- if: matrix.lua.name == 'lua51'
83+
name: Install bitop
84+
run: |
85+
pacman --noconfirm -S mingw-w64-x86_64-lua51-bitop
86+
87+
- name: Lua dependencies
88+
run: |
89+
if [[ ${{ matrix.lua.exe }} == lua5.3 ]]; then
90+
cp /mingw64/etc/luarocks/config-5.{4,3}.lua
91+
fi
92+
luarocks config --scope system lua_version ${{ matrix.lua.version }}
93+
luarocks config --scope system lua_interpreter ${{ matrix.lua.exe }}.exe
94+
luarocks config --scope system variables.LUA_DIR /mingw64/bin
95+
luarocks config --scope system variables.LUA_INCDIR ${{ matrix.lua.incdir }}
96+
make dev
97+
if [[ ${{ matrix.lua.exe }} != luajit ]]; then make ffi; fi
98+
99+
- name: Add to PATH
100+
run: |
101+
echo $RUNNER_TEMP/msys64/mingw64/bin:$HOME/.luarocks/bin >> $GITHUB_PATH
102+
103+
- name: Lint with luacheck
104+
run: |
105+
make lint
106+
107+
- name: Busted tests
108+
run: |
109+
busted.bat --lua=${{ matrix.lua.exe }} -o gtest -v .

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
DEV_ROCKS = "busted 2.2.0" "luacheck 1.1.2"
22
BUSTED_ARGS ?= -o gtest -v
3-
TEST_CMD ?= busted $(BUSTED_ARGS)
3+
LUACHECK_ARGS ?= -q
4+
5+
EXT =
6+
ifeq ($(OS),Windows_NT)
7+
EXT = ".bat"
8+
endif
9+
10+
TEST_CMD ?= busted$(EXT) $(BUSTED_ARGS)
11+
LINT_CMD ?= luacheck$(EXT) $(LUACHECK_ARGS)
412

513
.PHONY: dev ffi bit lint test
614

@@ -21,7 +29,7 @@ bit:
2129
@luarocks install luabitop
2230

2331
lint:
24-
@luacheck -q .
32+
@$(LINT_CMD) .
2533

2634
test:
27-
@$(TEST_CMD) spec/
35+
@$(TEST_CMD) spec

0 commit comments

Comments
 (0)