forked from pchote/Eluant
-
Notifications
You must be signed in to change notification settings - Fork 7
138 lines (121 loc) · 4.79 KB
/
build-natives.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
name: Build native dependencies (Lua)
env:
LUA_VERSION: 5.1.5 # Make sure this matches the version mentioned in the description in the .nuspec file.
on:
pull_request:
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
windows:
name: Windows (x86 + x64)
runs-on: ubuntu-20.04
steps:
- name: Setup Dependencies
run: |
mkdir -p artifacts/x86
mkdir artifacts/x64
sudo apt-get install mingw-w64
- name: Compile natives
run: |
curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
tar xf lua-${LUA_VERSION}.tar.gz
cd lua-${LUA_VERSION}/src/
make mingw CC=i686-w64-mingw32-gcc
cp lua51.dll ../../artifacts/x86/
make clean
make mingw CC=x86_64-w64-mingw32-gcc
cp lua51.dll ../../artifacts/x64/
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Natives-Windows
path: ./artifacts
macos:
name: macOS (x64 + arm64)
runs-on: macos-11
steps:
- name: Clone Repository
uses: actions/checkout@v3
- name: Setup Dependencies
run: |
mkdir -p artifacts/x86_64
mkdir artifacts/arm64
- name: Compile natives
run: |
curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
tar xf lua-${LUA_VERSION}.tar.gz
cd lua-${LUA_VERSION}/src/
patch < ../../liblua.macos.patch
make liblua.5.1.dylib CC="clang -target x86_64-apple-macos10.11" LD="clang -target x86_64-apple-macos10.11"
cp liblua.${LUA_VERSION}.dylib ../../artifacts/x86_64/lua51.dylib
make clean
make liblua.5.1.dylib CC="clang -target arm64-apple-macos10.15" LD="clang -target arm64-apple-macos10.15"
cp liblua.${LUA_VERSION}.dylib ../../artifacts/arm64/lua51.dylib
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Natives-MacOS
path: ./artifacts
# Note: Running inside a CentOS container because we want to compile using a version of glibc
# that is as old as reasonably possible to ensure backwards compatibility of the compiled binaries.
linux-x64:
name: Linux (x64)
runs-on: ubuntu-22.04
container: centos:centos7
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Setup Dependencies
run: |
mkdir -p artifacts/x64
yum -y install gcc make patch
- name: Compile natives
run: |
curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
tar xf lua-${LUA_VERSION}.tar.gz
cd lua-${LUA_VERSION}/src/
patch < ../../liblua.linux.patch
make liblua.so
cp liblua.so ../../artifacts/x64/lua51.so
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Natives-Linux(x64)
path: ./artifacts
# Note: Using the run-on-arch action is *very* slow, but is the only way to simulate arm64 architecture.
linux-arm64:
name: Linux (arm64)
runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v3
- name: Setup dependencies and compile natives
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu22.04
shell: /bin/sh
githubToken: ${{ github.token }}
setup: |
mkdir -p "${PWD}/artifacts/arm64"
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
env: |
LUA_VERSION: ${{ env.LUA_VERSION }}
install: |
apt-get update -q -y
apt-get install -y build-essential curl
run: |
curl -s -L -O https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
tar xf lua-${LUA_VERSION}.tar.gz
cd lua-${LUA_VERSION}/src/
patch < ../../liblua.linux.patch
make liblua.so
cp liblua.so /artifacts/arm64/lua51.so
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Natives-Linux(arm64)
path: ./artifacts