-
Notifications
You must be signed in to change notification settings - Fork 197
178 lines (145 loc) · 4.56 KB
/
binaries.yml
File metadata and controls
178 lines (145 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: "binaries"
on: [push]
jobs:
generate-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: leafo/gh-actions-lua@master
with:
luaVersion: "5.1"
- uses: leafo/gh-actions-luarocks@master
- name: Install dependencies
run: |
luarocks install argparse
luarocks make
- name: Generate moonscript.h
run: |
bin/splat.moon -l moonscript moonscript moon > moonscript.lua
xxd -i moonscript.lua > bin/binaries/moonscript.h
- name: Generate moon.h
run: |
awk 'FNR>1' bin/moon > moon.lua
xxd -i moon.lua > bin/binaries/moon.h
- name: Generate argparse.h
run: |
luarocks install argparse --tree=lua_modules
bin/splat.moon --strip-prefix -l argparse $(find lua_modules/share/lua -name "argparse.lua" -exec dirname {} \; | head -1) > bin/binaries/argparse.lua
xxd -i -n argparse_lua bin/binaries/argparse.lua > bin/binaries/argparse.h
- name: Upload headers
uses: actions/upload-artifact@v6
with:
name: generated-headers
path: bin/binaries/*.h
linux:
runs-on: ubuntu-latest
needs: generate-headers
strategy:
matrix:
lua_version: ["5.1.5"]
steps:
- uses: actions/checkout@master
- name: Download headers
uses: actions/download-artifact@v4
with:
name: generated-headers
path: bin/binaries/
- name: Show GCC
run: gcc -v
- name: Setup Lua
run: |
curl -L -O https://www.lua.org/ftp/lua-${{ matrix.lua_version }}.tar.gz
tar -xzf lua-${{ matrix.lua_version }}.tar.gz
cd lua-${{ matrix.lua_version }}/src && make liblua.a MYCFLAGS=-DLUA_USE_POSIX
- name: Get LPeg
run: |
curl -L -o lpeg.tar.gz https://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.0.2.tar.gz
tar -xzf lpeg.tar.gz
- name: Get Luafilesystem
run: |
curl -L -o luafilesystem.tar.gz https://github.com/keplerproject/luafilesystem/archive/v1_8_0.tar.gz
tar -xzf luafilesystem.tar.gz
- name: Build
run: |
mkdir -p dist
gcc -static -o dist/moon \
-Ilua-${{ matrix.lua_version }}/src/ \
-Ilpeg-1.0.2/ \
-Ibin/binaries/ \
bin/binaries/moon.c \
bin/binaries/moonscript.c \
lpeg-1.0.2/lpvm.c \
lpeg-1.0.2/lpcap.c \
lpeg-1.0.2/lptree.c \
lpeg-1.0.2/lpcode.c \
lpeg-1.0.2/lpprint.c \
lua-${{ matrix.lua_version }}/src/liblua.a \
-lm -ldl
- name: Test run
run: |
dist/moon -h
dist/moon -e 'print "hello world"'
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: moon-linux-lua${{ matrix.lua_version }}
path: dist/
windows:
runs-on: windows-latest
needs: generate-headers
strategy:
matrix:
lua_version: ["5.1.5"]
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@master
- name: Download headers
uses: actions/download-artifact@v4
with:
name: generated-headers
path: bin/binaries/
- uses: msys2/setup-msys2@v2
with:
install: gcc make curl
- name: Show GCC
run: gcc -v
- name: Setup Lua
run: |
curl -L -O https://www.lua.org/ftp/lua-${{ matrix.lua_version }}.tar.gz
tar -xzf lua-${{ matrix.lua_version }}.tar.gz
cd lua-${{ matrix.lua_version }}/src && make liblua.a
- name: Get LPeg
run: |
curl -L -o lpeg.tar.gz https://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.0.2.tar.gz
tar -xzf lpeg.tar.gz
- name: Get Luafilesystem
run: |
curl -L -o luafilesystem.tar.gz https://github.com/keplerproject/luafilesystem/archive/v1_8_0.tar.gz
tar -xzf luafilesystem.tar.gz
- name: Build
run: |
mkdir -p dist
gcc -static -o dist/moon.exe \
-Ilua-${{ matrix.lua_version }}/src/ \
-Ilpeg-1.0.2/ \
-Ibin/binaries/ \
bin/binaries/moon.c \
bin/binaries/moonscript.c \
lpeg-1.0.2/lpvm.c \
lpeg-1.0.2/lpcap.c \
lpeg-1.0.2/lptree.c \
lpeg-1.0.2/lpcode.c \
lpeg-1.0.2/lpprint.c \
lua-${{ matrix.lua_version }}/src/liblua.a \
-lm
- name: Test run
run: |
dist/moon.exe -h
dist/moon.exe -e 'print "hello world"'
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: moon-windows-lua${{ matrix.lua_version }}
path: dist/