Skip to content

Commit 9d399d9

Browse files
caiohamamurausuario
authored andcommitted
Windows support: added building and testing github actions
1 parent ff4cdae commit 9d399d9

File tree

1 file changed

+114
-108
lines changed

1 file changed

+114
-108
lines changed

.github/workflows/build.yml

Lines changed: 114 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -59,95 +59,86 @@ jobs:
5959
# Sample job (that failed): https://github.com/nodemcu/nodemcu-firmware/actions/runs/17306868602/job/49131917376#step:3:153
6060
# => disable the Windows jobs for now
6161

62-
# build_luac_cross_win:
63-
64-
# runs-on: windows-2022
65-
66-
# steps:
67-
# - uses: actions/checkout@v4
68-
# with:
69-
# submodules: true
70-
# - name: Build luac.cross.exe
71-
# run: |
72-
# set
73-
# "C:\msys64\usr\bin\xargs.exe"
74-
# cd msvc
75-
# "%programfiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" /p:Configuration=Release /p:Platform=x64
76-
# mv luac-cross/x64/Release/luac.cross.exe ..
77-
# shell: cmd
78-
# - name: Upload luac.cross
79-
# if: ${{ success() }}
80-
# uses: actions/upload-artifact@v4
81-
# with:
82-
# name: luac.cross_51_float_win
83-
# path: luac.cross.exe
84-
85-
86-
compile_lua:
87-
62+
build_win:
63+
runs-on: windows-latest
8864
strategy:
8965
fail-fast: false
9066
matrix:
91-
lua_ver: [51, 53]
92-
numbers: ['float']
93-
filter: [ 'cat' ]
9467
include:
9568
- lua_ver: 51
96-
numbers: 'integral'
97-
filter: 'grep -v "lua_modules/lm92/lm92.lua\|lua_modules/hdc1000/HDC1000.lua\|lua_examples/u8g2/graphics_test.lua"'
69+
numbers: float
70+
- lua_ver: 51
71+
numbers: integral
9872
- lua_ver: 53
99-
numbers: '64bit'
100-
filter: 'cat'
101-
needs: build
102-
runs-on: ubuntu-22.04
73+
numbers: float
74+
- lua_ver: 53
75+
numbers: 64bit
76+
77+
env:
78+
LUA: ${{ matrix.lua_ver }}
79+
MSYSTEM: MINGW32
80+
CHERE_INVOKING: 1
10381

10482
steps:
105-
- name: Checkout repo
106-
uses: actions/checkout@v4
83+
- uses: actions/checkout@v4
10784
with:
108-
submodules: false
109-
- name: Download luac.cross
110-
uses: actions/download-artifact@v4
85+
submodules: true
86+
87+
- uses: msys2/setup-msys2@v2
11188
with:
112-
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}
113-
path: ./
114-
- name: Fix file permission
115-
run: chmod +x luac.cross
116-
- name: compile Lua
89+
update: true
90+
cache: true
91+
install: >-
92+
make
93+
gcc
94+
python
95+
python-pip
96+
unzip
97+
98+
- name: Setup Python venv
99+
shell: msys2 {0}
117100
run: |
118-
find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" echo
119-
find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" ./luac.cross -p
120-
shell: bash
101+
python -m venv .venv
102+
. .venv/bin/activate
103+
python -m pip install --upgrade pip
104+
pip install pyserial
121105
106+
- name: Build firmware
107+
shell: msys2 {0}
108+
run: |
109+
. .venv/bin/activate
110+
111+
EXTRA_FLAGS=""
112+
if [ "${{ matrix.numbers }}" = "integral" ]; then
113+
EXTRA_FLAGS="-DLUA_NUMBER_INTEGRAL"
114+
elif [ "${{ matrix.numbers }}" = "64bit" ]; then
115+
EXTRA_FLAGS="-DLUA_NUMBER_64BITS"
116+
fi
117+
make EXTRA_CCFLAGS=$EXTRA_FLAGS
118+
119+
if [ "${{ matrix.numbers }}" = "integral" ]; then
120+
mv -f luac.cross.int.exe luac.cross.exe
121+
fi
122+
123+
- name: Copy required DLLs
124+
shell: msys2 {0}
125+
run: |
126+
ldd luac.cross.exe | awk '{print $3}' | grep -vi "/c/windows" | xargs -I{} cp -v {} . || true
127+
ls *.dll
122128
123-
# compile_lua_win:
124-
125-
# strategy:
126-
# fail-fast: false
127-
# matrix:
128-
# lua_ver: [51]
129-
# numbers: ['float']
130-
# filter: [ 'cat' ]
131-
# needs: build_luac_cross_win
132-
# runs-on: windows-latest
133-
134-
# steps:
135-
# - name: Checkout repo
136-
# uses: actions/checkout@v4
137-
# with:
138-
# submodules: false
139-
# - name: Download luac.cross
140-
# uses: actions/download-artifact@v4
141-
# with:
142-
# name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
143-
# path: ./
144-
# - name: compile Lua
145-
# run: |
146-
# PATH="/C/Program\ Files/Git/usr/bin:${PATH}"
147-
# find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" echo
148-
# find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" ./luac.cross -p
149-
# shell: bash
129+
- name: Check build items
130+
shell: msys2 {0}
131+
run: |
132+
ls -ll bin/0x00000.bin bin/0x10000.bin luac.cross.exe
150133
134+
- name: Upload luac.cross
135+
if: ${{ success() }}
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
139+
path: |
140+
luac.cross.exe
141+
*.dll
151142
152143
NTest:
153144

