-
Notifications
You must be signed in to change notification settings - Fork 4
304 lines (252 loc) · 10 KB
/
build.yaml
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
name: Build
on:
- push
- pull_request
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_REPOSITORY: https://github.com/microsoft/vcpkg.git
VCPKG_REVISION: 137197a8f85e6c6cf1843ef024af7d9c28bb0bde
jobs:
static:
strategy:
fail-fast: true
matrix:
image:
- windows-2019
- windows-2022
name: static-${{ matrix.image }}
runs-on: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- working-directory: 'C:/vcpkg'
run: git remote add openmw ${{ env.VCPKG_REPOSITORY }}
- working-directory: 'C:/vcpkg'
run: git fetch openmw
- working-directory: 'C:/vcpkg'
run: git checkout ${{ env.VCPKG_REVISION }}
- working-directory: 'C:/vcpkg'
run: ./bootstrap-vcpkg.bat -disableMetrics
- name: Install vcpkg packages
run: >
vcpkg install --overlay-ports=ports --triplet x64-windows-static
boost-geometry
boost-iostreams
boost-program-options
bullet3[double-precision,multithreading]
ffmpeg
freetype
icu
luajit
lz4
mygui
openal-soft
openmw-osg
sdl2
- name: Export installed vcpkg packages
run: >
vcpkg export
--x-all-installed
--raw
--output-dir ${{ github.workspace }}
--output intermediate
- name: Move pdb files
working-directory: '${{ github.workspace }}/intermediate'
run: |
robocopy installed pdb/installed *.pdb /S /MOVE
if ($lastexitcode -lt 8) {
$global:LASTEXITCODE = $null
}
- name: Archive pdb files
working-directory: '${{ github.workspace }}/intermediate/pdb'
run: 7z a "${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-static-pdb-${{ github.sha }}.7z" installed
- name: Store archived pdb files
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-static-pdb-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-static-pdb-${{ github.sha }}.7z
- name: Archive everything else
working-directory: '${{ github.workspace }}/intermediate'
run: 7z a "${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-static-${{ github.sha }}.7z" * -x!pdb
- name: Store exported vcpkg packages
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-static-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-static-${{ github.sha }}.7z
dynamic:
strategy:
fail-fast: true
matrix:
image:
- windows-2019
- windows-2022
name: dynamic-${{ matrix.image }}
runs-on: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- working-directory: 'C:/vcpkg'
run: git remote add openmw ${{ env.VCPKG_REPOSITORY }}
- working-directory: 'C:/vcpkg'
run: git fetch openmw
- working-directory: 'C:/vcpkg'
run: git checkout ${{ env.VCPKG_REVISION }}
- working-directory: 'C:/vcpkg'
run: ./bootstrap-vcpkg.bat -disableMetrics
- name: Install vcpkg packages
run: >
vcpkg install --overlay-ports=ports --triplet x64-windows
boost-geometry
boost-iostreams
boost-program-options
bullet3[double-precision,multithreading]
ffmpeg
freetype
icu
luajit
lz4
mygui
openal-soft
openmw-osg
sdl2
- name: Export installed vcpkg packages
run: >
vcpkg export
--x-all-installed
--raw
--output-dir ${{ github.workspace }}
--output intermediate
- name: Move pdb files
working-directory: '${{ github.workspace }}/intermediate'
run: |
robocopy installed pdb/installed *.pdb /S /MOVE
if ($lastexitcode -lt 8) {
$global:LASTEXITCODE = $null
}
- name: Archive pdb files
working-directory: '${{ github.workspace }}/intermediate/pdb'
run: 7z a "${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}.7z" installed
- name: Store archived pdb files
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}.7z
- name: Archive everything else
working-directory: '${{ github.workspace }}/intermediate'
run: 7z a "${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-${{ github.sha }}.7z" * -x!pdb
- name: Store exported vcpkg packages
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-${{ github.sha }}.7z
- name: Repackage binaries for symbol server
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: ${{ env.AWS_ACCESS_KEY_ID != '' && env.AWS_SECRET_ACCESS_KEY != '' }}
run: .\Store-Symbols.ps1 ${{ github.workspace }}\intermediate
- name: Upload symbols to symbol server
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-3
if: ${{ env.AWS_ACCESS_KEY_ID != '' && env.AWS_SECRET_ACCESS_KEY != '' }}
working-directory: ${{ github.workspace }}/SymStore
run: aws --endpoint-url https://rgw.ctrl-c.liu.se s3 sync --size-only --exclude * --include *.dl_ --include *.pd_ . s3://openmw-sym
push-dynamic:
needs:
- dynamic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Setup ssh-agent
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: ${{ env.SSH_PRIVATE_KEY != '' }}
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Import GPG key
id: import_gpg
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
if: ${{ env.GPG_PRIVATE_KEY != '' && env.GPG_PRIVATE_KEY_PASSPHRASE != '' }}
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
- name: Configure ssh known hosts for gitlab.com
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: ${{ env.SSH_PRIVATE_KEY != '' }}
run: cat gitlab_known_hosts >> ~/.ssh/known_hosts
- name: Configure git user
run: |
git config --global user.email '[email protected]'
git config --global user.name 'openmw-deps-build'
- name: Configure git sign key
if: ${{ steps.import_gpg.outputs.fingerprint != '' }}
run: |
git config --global user.signkey ${{ steps.import_gpg.outputs.fingerprint }}
git config --global commit.gpgsign true
- name: Clone openmw-deps repository via SSH
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
GIT_LFS_SKIP_SMUDGE: 1
# see https://github.com/git-lfs/git-lfs/issues/5749
GIT_CLONE_PROTECTION_ACTIVE: false
if: ${{ env.SSH_PRIVATE_KEY != '' }}
run: git clone [email protected]:OpenMW/openmw-deps.git
- name: Clone openmw-deps repository via HTTPS
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
GIT_LFS_SKIP_SMUDGE: 1
# see https://github.com/git-lfs/git-lfs/issues/5749
GIT_CLONE_PROTECTION_ACTIVE: false
if: ${{ env.SSH_PRIVATE_KEY == '' }}
run: git clone https://gitlab.com/OpenMW/openmw-deps.git
- name: Move exported vcpkg packages and pdb files archive to openmw-deps repository
run: mv vcpkg-x64-*-${{ github.sha }}/vcpkg-x64-*-${{ github.sha }}.7z openmw-deps/windows/
- name: Generate commit message
env:
GH_TOKEN: ${{ github.token }}
working-directory: ${{ github.workspace }}/openmw-deps
run: |
echo Add vcpkg packages built at ${{ github.sha }} > commit_message.txt
echo >> commit_message.txt
printf 'Pushed by ' >> commit_message.txt
url=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json jobs --jq '.jobs[] | select(.name == "push-dynamic") | .url')
echo "${url:?}" >> commit_message.txt
echo >> commit_message.txt
- name: Commit exported vcpkg packages
working-directory: ${{ github.workspace }}/openmw-deps
run: |
git checkout -b vcpkg-x64-${{ github.sha }}
git add windows/vcpkg-x64-*-${{ github.sha }}.7z
git commit -F commit_message.txt
- name: Verify commit to openmw-deps repository
if: ${{ steps.import_gpg.outputs.fingerprint != '' }}
working-directory: ${{ github.workspace }}/openmw-deps
run: git verify-commit HEAD
- name: Push exported vcpkg packages to gitlab
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# Make sure only signed commits are pushed
if: ${{ vars.PUSH_URL != '' && env.SSH_PRIVATE_KEY != '' && steps.import_gpg.outputs.fingerprint != '' }}
working-directory: ${{ github.workspace }}/openmw-deps
run: |
git remote set-url --push origin "${{ vars.PUSH_URL }}"
git push origin vcpkg-x64-${{ github.sha }}