Skip to content

Commit e5f2975

Browse files
committed
release workflow
1 parent 101a38d commit e5f2975

File tree

2 files changed

+166
-1
lines changed

2 files changed

+166
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "Build & Test"
2-
on: [push, pull_request, release, workflow_call]
2+
on: [push, pull_request]
33

44
jobs:
55
macOS:

.github/workflows/release.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
on:
2+
release:
3+
types: [created]
4+
5+
jobs:
6+
macOS:
7+
runs-on: macos-latest
8+
timeout-minutes: 30
9+
env:
10+
MACOSX_DEPLOYMENT_TARGET: "10.9"
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Get release
15+
id: get-release
16+
uses: bruceadams/[email protected]
17+
env:
18+
GITHUB_TOKEN: ${{ github.token }}
19+
- name: Download LuaJIT
20+
uses: actions/checkout@v3
21+
with:
22+
repository: LuaJIT/LuaJIT
23+
ref: v2.1
24+
path: LuaJIT
25+
- name: Compile universal LuaJIT
26+
working-directory: ./LuaJIT
27+
run: |
28+
TARGET_FLAGS="-arch x86_64" make
29+
cp ./src/libluajit.so ./src/libluajit_x64.dylib
30+
cp ./src/luajit ./src/luajit_x64
31+
32+
make clean
33+
34+
TARGET_FLAGS="-arch arm64" make
35+
cp ./src/libluajit.so ./src/libluajit_arm.dylib
36+
cp ./src/luajit ./src/luajit_arm
37+
38+
lipo -create -output ./src/libluajit.dylib ./src/libluajit_x64.dylib ./src/libluajit_arm.dylib
39+
lipo -create -output ./src/luajit ./src/luajit_x64 ./src/luajit_arm
40+
- name: Configure
41+
run: cmake -Bbuild -S. -G Xcode -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DLUA_INCLUDE_DIR=$PWD/LuaJIT/src -DLUA_LIBRARIES=$PWD/LuaJIT/src/lua
42+
- name: Build
43+
working-directory: build
44+
run: xcodebuild -configuration Release -scheme https
45+
- name: Test
46+
working-directory: ./build/src/Release
47+
run: ../../../LuaJIT/src/luajit -l "https" ../../../example/test.lua
48+
- name: upload artifact (aarch64) to release
49+
uses: actions/upload-release-asset@v1
50+
env:
51+
GITHUB_TOKEN: ${{ github.token }}
52+
with:
53+
upload_url: ${{ steps.get-release.outputs.upload_url }}
54+
asset_path: build/src/luajit_arm/https.so
55+
asset_name: macos-aarch64-https.so
56+
asset_content_type: application/octet-stream
57+
- name: upload artifact (x86_64) to release
58+
uses: actions/upload-release-asset@v1
59+
env:
60+
GITHUB_TOKEN: ${{ github.token }}
61+
with:
62+
upload_url: ${{ steps.get-release.outputs.upload_url }}
63+
asset_path: build/src/luajit_x64/https.so
64+
asset_name: macos-x86_64-https.so
65+
asset_content_type: application/octet-stream
66+
Linux:
67+
name: ${{ matrix.mode.name }}
68+
runs-on: ubuntu-20.04
69+
timeout-minutes: 30
70+
strategy:
71+
matrix:
72+
mode:
73+
- name: Linux cURL
74+
curl: 1
75+
openssl: 0
76+
artifact: 0
77+
- name: Linux OpenSSL
78+
curl: 0
79+
openssl: 1
80+
artifact: 0
81+
- name: Linux cURL & OpenSSL
82+
curl: 1
83+
openssl: 1
84+
artifact: 1
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v3
88+
- name: Get release
89+
id: get-release
90+
uses: bruceadams/[email protected]
91+
env:
92+
GITHUB_TOKEN: ${{ github.token }}
93+
- name: Update APT Repository
94+
run: sudo apt-get update
95+
- name: Install Dependencies
96+
run: sudo apt-get install -y lua5.1 luajit liblua5.1-0-dev libcurl4-openssl-dev g++ libssl-dev
97+
- name: Configure
98+
run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Release -DUSE_CURL_BACKEND=${{ matrix.mode.curl }} -DUSE_OPENSSL_BACKEND=${{ matrix.mode.openssl }}
99+
- name: Build
100+
run: cmake --build build --config Release --target install -j$(nproc)
101+
- name: Test (Lua)
102+
if: matrix.mode.artifact == 0
103+
working-directory: ./install
104+
run: lua -l "https" ../example/test.lua
105+
- name: Test (LuaJIT)
106+
if: matrix.mode.artifact == 0
107+
working-directory: ./install
108+
run: luajit -l "https" ../example/test.lua
109+
- name: upload artifact to release
110+
if: matrix.mode.artifact == 1
111+
uses: actions/upload-release-asset@v1
112+
env:
113+
GITHUB_TOKEN: ${{ github.token }}
114+
with:
115+
upload_url: ${{ steps.get-release.outputs.upload_url }}
116+
asset_path: install/https.so
117+
asset_name: linux-https.so
118+
asset_content_type: application/octet-stream
119+
Windows:
120+
runs-on: windows-latest
121+
strategy:
122+
matrix:
123+
arch:
124+
- Win32
125+
- x64
126+
defaults:
127+
run:
128+
shell: cmd
129+
steps:
130+
- name: Checkout
131+
uses: actions/checkout@v3
132+
- name: Get release
133+
id: get-release
134+
uses: bruceadams/[email protected]
135+
env:
136+
GITHUB_TOKEN: ${{ github.token }}
137+
- name: Download LuaJIT
138+
uses: actions/checkout@v3
139+
with:
140+
repository: LuaJIT/LuaJIT
141+
ref: v2.1
142+
path: LuaJIT
143+
- name: Configure MSVC Developer Command Prompt
144+
uses: ilammy/msvc-dev-cmd@v1
145+
with:
146+
arch: ${{ matrix.arch }}
147+
- name: Compile LuaJIT
148+
working-directory: ./LuaJIT/src
149+
run: msvcbuild.bat amalg
150+
- name: Configure
151+
run: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=%CD%\install -A ${{ matrix.arch }} -DLUA_INCLUDE_DIR=%CD%\LuaJIT\src -DLUA_LIBRARIES=%CD%\LuaJIT\src\lua51.lib
152+
- name: Build
153+
run: cmake --build build --config Release --target install
154+
- name: Test
155+
working-directory: ./install
156+
run: ..\LuaJIT\src\luajit ..\example\test.lua
157+
- name: upload artifact to release
158+
uses: actions/upload-release-asset@v1
159+
env:
160+
GITHUB_TOKEN: ${{ github.token }}
161+
with:
162+
upload_url: ${{ steps.get-release.outputs.upload_url }}
163+
asset_path: install/https.dll
164+
asset_name: windows-${{ matrix.arch }}-https.dll
165+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)