Skip to content

Commit 5155aa8

Browse files
committed
Windows support: added building and testing github actions
1 parent ec95c38 commit 5155aa8

File tree

1 file changed

+86
-80
lines changed

1 file changed

+86
-80
lines changed

.github/workflows/build.yml

Lines changed: 86 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -56,95 +56,86 @@ jobs:
5656
path: luac.cross
5757

5858

59-
build_luac_cross_win:
60-
61-
runs-on: windows-2019
62-
63-
steps:
64-
- uses: actions/checkout@v4
65-
with:
66-
submodules: true
67-
- name: Build luac.cross.exe
68-
run: |
69-
set
70-
"%programfiles%\git\usr\bin\xargs"
71-
cd msvc
72-
"%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" /p:Configuration=Release /p:Platform=x64
73-
mv luac-cross/x64/Release/luac.cross.exe ..
74-
shell: cmd
75-
- name: Upload luac.cross
76-
if: ${{ success() }}
77-
uses: actions/upload-artifact@v4
78-
with:
79-
name: luac.cross_51_float_win
80-
path: luac.cross.exe
81-
82-
83-
compile_lua:
84-
59+
build_win:
60+
runs-on: windows-latest
8561
strategy:
8662
fail-fast: false
8763
matrix:
88-
lua_ver: [51, 53]
89-
numbers: ['float']
90-
filter: [ 'cat' ]
9164
include:
9265
- lua_ver: 51
93-
numbers: 'integral'
94-
filter: 'grep -v "lua_modules/lm92/lm92.lua\|lua_modules/hdc1000/HDC1000.lua\|lua_examples/u8g2/graphics_test.lua"'
66+
numbers: float
67+
- lua_ver: 51
68+
numbers: integral
9569
- lua_ver: 53
96-
numbers: '64bit'
97-
filter: 'cat'
98-
needs: build
99-
runs-on: ubuntu-22.04
70+
numbers: float
71+
- lua_ver: 53
72+
numbers: 64bit
73+
74+
env:
75+
LUA: ${{ matrix.lua_ver }}
76+
MSYSTEM: MINGW32
77+
CHERE_INVOKING: 1
10078

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

@@ -193,10 +184,21 @@ jobs:
193184
strategy:
194185
fail-fast: false
195186
matrix:
196-
lua_ver: [51]
197-
numbers: ['float']
198-
needs: build_luac_cross_win
187+
include:
188+
- lua_ver: 51
189+
numbers: 'float'
190+
- lua_ver: 53
191+
numbers: 'float'
192+
- lua_ver: 51
193+
numbers: 'integral'
194+
- lua_ver: 53
195+
numbers: '64bit'
196+
197+
needs: build_win
199198
runs-on: windows-latest
199+
env:
200+
MSYSTEM: MINGW32
201+
CHERE_INVOKING: 1
200202

201203
steps:
202204
- name: Checkout repo
@@ -212,15 +214,19 @@ jobs:
212214
run: |
213215
cd tests/NTest
214216
../../luac.cross.exe -e ../NTest/NTest_NTest.lua | tee log
215-
grep "failed. 0" log
216-
shell: bash
217+
if ((gc log | Select-String "failed: 0") -eq $null) {
218+
Throw "Errors were found during tests";
219+
}
220+
shell: pwsh
221+
217222
- name: NTest hosttests
218223
run: |
219224
cd tests
220225
cp NTest/NTest.lua .
221226
../luac.cross.exe -e NTest_lua.lua | tee log
222-
(if grep " ==> " log ; then exit 1 ; fi)
223-
shell: bash
227+
if ((gc log | Select-String " ==> ") -ne $null) {
228+
Throw "Errors were found during tests";
229+
}
224230
225231
226232
luacheck:

0 commit comments

Comments
 (0)