forked from zhaozg/lua-openssl
-
Notifications
You must be signed in to change notification settings - Fork 0
224 lines (190 loc) · 7.54 KB
/
ci.yml
File metadata and controls
224 lines (190 loc) · 7.54 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: CI
on:
push:
branches: [ "master", "ci" ]
tags:
- v?[0-9].[0-9]+.[0-9]+-[0-9]+
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
os: [macos-15-intel, ubuntu-latest]
luarocks_version: [3.12.0]
lua_version: [luajit2.1, lua5.1, lua5.3, lua5.4]
openssl_version: [openssl-1.0.2u, openssl-1.1.1w, openssl-3.0.18, openssl-3.5.4, openssl-3.6.0]
env:
MACOSX_DEPLOYMENT_TARGET: 10.12
LUAROCKS: ${{ matrix.luarocks_version }}
LUA: ${{ matrix.lua_version }}
SSL: ${{ matrix.openssl_version }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup
run:
.github/shell/setup_lua.sh && .github/shell/setup_ssl.sh
- name: Build
run:
.github/shell/build.sh
- name: Test
run:
PKG_CONFIG_PATH=$HOME/.usr/lib64/pkgconfig:$HOME/.usr/lib/pkgconfig PATH=$HOME/.usr/bin:$PATH LD_LIBRARY_PATH=$HOME/.usr/lib64:$HOME/.usr/lib make test
build-msvc:
runs-on: windows-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
arch: [amd64]
steps:
- name: Setup MSVC Developer Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup LuaJIT
run: |
Write-Host "Cloning LuaJIT..."
git clone https://github.com/LuaJIT/LuaJIT.git C:\luajit
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "Building LuaJIT..."
cd C:\luajit\src
cmd /c "msvcbuild.bat"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "Copying LuaJIT files..."
copy luajit.exe C:\
copy lua51.* C:\
Write-Host "LuaJIT setup complete"
C:\luajit.exe -v
- name: Setup vcpkg and Install OpenSSL
run: |
$ErrorActionPreference = "Stop"
Write-Host "Installing OpenSSL via vcpkg..."
# vcpkg is pre-installed on GitHub Actions Windows runners
# Install OpenSSL with static linking (:x64-windows-static triplet)
vcpkg install openssl:x64-windows-static
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "OpenSSL installed successfully"
# vcpkg packages are installed to $env:VCPKG_INSTALLATION_ROOT
$VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
Write-Host "vcpkg root: $VCPKG_ROOT"
# Verify OpenSSL installation
$OPENSSL_DIR = "$VCPKG_ROOT\installed\x64-windows-static"
if (Test-Path "$OPENSSL_DIR\tools\openssl\openssl.exe") {
& "$OPENSSL_DIR\tools\openssl\openssl.exe" version
}
# Show installed files for debugging
Write-Host "OpenSSL include directory:"
Get-ChildItem "$OPENSSL_DIR\include\openssl" | Select-Object -First 5 | Format-Table Name
Write-Host "OpenSSL library directory:"
Get-ChildItem "$OPENSSL_DIR\lib" | Where-Object { $_.Extension -eq ".lib" } | Format-Table Name
- name: Update config.win
run: |
$ErrorActionPreference = "Stop"
# vcpkg installs to a standard location
$VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
$OPENSSL_DIR = "$VCPKG_ROOT\installed\x64-windows-static"
Write-Host "Using vcpkg OpenSSL from: $OPENSSL_DIR"
# vcpkg uses standard naming: libcrypto.lib and libssl.lib
$CRYPTO_LIB = "$OPENSSL_DIR\lib\libcrypto.lib"
$SSL_LIB = "$OPENSSL_DIR\lib\libssl.lib"
# Verify libraries exist
if (-not (Test-Path $CRYPTO_LIB)) {
Write-Host "ERROR: Could not find $CRYPTO_LIB"
exit 1
}
if (-not (Test-Path $SSL_LIB)) {
Write-Host "ERROR: Could not find $SSL_LIB"
exit 1
}
Write-Host "Using OpenSSL libraries:"
Write-Host " Crypto: $CRYPTO_LIB"
Write-Host " SSL: $SSL_LIB"
# Create config.win
"# Installation directories" | Out-File -FilePath config.win -Encoding ASCII
"# System's libraries directory (where binary libraries are installed)" | Out-File -FilePath config.win -Append -Encoding ASCII
"" | Out-File -FilePath config.win -Append -Encoding ASCII
"# Lua includes and lib" | Out-File -FilePath config.win -Append -Encoding ASCII
'LUA_INC= c:\luajit\src' | Out-File -FilePath config.win -Append -Encoding ASCII
'LUA_LIB= c:\luajit\src\lua51.lib' | Out-File -FilePath config.win -Append -Encoding ASCII
"" | Out-File -FilePath config.win -Append -Encoding ASCII
"# Openssl include and lib" | Out-File -FilePath config.win -Append -Encoding ASCII
"OPENSSL_INC= $OPENSSL_DIR\include" | Out-File -FilePath config.win -Append -Encoding ASCII
"OPENSSL_LIB= $CRYPTO_LIB $SSL_LIB" | Out-File -FilePath config.win -Append -Encoding ASCII
"" | Out-File -FilePath config.win -Append -Encoding ASCII
'LIBNAME= $T.dll' | Out-File -FilePath config.win -Append -Encoding ASCII
"" | Out-File -FilePath config.win -Append -Encoding ASCII
"# Compilation directives" | Out-File -FilePath config.win -Append -Encoding ASCII
"WARN= /O2" | Out-File -FilePath config.win -Append -Encoding ASCII
'INCS= /I$(LUA_INC) /I$(OPENSSL_INC) /Ideps' | Out-File -FilePath config.win -Append -Encoding ASCII
'CFLAGS= /DWIN32_LEAN_AND_MEAN /MT $(WARN) $(INCS)' | Out-File -FilePath config.win -Append -Encoding ASCII
"CC= cl" | Out-File -FilePath config.win -Append -Encoding ASCII
"" | Out-File -FilePath config.win -Append -Encoding ASCII
- name: Build
run: |
Write-Host "Building lua-openssl..."
nmake -f Makefile.win lib
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "Build complete"
dir src\openssl.dll
- name: Test
run: |
Write-Host "Running tests..."
cd test
$env:LUA_PATH = "?.lua;"
$env:LUA_CPATH = "C:\?.dll;..\src\?.dll"
# Static linking - no OpenSSL DLLs needed at runtime
C:\luajit.exe test.lua
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "Tests complete"
deploy:
if: startsWith(github.ref, 'refs/tags/')
needs: [build, build-msvc]
runs-on: ubuntu-latest
permissions:
contents: write
env:
WITH_LUA_ENGINE: LuaJIT
LUA: luajit2.1
LUAROCKS: 3.12.0
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Setup
run:
.github/shell/setup_lua.sh
- name: Package
run:
.github/shell/make_rockspec.sh ${{ steps.get_version.outputs.VERSION }}
- name: Github Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
files: openssl-${{ steps.get_version.outputs.VERSION }}.tar.gz
draft: false
prerelease: false
- name: Luarocks Release
# lua-cjson is required for luarocks upload
run: |
export PATH=$HOME/.usr/bin:$PATH
export LUA_CPATH=$HOME/.usr/lib/lua/5.1/?.so
luarocks install lua-cjson
luarocks build
luarocks test
luarocks upload openssl-${{ steps.get_version.outputs.VERSION }}.rockspec --api-key=${{ secrets.LUAROCKS_TOKEN }}