-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (161 loc) · 6.05 KB
/
build.yml
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
name: Build Lua Distributions
on:
- push
- workflow_dispatch
permissions:
contents: read
jobs:
build-luau:
strategy:
matrix: # using ubuntu-20.04 to build a Linux binary targeting older glibc to improve compatibility
os: [{name: ubuntu, version: ubuntu-20.04}, {name: macos, version: macos-latest}, {name: windows, version: windows-latest}]
fail-fast: false
name: Build Luau (${{ matrix.os.name }})
runs-on: ${{ matrix.os.version }}
defaults:
run:
working-directory: ./luau
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
sparse-checkout: luau
- name: Configure with CMake
run: |
cmake . -DCMAKE_BUILD_TYPE=Release
- name: Build with CMake
env:
# Create fat binary on macOS for compatibility with ARM64 and Intel
# (for compatibility with older macintosh devices)
CMAKE_OSX_ARCHITECTURES: ${{ matrix.os.name == 'macos' && 'x86_64;arm64' || '' }}
run: |
cmake --build . --target Luau.Repl.CLI --config Release -j 2
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: luau-${{ matrix.os.name }}
path: ${{ matrix.os.name == 'windows' && 'luau/Release/luau.exe' || 'luau/luau' }}
if-no-files-found: error
build-luajit:
strategy:
matrix: # using ubuntu-20.04 to build a Linux binary targeting older glibc to improve compatibility
os: [{name: ubuntu, version: ubuntu-20.04}, {name: macos, version: macos-latest}, {name: windows, version: windows-latest}]
fail-fast: false
name: Build LuaJIT (${{ matrix.os.name }})
runs-on: ${{ matrix.os.version }}
defaults:
run:
working-directory: ./luajit/src
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
sparse-checkout: luajit
- name: Setup MSVC environment
if: matrix.os.name == 'windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Build with MSVC
if: matrix.os.name == 'windows'
run: |
.\msvcbuild.bat static
- name: Build for macOS
if: matrix.os.name == 'macos'
env:
MACOSX_DEPLOYMENT_TARGET: 10.14
BUILDMODE: static
run: |
# LuaJIT's makefile does not allow multiple architectures to be targetted per build,
# so we must do two seperate compiles and create universal binary with lipo.
make TARGET_FLAGS="-arch arm64"
mv luajit ../luajit-arm64
make clean
make TARGET_FLAGS="-arch x86_64"
mv luajit ../luajit-x64
lipo -create -output luajit ../luajit-arm64 ../luajit-x64
- name: Build with GNU Make
if: matrix.os.name == 'ubuntu'
env:
BUILDMODE: static
run: |
make amalg
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: luajit-${{ matrix.os.name }}
path: ${{ matrix.os.name == 'windows' && 'luajit/src/luajit.exe' || 'luajit/src/luajit' }}
if-no-files-found: error
build-lua:
strategy:
matrix: # using ubuntu-20.04 to build a Linux binary targeting older glibc to improve compatibility
os: [{name: ubuntu, version: ubuntu-20.04}, {name: macos, version: macos-latest}, {name: windows, version: windows-latest}]
lua: [{name: '5.1', directory: lua51}, {name: '5.2', directory: lua52}, {name: '5.3', directory: lua53}, {name: '5.4', directory: lua54}]
fail-fast: false
name: Build Lua ${{ matrix.lua.name }} (${{ matrix.os.name }})
runs-on: ${{ matrix.os.version }}
defaults:
run:
working-directory: ./${{ matrix.lua.directory }}/src
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
sparse-checkout: ${{ matrix.lua.directory }}
- name: Setup MSVC environment
if: matrix.os.name == 'windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Build for Windows
if: matrix.os.name == 'windows'
run: |
..\..\CompileLua.bat
- name: Build for macOS
if: matrix.os.name == 'macos'
run: |
# `make macosx` doesn't allow us to change MYCFLAGS/MYLDFLAGS
make all MYCFLAGS="-DLUA_USE_LINUX -arch arm64 -arch x86_64" MYLIBS="-lreadline" MYLDFLAGS="-arch arm64 -arch x86_64"
- name: Build for Linux
if: matrix.os.name == 'ubuntu'
run: |
make linux
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.lua.directory }}-${{matrix.os.name}}
path: ${{ format(matrix.os.name == 'windows' && '{0}/src/lua.exe' || '{0}/src/lua', matrix.lua.directory) }}
if-no-files-found: error
merge-and-release:
name: Merge artifacts and Release
runs-on: ubuntu-latest
needs: [build-lua, build-luajit, build-luau]
permissions:
contents: write
steps:
- name: Merge artifacts
uses: actions/upload-artifact/merge@v4
with:
name: crosslua-build
pattern: 'lua*'
separate-directories: true
delete-merged: true
compression-level: 9
- name: Download merged artifact
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/download-artifact@v4
with:
name: crosslua-build
path: crosslua-build
- name: Generate .zip file with archives
if: ${{ github.event_name == 'workflow_dispatch' }}
run: zip -r -9 crosslua-build.zip crosslua-build/*
- name: Create release
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: softprops/action-gh-release@v2
with:
name: CrossLua ${{ github.event.started_at }}
body: This release was automatically generated by a build script.
fail_on_unmatched_files: true
prerelease: false
draft: false
make_latest: true