-
Notifications
You must be signed in to change notification settings - Fork 44
269 lines (233 loc) · 7.76 KB
/
pr-test.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
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: Build and test pull request
on: [pull_request]
jobs:
Windows:
name: Build windows version
runs-on: windows-2022
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup MSBuild and add to PATH
uses: microsoft/[email protected]
id: setup_msbuild
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x86-windows-static
vcpkgGitCommitId: 3b3bd424827a1f7f4813216f6b32b6c61e386b2e
vcpkgArguments: >
boost-iostreams boost-asio boost-beast boost-system boost-variant boost-lockfree boost-process boost-program-options boost-uuid boost-filesystem
luajit glew physfs openal-soft libogg libvorbis zlib libzip bzip2 openssl liblzma
- name: Integrate vcpkg
run: |
${{ runner.workspace }}\vcpkg\vcpkg integrate install
- name: Compile
timeout-minutes: 60
run: |
cd vc16
MSBuild /property:Configuration=DirectX /p:BUILD_REVISION=${{github.run_number}}
MSBuild /property:Configuration=OpenGL /p:BUILD_REVISION=${{github.run_number}}
- name: Upload binaries
uses: 'actions/upload-artifact@v2'
with:
name: Binaries
path: |
otclient_gl.exe
otclient_dx.exe
lib.7z
if-no-files-found: error
Android:
name: Build android version
runs-on: windows-2019
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup MSBuild and add to PATH
uses: microsoft/[email protected]
id: setup_msbuild
- name: Create data.zip for android
run: |
powershell -ExecutionPolicy Bypass -File .\create_android_assets.ps1
- name: Decompress android libs
run: |
7z x android_libs.7z -aoa -oC:\android
- name: Install android
run: |
$sdkRoot = "C:\Android\android-sdk"
$sdkManager = "$sdkRoot\cmdline-tools\latest\bin\sdkmanager.bat"
Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `
-AndroidSDKRootPath $sdkRoot `
-AndroidPackages "ndk;21.4.7075529"
- name: Build for android
timeout-minutes: 25
run: |
cd android
$env:VS_NdkRoot="C:\Android\android-sdk\ndk\21.4.7075529"
MSBuild.exe /p:Configuration=Release /p:Platform="ARM64" /p:BUILD_REVISION=${{github.run_number}}
- name: Upload binaries
uses: 'actions/upload-artifact@v2'
with:
name: Binaries
path: |
otclientv8.apk
if-no-files-found: error
Mac:
name: Build mac os version
runs-on: macos-11
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: MacOS - install physfs pkgconfig luajit xquartz
run: brew install physfs pkgconfig luajit xquartz
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: >
boost-iostreams boost-asio boost-system boost-variant boost-lockfree boost-beast glew
boost-filesystem boost-uuid libogg libvorbis zlib opengl libzip openal-soft bzip2
boost-process openssl
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x64-osx
vcpkgGitCommitId: 761c81d43335a5d5ccc2ec8ad90bd7e2cbba734e
- name: Build with CMake
uses: lukka/run-cmake@v3
with:
buildDirectory: ${{ runner.workspace }}/build
cmakeAppendedArgs: '-G Ninja -DCMAKE_BUILD_TYPE="Release" -DVERSION=${{github.run_number}} -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing"'
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
useVcpkgToolchainFile: true
- name: Change name
run: |
mv '${{ runner.workspace }}/build/otclient' '${{ runner.workspace }}/build/otclient_mac'
- name: Upload otclient
uses: actions/upload-artifact@v2
with:
name: Binaries
path: |
${{ runner.workspace }}/build/otclient_mac
if-no-files-found: error
Linux:
name: Build linux version
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: Ubuntu - install opengl lua5.1 luajit
run: sudo apt update && sudo apt install -y libglew-dev liblua5.1-0-dev libluajit-5.1-dev
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: >
boost-iostreams boost-asio boost-system boost-variant boost-lockfree boost-beast glew
boost-filesystem boost-uuid libogg libvorbis zlib opengl libzip openal-soft bzip2
boost-process openssl physfs
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x64-linux
vcpkgGitCommitId: 761c81d43335a5d5ccc2ec8ad90bd7e2cbba734e
- name: Build with CMake
uses: lukka/run-cmake@v3
with:
buildDirectory: ${{ runner.workspace }}/build
cmakeAppendedArgs: '-G Ninja -DCMAKE_BUILD_TYPE="Release" -DVERSION=${{github.run_number}}'
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
useVcpkgToolchainFile: true
- name: Change name
run: |
mv '${{ runner.workspace }}/build/otclient' '${{ runner.workspace }}/build/otclient_linux'
- name: Upload otclient
uses: actions/upload-artifact@v2
with:
name: Binaries
path: |
${{ runner.workspace }}/build/otclient_linux
if-no-files-found: error
Test:
name: Test
runs-on: windows-2019
needs: [Windows, Android, Mac, Linux]
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: Binaries
- name: Run tests
timeout-minutes: 10
run: |
7z x tests.7z -aoa
$process = (Start-Process -Wait -PassThru otclient_dx.exe --test)
Get-Content otclientv8.log
if ($process.ExitCode -ne 0) {
throw "Invalid exit code: " + $process.ExitCode;
}
- name: Upload otclientv8.log
uses: actions/upload-artifact@v2
with:
path: otclientv8.log
name: Download-otclientv8.log
if-no-files-found: error
- name: Copy screenshots
run: |
$location = Get-Location
$pillowScript = @"
from PIL import Image
import glob
for file in glob.glob('*.png'):
Image.open(file).convert('RGB').save(
file[:-3] + 'jpg',
quality=50,
)
"@
cd $env:appdata\otclientv8\otclientv8
pip3 install pillow
python3 -c $pillowScript
cd $location
mkdir screenshots
Get-ChildItem $env:appdata\otclientv8\otclientv8 -Filter *.jpg `
| Copy-Item -Destination screenshots -Force -PassThru
- name: Upload screenshot
uses: actions/upload-artifact@v2
with:
path: screenshots
name: Download-screenshots
- name: Cleanup things
run: |
Remove-Item 'data\things' -Recurse
- name: Upload otclient
uses: actions/upload-artifact@v2
with:
name: Download-otclientv8
path: |
otclient_gl.exe
otclient_dx.exe
otclientv8.apk
otclient_mac
otclient_linux
*.dll
data
modules
layouts
mods
init.lua
if-no-files-found: error