Skip to content

Commit dd92959

Browse files
authored
Ci (#1)
* Improved wmake files for unix hosts * Initial Github Actions * Added distribution and artifact uploading to GitHub Action script * Added trigger event * Set Watcom include path based on the relative variable in GitHub Action * Added 'sudo' to required commands in GitHub Action * Use upload-artifact v4 on GitHub Action
1 parent 71e0264 commit dd92959

File tree

3 files changed

+127
-10
lines changed

3 files changed

+127
-10
lines changed

.github/workflows/LuaWatcom.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Lua for Watcom
2+
3+
on: push
4+
5+
jobs:
6+
DOS:
7+
name: Lua for DOS
8+
runs-on: ubuntu-latest
9+
env:
10+
LUA_VERSION: 5.4.6
11+
12+
steps:
13+
- uses: open-watcom/setup-watcom@v0
14+
with:
15+
version: "1.9"
16+
- uses: actions/checkout@v4
17+
18+
- name: Download Lua Sources
19+
run: |
20+
wget https://lua.org/ftp/lua-$LUA_VERSION.tar.gz
21+
22+
- name: Verify Lua Sources
23+
env:
24+
HASH: 25a429319dff20dfbfb9956c2b5be911
25+
26+
run: |
27+
echo "$HASH lua-$LUA_VERSION.tar.gz" > hash
28+
md5sum -c hash
29+
rm hash
30+
31+
- name: Extract Lua Sources
32+
run: |
33+
tar -xzf lua-$LUA_VERSION.tar.gz
34+
mv lua-$LUA_VERSION/src/* .
35+
rm -R lua-$LUA_VERSION*
36+
37+
- name: Prepare Lua Sources for Watcom
38+
run: |
39+
patch luaconf.h luaconf.pat
40+
patch lopcodes.h lopcodes.pat
41+
patch lutf8lib.c lutf8lib.pat
42+
43+
- name: Build Lua for DOS 16-bit
44+
run: |
45+
export INCLUDE=$WATCOM/h
46+
wmake -f watcom_l.mak
47+
wmake -f watcom_l.mak clean
48+
49+
- name: Build Lua for DOS4GW
50+
run: |
51+
export INCLUDE=$WATCOM/h
52+
wmake -f watcom_f.mak
53+
wmake -f watcom_f.mak clean
54+
55+
- name: UPX Binary Compression
56+
uses: crazy-max/ghaction-upx@v3
57+
with:
58+
version: latest
59+
args: -9 --8086
60+
files: |
61+
dist/bin/*.exe
62+
63+
- name: Copy DOS4GW Binary
64+
run: |
65+
cp $WATCOM/binw/dos4gw.exe dist/bin/
66+
67+
- name: Install Post Build Tools (Dos2unix, GNU Mtools, Zip)
68+
run: |
69+
sudo apt-get update
70+
sudo apt-get install -y dos2unix mtools zip
71+
72+
- name: Create Example Lua Script for Diskette Images
73+
run: |
74+
echo "-- This is a single line comment" > example.lua
75+
echo "-- Run this script with 'LUA16.EXE EXAMPLE.LUA'" >> example.lua
76+
echo "" >> example.lua
77+
echo "-- Get hour of the day, convert it from string to number" >> example.lua
78+
echo "hour = tonumber(os.date('%H'))" >> example.lua
79+
echo "" >> example.lua
80+
echo "-- Set the string 'timeOfDay' depending on the hour" >> example.lua
81+
echo "if hour < 4 or hour > 20 then timeOfDay = 'night'" >> example.lua
82+
echo "elseif hour < 9 then timeOfDay = 'morning'" >> example.lua
83+
echo "elseif hour > 16 then timeOfDay = 'evening'" >> example.lua
84+
echo "else timeOfDay = 'day'" >> example.lua
85+
echo "end" >> example.lua
86+
echo "" >> example.lua
87+
echo "-- Concatinate and print timeOfDay to screen as part of a greeting" >> example.lua
88+
echo "print('Good ' .. timeOfDay .. ' DOS! From Lua.')" >> example.lua
89+
echo "" >> example.lua
90+
echo "os.exit() -- Exit script. Will also exit a interactive shell" >> example.lua
91+
echo "" >> example.lua
92+
echo "--[[ This is a multi-line comment" >> example.lua
93+
echo " For full Lua language documentation" >> example.lua
94+
echo " visit https://www.lua.org/docs.html" >> example.lua
95+
echo "--]]" >> example.lua
96+
unix2dos example.lua
97+
98+
- name: Create 160k Floppy Diskette Image
99+
run: |
100+
mformat -C -i dist/Lua5DD8.ima -v LUA -f 160
101+
mcopy -i dist/Lua5DD8.ima dist/bin/lua16.exe example.lua ::
102+
103+
- name: Create 1.4M Floppy Diskette Image
104+
run: |
105+
mformat -C -i dist/Lua3HD18.ima -v LUA -f 1440
106+
mcopy -i dist/Lua3HD18.ima dist/bin/*.exe example.lua ::
107+
108+
- name: Zip Binaries
109+
run: |
110+
zip -j9 "dist/Lua DOS Bin.zip" dist/bin/*.exe
111+
112+
- name: Zip Disk Images
113+
run: |
114+
zip -j9 "dist/Lua DOS Ima.zip" dist/*.ima
115+
116+
- name: Upload Artifacts
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: 'Lua Binaries'
120+
path: dist/*.zip
121+
compression-level: 0

watcom_f.mak

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ objs = lapi.obj lctype.obj lfunc.obj lmathlib.obj loslib.obj &
1313
lua_obj = lua.obj
1414
luac_obj = luac.obj
1515

16-
all: lua4g.exe luac4g.exe dist\bin .SYMBOLIC
16+
all: lua4g.exe luac4g.exe dist .SYMBOLIC
1717
!ifdef __UNIX__
1818
cp lua4g.exe luac4g.exe dist/bin
1919
!else
@@ -28,7 +28,7 @@ luac4g.exe: $(objs) $(luac_obj)
2828
*wlink NAME $@ SYS dos4g OPT st=8192 FILE {$(objs) $(luac_obj)}
2929

3030
.c.obj:
31-
*wcc386 -q -bt=dos4g -mf -5 -d0 -osr -zc $[&.c
31+
*wcc386 -q -bt=dos4g -mf -5 -d0 -osr -zc -fo=$@ $[&.c
3232

3333
clean: .SYMBOLIC
3434
!ifdef __UNIX__
@@ -47,10 +47,8 @@ cleandist: .SYMBOLIC clean
4747

4848
dist:
4949
mkdir dist
50-
51-
dist\bin: dist
5250
!ifdef __UNIX__
53-
mkdir dist/bin
51+
mkdir dist/bin
5452
!else
5553
mkdir dist\bin
5654
!endif

watcom_l.mak

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ objs = lapi.obj lctype.obj lfunc.obj lmathlib.obj loslib.obj &
1313
lua_obj = lua.obj
1414
luac_obj = luac.obj
1515

16-
all: lua16.exe luac16.exe dist\bin .SYMBOLIC
16+
all: lua16.exe luac16.exe dist .SYMBOLIC
1717
!ifdef __UNIX__
1818
cp lua16.exe luac16.exe dist/bin
1919
!else
@@ -28,7 +28,7 @@ luac16.exe: $(objs) $(luac_obj)
2828
*wlink NAME $@ SYS dos OPT st=8192 FILE {$(objs) $(luac_obj)}
2929

3030
.c.obj:
31-
*wcc -q -bt=dos -ml -0 -d0 -osr -zc $[&.c
31+
*wcc -q -bt=dos -ml -0 -d0 -osr -zc -fo=$@ $[&.c
3232

3333
clean: .SYMBOLIC
3434
!ifdef __UNIX__
@@ -47,10 +47,8 @@ cleandist: .SYMBOLIC clean
4747

4848
dist:
4949
mkdir dist
50-
51-
dist\bin: dist
5250
!ifdef __UNIX__
53-
mkdir dist/bin
51+
mkdir dist/bin
5452
!else
5553
mkdir dist\bin
5654
!endif

0 commit comments

Comments
 (0)