forked from etternagame/etterna
-
Notifications
You must be signed in to change notification settings - Fork 0
312 lines (256 loc) · 11.4 KB
/
ci-workflow.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: Etterna CI
on:
push:
pull_request:
release:
types: [published]
jobs:
linux-x64:
name: Linux x64 (${{matrix.cfg.cxx}})
runs-on: ${{matrix.cfg.os}}
strategy:
fail-fast: false
matrix:
cfg:
- { os: ubuntu-22.04, apt: g++-8, cxx: g++-8, cc: gcc-8, dist: false}
- { os: ubuntu-22.04, apt: g++-9, cxx: g++-9, cc: gcc-9, dist: false}
- { os: ubuntu-22.04, apt: g++-10, cxx: g++-10, cc: gcc-10, dist: false}
- { os: ubuntu-22.04, apt: clang-9, cxx: clang++-9, cc: clang-9, dist: false}
- { os: ubuntu-22.04, apt: clang-10, cxx: clang++-10, cc: clang-10, dist: false}
- { os: ubuntu-22.04, apt: clang-11, cxx: clang++-11, cc: clang-11, dist: false}
- { os: ubuntu-22.04, apt: clang-12, cxx: clang++-12, cc: clang-12, dist: true}
steps:
- name: Checkout Etterna
uses: actions/checkout@v3
with:
path: main
- name: Checkout CrashpadTools
uses: actions/checkout@v3
with:
repository: etternagame/CrashpadTools
path: tools
- name: Install apt packages
run: sudo apt update && sudo apt install ${{ matrix.cfg.cpp-version }} nasm ninja-build libglew-dev libxrandr-dev libxtst-dev libpulse-dev libasound-dev libogg-dev libvorbis-dev xorg-dev libcurl4-openssl-dev
- name: Generate CMake
run: mkdir main/build && cd main/build && cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
env:
CXX: ${{matrix.cfg.cpp-version}}
- name: Build Project
run: cd main/build && ninja
- name: Generate binary
if: ${{matrix.cfg.dist}}
run: cd main/build && cpack
- name: Upload Binary
if: ${{matrix.cfg.dist}}
uses: actions/upload-artifact@v3
with:
name: "Etterna - Linux x64"
path: '${{github.workspace}}/main/build/*.tar.gz'
- name: Update Environment Variables
if: ${{matrix.cfg.dist}}
run: echo "${{github.workspace}}/tools/linux" >> $GITHUB_PATH
- name: Generate Symbols
if: ${{matrix.cfg.dist}}
run: |
echo "Running objcopy..."
mkdir ${{github.workspace}}/sym
objcopy --only-keep-debug ${{github.workspace}}/main/Etterna ${{github.workspace}}/sym/Etterna
echo "Dumping Symbols..."
dump_syms ${{github.workspace}}/sym/Etterna ${{github.workspace}}/main/Etterna > ${{github.workspace}}/sym/Etterna.sym
echo "Stripping debug symbols from binary..."
strip ${{github.workspace}}/main/Etterna
- name: Prepare symbols for upload artifacts
if: ${{matrix.cfg.dist}}
run: cd ${{github.workspace}}/sym && ${{github.workspace}}/main/.ci/prepare_symbols.py
- name: Upload Symbols to action artifacts
if: ${{matrix.cfg.dist}}
uses: actions/upload-artifact@v3
with:
name: Etterna Symbols - ${{github.sha}}
path: '${{github.workspace}}/sym/EtternaSymbolsUploadDir'
- name: Get version for CrashServer Upload
id: get_version
if: ${{ matrix.cfg.dist && github.event_name == 'release' && github.event.action == 'published' }}
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Upload Symbols to Crash Server
if: ${{ matrix.cfg.dist && github.event_name == 'release' && github.event.action == 'published' }}
run: symupload ${{github.workspace}}/sym/Etterna.sym "https://crash.etterna.dev/api/symbol/upload?api_key=${{secrets.CRASHSERVER_API_KEY}}&version=${{steps.get_version.outputs.VERSION}}"
- name: Upload files to Release
uses: softprops/action-gh-release@v1
if: ${{ matrix.cfg.dist && github.event_name == 'release' && github.event.action == 'published' }}
with:
files: ${{github.workspace}}/main/build/*.tar.gz
macos:
name: macOS x64 ${{matrix.cfg.name}}
runs-on: ${{matrix.cfg.os}}
strategy:
fail-fast: false
matrix:
cfg:
#- { os: macos-10.15, name: "Catalina", dist: false} # rendered useless by GHA
- { os: macos-13, name: "Ventura", dist: false}
- { os: macos-12, name: "Monterey", dist: true}
#- { os: macos-11, name: "Big Sur", dist: true}
steps:
- name: Checkout Etterna
uses: actions/checkout@v3
with:
path: main
- name: Checkout CrashpadTools
uses: actions/checkout@v3
with:
repository: etternagame/CrashpadTools
path: tools
- name: Install homebrew packages
run: brew install cmake nasm ninja openssl
- name: Setup Python 2.7
uses: MatteoH2O1999/[email protected]
with:
python-version: '2.7'
- name: Setup Python 3
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Generate CMake
run: mkdir main/build && cd main/build && cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja ..
- name: Build Project
run: cd main/build && ninja
- name: Generate binary
if: ${{matrix.cfg.dist}}
run: cd main/build && cpack
- name: Upload Binary
if: ${{matrix.cfg.dist}}
uses: actions/upload-artifact@v3
with:
name: "Etterna - macOS x64"
path: '${{github.workspace}}/main/build/*.dmg'
- name: Update Environment Variables
if: ${{matrix.cfg.dist}}
run: |
echo "${{github.workspace}}/tools/mac" >> $GITHUB_PATH
echo "ETTERNA_ARCH=x64" >> $GITHUB_ENV
- name: Generate Symbols
if: ${{matrix.cfg.dist}}
run: |
echo "Running dsymutil..."
dsymutil -o ${{github.workspace}}/main/Etterna.dsym main/Etterna.app/Contents/MacOS/Etterna > /dev/null
echo "Dumping Symbols..."
dump_syms ${{github.workspace}}/main/Etterna.dsym main/Etterna.app/Contents/MacOS/Etterna > ${{github.workspace}}/main/Etterna.sym
echo "Stripping debug symbols from binary..."
strip main/Etterna.app/Contents/MacOS/Etterna
- name: Prepare symbols for upload artifacts
if: ${{matrix.cfg.dist}}
run: cd main && ${{github.workspace}}/main/.ci/prepare_symbols.py
- name: Upload Symbols to action artifacts
if: ${{matrix.cfg.dist}}
uses: actions/upload-artifact@v3
with:
name: Etterna Symbols - ${{github.sha}}
path: '${{github.workspace}}/main/EtternaSymbolsUploadDir'
- name: Get version for CrashServer Upload
id: get_version
if: ${{ matrix.cfg.dist && github.event_name == 'release' && github.event.action == 'published' }}
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Upload Symbols to Crash Server
if: ${{ matrix.cfg.dist && github.event_name == 'release' && github.event.action == 'published' }}
run: symupload ${{github.workspace}}/main/Etterna.sym "https://crash.etterna.dev/api/symbol/upload?api_key=${{secrets.CRASHSERVER_API_KEY}}&version=${{ steps.get_version.outputs.VERSION }}"
- name: Upload files to Release
uses: softprops/action-gh-release@v1
if: ${{ matrix.cfg.dist && github.event_name == 'release' && github.event.action == 'published' }}
with:
files: ${{github.workspace}}/main/build/*.dmg
windows: # Windows x64 and x86 build matrix
strategy:
fail-fast: false # Don't cancel other matrix jobs if one fails
matrix:
cfg:
- { name: i386, arch: x86, ssl-dir: 'C:\Program Files (x86)\OpenSSL-Win32' }
- { name: x64, arch: x64, ssl-dir: 'C:\Program Files\OpenSSL-Win64'}
name: "Windows ${{matrix.cfg.name}}"
runs-on: windows-2019
steps:
- name: Checkout Etterna
uses: actions/checkout@v3
with:
path: main
- name: Checkout CrashpadTools
uses: actions/checkout@v3
with:
repository: etternagame/CrashpadTools
path: tools
- name: Checkout DirectX SDK
uses: actions/checkout@v3
with:
repository: nico-abram/dxsdk
path: dxsdk
- name: Update Environment Variables
run: |
echo "${{github.workspace}}/tools/win/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "ETTERNA_ARCH=${{matrix.cfg.name}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Python 3
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Setup Python 2.7
uses: MatteoH2O1999/[email protected]
with:
python-version: '2.7'
- name: Install chocolatey packages (i386)
if: ${{ matrix.cfg.arch == 'x86' }}
run: choco install ninja nsis curl -y --x86
- name: Install openSSL (i386)
if: ${{ matrix.cfg.arch == 'x86' }}
run: choco install openssl --version=1.1.1.2100 -y --x86
- name: Install chocolatey packages (x64)
if: ${{ matrix.cfg.arch == 'x64' }}
run: choco install ninja nsis curl -y
- name: Install openSSL (x64)
if: ${{ matrix.cfg.arch == 'x64' }}
run: choco install openssl --version=1.1.1.2100 -y
- name: Configure MSBuild
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.cfg.arch }}
- name: Generate CMake
run: mkdir main/build && cd main/build && cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
env:
DXSDK_DIR: "${{github.workspace}}/dxsdk/"
- name: Build Project
run: cd main/build && ninja
- name: Generate binary
run: cd main/build && cpack
- name: Upload Binary
uses: actions/upload-artifact@v3
with:
name: "Etterna - Windows ${{matrix.cfg.name}}"
path: '${{github.workspace}}/main/build/*.exe'
- name: Generate Symbols
run: |
echo "Dumping Symbols..."
dump_syms.exe main/Program/Etterna.pdb > ${{github.workspace}}/main/Etterna.sym
- name: Setup Python 3
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Prepare symbols for action artifacts
run: cd main && python ${{github.workspace}}/main/.ci/prepare_symbols.py
- name: Upload Symbols to action artifacts
uses: actions/upload-artifact@v3
with:
name: Etterna Symbols - ${{github.sha}}
path: '${{github.workspace}}/main/EtternaSymbolsUploadDir'
- name: Get version for CrashServer Upload
id: get_version
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
run: $tag="${{ github.ref }}".Split('/')[-1]; echo "::set-output name=VERSION::$tag"
- name: Upload Symbols to Crash Server
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
run: curl --request POST -F symbol_file=@${{github.workspace}}/main/Etterna.sym "https://crash.etterna.dev/api/symbol/upload?api_key=${{ secrets.CRASHSERVER_API_KEY }}&version=${{ steps.get_version.outputs.VERSION }}"
- name: Upload files to Release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
with:
files: |
${{github.workspace}}/main/build/*.exe