Skip to content

Commit 9c02252

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

File tree

1 file changed

+83
-80
lines changed

1 file changed

+83
-80
lines changed

.github/workflows/build.yml

Lines changed: 83 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -56,95 +56,83 @@ 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+
test -e luac.cross.int.exe && mv luac.cross.int.exe luac.cross.exe
116+
117+
- name: Copy required DLLs
118+
shell: msys2 {0}
119+
run: |
120+
ldd luac.cross.exe | awk '{print $3}' | grep -vi "/c/windows" | xargs -I{} cp -v {} . || true
121+
ls *.dll
119122
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
123+
- name: Check build items
124+
shell: msys2 {0}
125+
run: |
126+
ls -ll bin/0x00000.bin bin/0x10000.bin luac.cross.exe
130127
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
128+
- name: Upload luac.cross
129+
if: ${{ success() }}
130+
uses: actions/upload-artifact@v4
138131
with:
139132
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-
133+
path: |
134+
luac.cross.exe
135+
*.dll
148136
149137
NTest:
150138

@@ -193,10 +181,21 @@ jobs:
193181
strategy:
194182
fail-fast: false
195183
matrix:
196-
lua_ver: [51]
197-
numbers: ['float']
198-
needs: build_luac_cross_win
184+
include:
185+
- lua_ver: 51
186+
numbers: 'float'
187+
- lua_ver: 53
188+
numbers: 'float'
189+
- lua_ver: 51
190+
numbers: 'integral'
191+
- lua_ver: 53
192+
numbers: '64bit'
193+
194+
needs: build_win
199195
runs-on: windows-latest
196+
env:
197+
MSYSTEM: MINGW32
198+
CHERE_INVOKING: 1
200199

201200
steps:
202201
- name: Checkout repo
@@ -212,15 +211,19 @@ jobs:
212211
run: |
213212
cd tests/NTest
214213
../../luac.cross.exe -e ../NTest/NTest_NTest.lua | tee log
215-
grep "failed. 0" log
216-
shell: bash
214+
if ((gc log | Select-String "failed: 0") -eq $null) {
215+
Throw "Errors were found during tests";
216+
}
217+
shell: pwsh
218+
217219
- name: NTest hosttests
218220
run: |
219221
cd tests
220222
cp NTest/NTest.lua .
221223
../luac.cross.exe -e NTest_lua.lua | tee log
222-
(if grep " ==> " log ; then exit 1 ; fi)
223-
shell: bash
224+
if ((gc log | Select-String " ==> ") -ne $null) {
225+
Throw "Errors were found during tests";
226+
}
224227
225228
226229
luacheck:

0 commit comments

Comments
 (0)