Skip to content

Commit 536223b

Browse files
committed
Windows support: added building and testing github actions
1 parent ff4cdae commit 536223b

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

.github/workflows/build.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,87 @@ jobs:
5555
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}
5656
path: luac.cross
5757

58+
build_win_msys2:
59+
runs-on: windows-latest
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
include:
64+
- lua_ver: 51
65+
numbers: float
66+
- lua_ver: 51
67+
numbers: integral
68+
- lua_ver: 53
69+
numbers: float
70+
- lua_ver: 53
71+
numbers: 64bit
72+
73+
env:
74+
LUA: ${{ matrix.lua_ver }}
75+
MSYSTEM: MINGW32
76+
CHERE_INVOKING: 1
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
with:
81+
submodules: true
82+
83+
- uses: msys2/setup-msys2@v2
84+
with:
85+
update: true
86+
cache: true
87+
install: >-
88+
make
89+
gcc
90+
python
91+
python-pip
92+
unzip
93+
94+
- name: Setup Python venv
95+
shell: msys2 {0}
96+
run: |
97+
python -m venv .venv
98+
. .venv/bin/activate
99+
python -m pip install --upgrade pip
100+
pip install pyserial
101+
102+
- name: Build firmware
103+
shell: msys2 {0}
104+
run: |
105+
. .venv/bin/activate
106+
107+
EXTRA_FLAGS=""
108+
if [ "${{ matrix.numbers }}" = "integral" ]; then
109+
EXTRA_FLAGS="-DLUA_NUMBER_INTEGRAL"
110+
elif [ "${{ matrix.numbers }}" = "64bit" ]; then
111+
EXTRA_FLAGS="-DLUA_NUMBER_64BITS"
112+
fi
113+
make EXTRA_CCFLAGS=$EXTRA_FLAGS
114+
115+
if [ "${{ matrix.numbers }}" = "integral" ]; then
116+
mv -f luac.cross.int.exe luac.cross.exe
117+
fi
118+
119+
- name: Copy required DLLs
120+
shell: msys2 {0}
121+
run: |
122+
ldd luac.cross.exe | awk '{print $3}' | grep -vi "/c/windows" | xargs -I{} cp -v {} . || true
123+
ls *.dll
124+
125+
- name: Check build items
126+
shell: msys2 {0}
127+
run: |
128+
ls -ll bin/0x00000.bin bin/0x10000.bin luac.cross.exe
129+
130+
- name: Upload luac.cross
131+
if: ${{ success() }}
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
135+
path: |
136+
luac.cross.exe
137+
*.dll
138+
58139
# The files in the 'msvc' folder would need to be updated to be compatible with VS 2022.
59140
# Sample job (that failed): https://github.com/nodemcu/nodemcu-firmware/actions/runs/17306868602/job/49131917376#step:3:153
60141
# => disable the Windows jobs for now
@@ -225,6 +306,54 @@ jobs:
225306
# (if grep " ==> " log ; then exit 1 ; fi)
226307
# shell: bash
227308

309+
NTest_win_msys2:
310+
311+
strategy:
312+
fail-fast: false
313+
matrix:
314+
include:
315+
- lua_ver: 51
316+
numbers: 'float'
317+
- lua_ver: 53
318+
numbers: 'float'
319+
- lua_ver: 51
320+
numbers: 'integral'
321+
- lua_ver: 53
322+
numbers: '64bit'
323+
324+
needs: build_win
325+
runs-on: windows-latest
326+
env:
327+
MSYSTEM: MINGW32
328+
CHERE_INVOKING: 1
329+
330+
steps:
331+
- name: Checkout repo
332+
uses: actions/checkout@v4
333+
with:
334+
submodules: false
335+
- name: Download luac.cross
336+
uses: actions/download-artifact@v4
337+
with:
338+
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
339+
path: ./
340+
- name: NTest selfcheck
341+
run: |
342+
cd tests/NTest
343+
../../luac.cross.exe -e ../NTest/NTest_NTest.lua | tee log
344+
if ((gc log | Select-String "failed: 0") -eq $null) {
345+
Throw "Errors were found during tests";
346+
}
347+
shell: pwsh
348+
349+
- name: NTest hosttests
350+
run: |
351+
cd tests
352+
cp NTest/NTest.lua .
353+
../luac.cross.exe -e NTest_lua.lua | tee log
354+
if ((gc log | Select-String " ==> ") -ne $null) {
355+
Throw "Errors were found during tests";
356+
}
228357
229358
luacheck:
230359

0 commit comments

Comments
 (0)