From 04bd7d7e8a44ff12fd08ec69e9297722814041f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20L=C3=B6tscher?= Date: Thu, 21 Mar 2024 06:27:25 +0100 Subject: [PATCH] CI Test on Windows (Mingw64) --- .github/workflows/ci.yml | 67 ++++++++++++++++++++++++++++++++++++++-- Makefile | 14 +++++++-- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cda3a12..78e1619 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,9 @@ -name: "Unix build" +name: "CI" on: [push, pull_request] jobs: - test: + unix: strategy: fail-fast: false matrix: @@ -44,3 +44,66 @@ jobs: - name: Busted tests run: | make test + + + windows: + strategy: + fail-fast: false + matrix: + lua: [ + #{name: "lua51", exe: "lua5.1", version: 5.1, incdir: "/mingw64/include/lua5.1/"}, #(two tests are failing) + {name: "lua53", exe: "lua5.3", version: 5.3, incdir: "/mingw64/include/lua5.3/"}, + {name: "lua", exe: "lua", version: 5.4, incdir: "/mingw64/include/"}, + {name: "luajit", exe: "luajit", version: 5.1, incdir: "/mingw64/include/luajit-2.1/"} + ] + + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v4 + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: git + make + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-libvips + mingw-w64-x86_64-openslide + mingw-w64-x86_64-libheif + mingw-w64-x86_64-libjxl + mingw-w64-x86_64-imagemagick + mingw-w64-x86_64-poppler + mingw-w64-x86_64-lua-luarocks + mingw-w64-x86_64-${{ matrix.lua.name }} + + - if: matrix.lua.name == 'lua51' + name: Install bitop + run: | + pacman --noconfirm -S mingw-w64-x86_64-lua51-bitop + + - name: Lua dependencies + run: | + if [[ ${{ matrix.lua.exe }} == lua5.3 ]]; then + cp /mingw64/etc/luarocks/config-5.{4,3}.lua + fi + luarocks config --scope system lua_version ${{ matrix.lua.version }} + luarocks config --scope system lua_interpreter ${{ matrix.lua.exe }}.exe + luarocks config --scope system variables.LUA_DIR /mingw64/bin + luarocks config --scope system variables.LUA_INCDIR ${{ matrix.lua.incdir }} + make dev + if [[ ${{ matrix.lua.exe }} != luajit ]]; then make ffi; fi + + - name: Add to PATH + run: | + echo $RUNNER_TEMP/msys64/mingw64/bin:$HOME/.luarocks/bin >> $GITHUB_PATH + + - name: Lint with luacheck + run: | + make lint + + - name: Busted tests + run: | + busted.bat --lua=${{ matrix.lua.exe }} -o gtest -v . diff --git a/Makefile b/Makefile index a7a848b..755b614 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,14 @@ DEV_ROCKS = "busted 2.2.0" "luacheck 1.1.2" BUSTED_ARGS ?= -o gtest -v -TEST_CMD ?= busted $(BUSTED_ARGS) +LUACHECK_ARGS ?= -q + +EXT = +ifeq ($(OS),Windows_NT) + EXT = ".bat" +endif + +TEST_CMD ?= busted$(EXT) $(BUSTED_ARGS) +LINT_CMD ?= luacheck$(EXT) $(LUACHECK_ARGS) .PHONY: dev ffi bit lint test @@ -21,7 +29,7 @@ bit: @luarocks install luabitop lint: - @luacheck -q . + @$(LINT_CMD) . test: - @$(TEST_CMD) spec/ + @$(TEST_CMD) spec