@@ -191,39 +182,54 @@ jobs:
191182
shell: bash
192183

193184

194-
# NTest_win:
195-
196-
# strategy:
197-
# fail-fast: false
198-
# matrix:
199-
# lua_ver: [51]
200-
# numbers: ['float']
201-
# needs: build_luac_cross_win
202-
# runs-on: windows-latest
203-
204-
# steps:
205-
# - name: Checkout repo
206-
# uses: actions/checkout@v4
207-
# with:
208-
# submodules: false
209-
# - name: Download luac.cross
210-
# uses: actions/download-artifact@v4
211-
# with:
212-
# name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
213-
# path: ./
214-
# - name: NTest selfcheck
215-
# run: |
216-
# cd tests/NTest
217-
# ../../luac.cross.exe -e ../NTest/NTest_NTest.lua | tee log
218-
# grep "failed. 0" log
219-
# shell: bash
220-
# - name: NTest hosttests
221-
# run: |
222-
# cd tests
223-
# cp NTest/NTest.lua .
224-
# ../luac.cross.exe -e NTest_lua.lua | tee log
225-
# (if grep " ==> " log ; then exit 1 ; fi)
226-
# shell: bash
185+
NTest_win:
186+
187+
strategy:
188+
fail-fast: false
189+
matrix:
190+
include:
191+
- lua_ver: 51
192+
numbers: 'float'
193+
- lua_ver: 53
194+
numbers: 'float'
195+
- lua_ver: 51
196+
numbers: 'integral'
197+
- lua_ver: 53
198+
numbers: '64bit'
199+
200+
needs: build_win
201+
runs-on: windows-latest
202+
env:
203+
MSYSTEM: MINGW32
204+
CHERE_INVOKING: 1
205+
206+
steps:
207+
- name: Checkout repo
208+
uses: actions/checkout@v4
209+
with:
210+
submodules: false
211+
- name: Download luac.cross
212+
uses: actions/download-artifact@v4
213+
with:
214+
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
215+
path: ./
216+
- name: NTest selfcheck
217+
run: |
218+
cd tests/NTest
219+
../../luac.cross.exe -e ../NTest/NTest_NTest.lua | tee log
220+
if ((gc log | Select-String "failed: 0") -eq $null) {
221+
Throw "Errors were found during tests";
222+
}
223+
shell: pwsh
224+
225+
- name: NTest hosttests
226+
run: |
227+
cd tests
228+
cp NTest/NTest.lua .
229+
../luac.cross.exe -e NTest_lua.lua | tee log
230+
if ((gc log | Select-String " ==> ") -ne $null) {
231+
Throw "Errors were found during tests";
232+
}
227233
228234
229235
luacheck:

0 commit comments

Comments
 (0)