14
14
repository :
15
15
description : ' Optionally override from where to fetch the specified ref'
16
16
required : false
17
+ build_arm64 :
18
+ description : ' Optionally build ARM64 artifacts (requires a self-hosted ARM64 runner to be active in this repo)'
19
+ required : false
17
20
18
21
env :
19
22
GPG_OPTIONS : " --batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
22
25
USERPROFILE : " ${{github.workspace}}\\ home"
23
26
BUILD_ONLY : " ${{github.event.inputs.build_only}}"
24
27
REPOSITORY : " ${{github.event.inputs.repository}}"
28
+ BUILD_ARM64 : " ${{github.event.inputs.build_arm64}}"
25
29
REF : " ${{github.event.inputs.ref}}"
26
30
27
31
jobs :
@@ -96,26 +100,37 @@ jobs:
96
100
name : bundle-artifacts
97
101
path : bundle-artifacts
98
102
pkg :
99
- runs-on : windows-latest
103
+ # Hack to ensure that the "determine skip" step works if no self-hosted ARM64 runner is available
104
+ runs-on : ${{ ((matrix.arch.name == 'aarch64' && github.event.inputs.build_arm64 == 'true') && fromJSON('["Windows", "ARM64"]')) || 'windows-latest' }}
100
105
needs : bundle-artifacts
101
106
strategy :
102
107
matrix :
103
108
arch :
104
109
- name : x86_64
105
- bitness : 64
110
+ pacman_arch : x86_64
106
111
bin : /amd64
112
+ runner : windows-latest
107
113
- name : i686
108
- bitness : 32
114
+ pacman_arch : i686
109
115
bin : ' '
116
+ runner : windows-latest
117
+ - name : aarch64
118
+ pacman_arch : clang-aarch64
119
+ bin : ' '
120
+ runner : [Windows, ARM64]
110
121
steps :
111
122
- name : Determine whether this job should be skipped
112
123
shell : bash
113
124
run : |
125
+ if test "${{matrix.arch.name}}" = "aarch64" && test "$BUILD_ARM64" != "true"
126
+ then
127
+ echo "SKIP=true" >>$GITHUB_ENV
128
+ exit 0
129
+ fi
114
130
for e in ${BUILD_ONLY:-pkg}
115
131
do
116
132
case $e in
117
133
*-${{matrix.arch.name}}) exit 0;; # build this artifact
118
- *-arm64) test i686 != ${{matrix.arch.name}} || exit 0;; # pkg-i686 is required for the ARM64 version
119
134
*-*) ;; # not this build artifact, keep looking
120
135
*) exit 0;; # build this artifact
121
136
esac
@@ -135,6 +150,9 @@ jobs:
135
150
if : env.SKIP != 'true'
136
151
with :
137
152
flavor : build-installers
153
+ architecture : ${{ (matrix.arch.name == 'aarch64' && 'aarch64') || 'x86_64' }}
154
+ # We only have to clean up on self-hosted runners
155
+ cleanup : ${{ (matrix.arch.runner != 'windows-latest' && true) || false }}
138
156
- name : Download bundle-artifacts
139
157
if : env.SKIP != 'true'
140
158
uses : actions/download-artifact@v1
@@ -184,7 +202,29 @@ jobs:
184
202
git config --global user.email "<${info#*<}"
185
203
env :
186
204
GPGKEY : ${{secrets.GPGKEY}}
187
- - name : Build mingw-w64-${{matrix.arch.name}}-git
205
+ # Until there is a Git SDK for arm64, we'll need to install a few packages manually
206
+ # We install prebuilt binaries to save lots of CI time
207
+ - name : Install aarch64 deps
208
+ if : env.SKIP != 'true' && matrix.arch.name == 'aarch64'
209
+ shell : bash
210
+ run : |
211
+ set -x
212
+
213
+ package_dir="tmp-aarch64-deps"
214
+ release_url="https://github.com/dennisameling/git/releases/download/v2.39.0.windows.99"
215
+ packages="mingw-w64-clang-aarch64-openssl-1.1.1.s-1-any.pkg.tar.zst mingw-w64-clang-aarch64-curl-7.86.0-1-any.pkg.tar.zst"
216
+
217
+ mkdir -p $package_dir && cd $package_dir
218
+
219
+ for package in $packages
220
+ do
221
+ curl -LOf $release_url/$package || exit 1
222
+ done
223
+
224
+ pacman -U --noconfirm $packages
225
+
226
+ cd ../
227
+ - name : Build mingw-w64-${{matrix.arch.pacman_arch}}-git
188
228
if : env.SKIP != 'true'
189
229
env :
190
230
GPGKEY : " ${{secrets.GPGKEY}}"
@@ -195,11 +235,21 @@ jobs:
195
235
# Make sure that there is a `/usr/bin/git` that can be used by `makepkg-mingw`
196
236
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git &&
197
237
198
- # Restrict `PATH` to MSYS2 and to Visual Studio (to let `cv2pdb` find the relevant DLLs)
199
- PATH="/mingw64/bin:/usr/bin:/c/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/:/C/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin${{matrix.arch.bin}}:/C/Windows/system32"
238
+ # We don't use `cv2pdb` on aarch64, which we build using Clang instead of GCC
239
+ if test "${{matrix.arch.name}}" != "aarch64"
240
+ then
241
+ # Restrict `PATH` to MSYS2 and to Visual Studio (to let `cv2pdb` find the relevant DLLs)
242
+ PATH="/mingw64/bin:/usr/bin:/c/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/:/C/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin${{matrix.arch.bin}}:/C/Windows/system32"
243
+ type -p mspdb140.dll || exit 1
244
+ else
245
+ # We don't want to build dashed built-ins anymore. Let's do this on aarch64 only to begin with
246
+ export SKIP_DASHED_BUILT_INS=YesPlease
247
+ fi &&
248
+
249
+ # Temp until https://github.com/git-for-windows/build-extra/pull/452 is merged
250
+ /mingw64/bin/curl.exe https://raw.githubusercontent.com/git-for-windows/build-extra/3d6fc6dfe74902644c042500ad80e17abd134bfc/please.sh -o /usr/src/build-extra/please.sh &&
200
251
201
- type -p mspdb140.dll || exit 1
202
- sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-${{matrix.arch.bitness}}-bit --build-src-pkg -o artifacts HEAD &&
252
+ sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-${{matrix.arch.name}} --build-src-pkg -o artifacts HEAD &&
203
253
cp bundle-artifacts/ver artifacts/ &&
204
254
if test -n "$GPGKEY"
205
255
then
@@ -219,94 +269,16 @@ jobs:
219
269
if : always() && env.SKIP != 'true'
220
270
shell : bash
221
271
run : rm -rf home
222
- - name : Publish mingw-w64-${{matrix.arch.name }}-git
272
+ - name : Publish mingw-w64-${{matrix.arch.pacman_arch }}-git
223
273
if : env.SKIP != 'true'
224
274
uses : actions/upload-artifact@v1
225
275
with :
226
276
name : pkg-${{matrix.arch.name}}
227
277
path : artifacts
228
- build-arm64 :
229
- needs : bundle-artifacts
230
- runs-on : windows-latest
231
- steps :
232
- - name : Determine whether this job should be skipped
233
- shell : bash
234
- run : |
235
- for e in ${BUILD_ONLY:-pkg}
236
- do
237
- case $e in
238
- *-arm64) exit 0;; # build this artifact
239
- *-*) ;; # not this build artifact, keep looking
240
- *) exit 0;; # build this artifact
241
- esac
242
- done
243
- echo "SKIP=true" >>$GITHUB_ENV
244
- - name : Configure user
245
- if : env.SKIP != 'true'
246
- shell : bash
247
- run :
248
- USER_NAME="${{github.actor}}" &&
249
- USER_EMAIL="${{github.actor}}@users.noreply.github.com" &&
250
- mkdir -p "$HOME" &&
251
- git config --global user.name "$USER_NAME" &&
252
- git config --global user.email "$USER_EMAIL"
253
- - name : Download bundle-artifacts
254
- if : env.SKIP != 'true'
255
- uses : actions/download-artifact@v1
256
- with :
257
- name : bundle-artifacts
258
- path : bundle-artifacts
259
- - name : Check out git/git
260
- if : env.SKIP != 'true'
261
- shell : bash
262
- run : |
263
- git -c init.defaultBranch=main init &&
264
- git remote add -f origin https://github.com/git-for-windows/git &&
265
- git fetch --tags bundle-artifacts/git.bundle $(cat bundle-artifacts/next_version) &&
266
- git reset --hard $(cat bundle-artifacts/next_version)
267
- - name : initialize vcpkg
268
- if : env.SKIP != 'true'
269
- uses : actions/checkout@v2
270
- with :
271
- repository : ' microsoft/vcpkg'
272
- path : ' compat/vcbuild/vcpkg'
273
- - name : download vcpkg artifacts
274
- if : env.SKIP != 'true'
275
- uses : git-for-windows/get-azure-pipelines-artifact@v0
276
- with :
277
- repository : git/git
278
- definitionId : 9
279
- - name : add msbuild to PATH
280
- if : env.SKIP != 'true'
281
- uses : microsoft/setup-msbuild@v1
282
- - name : copy dlls to root
283
- if : env.SKIP != 'true'
284
- shell : powershell
285
- run : |
286
- & compat\vcbuild\vcpkg_copy_dlls.bat release arm64-windows
287
- if (!$?) { exit(1) }
288
- - name : generate Visual Studio solution
289
- if : env.SKIP != 'true'
290
- shell : bash
291
- run : |
292
- cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/arm64-windows \
293
- -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_GENERATOR_PLATFORM=arm64 -DVCPKG_ARCH=arm64-windows \
294
- -DCMAKE_INSTALL_PREFIX="`pwd`/git-arm64" -DSKIP_DASHED_BUILT_INS=ON -DHOST_CPU=arm64
295
- - name : MSBuild
296
- if : env.SKIP != 'true'
297
- run : msbuild git.sln -property:Configuration=Release
298
- - name : Link the Git executables
299
- if : env.SKIP != 'true'
300
- run : msbuild INSTALL.vcxproj -property:Configuration=Release
301
- - name : upload build artifacts
302
- if : env.SKIP != 'true'
303
- uses : actions/upload-artifact@v1
304
- with :
305
- name : arm64-artifacts
306
- path : ./git-arm64
307
278
artifacts :
308
- runs-on : windows-latest
309
- needs : [pkg, build-arm64]
279
+ # Hack to ensure that the "determine skip" step works if no self-hosted ARM64 runner is available
280
+ runs-on : ${{ ((matrix.arch.name == 'aarch64' && github.event.inputs.build_arm64 == 'true') && fromJSON('["Windows", "ARM64"]')) || 'windows-latest' }}
281
+ needs : pkg
310
282
strategy :
311
283
matrix :
312
284
artifact :
@@ -327,29 +299,35 @@ jobs:
327
299
fileextension : zip
328
300
arch :
329
301
- name : x86_64
302
+ pacman_arch : x86_64
330
303
bitness : 64
331
- arm64 : false
332
- - name : i686
333
- bitness : 32
334
- arm64 : false
304
+ msystem : MINGW64
305
+ runner : windows-latest
335
306
- name : i686
307
+ pacman_arch : i686
336
308
bitness : 32
337
- arm64 : true
309
+ msystem : MINGW32
310
+ runner : windows-latest
311
+ - name : aarch64
312
+ pacman_arch : clang-aarch64
313
+ bitness : 64
314
+ msystem : CLANGARM64
315
+ runner : [Windows, ARM64]
338
316
fail-fast : false
339
317
env :
340
- MSYSTEM : MINGW ${{matrix.arch.bitness }}
318
+ MSYSTEM : ${{matrix.arch.msystem }}
341
319
steps :
342
320
- name : Determine whether this job should be skipped
343
321
shell : bash
344
322
run : |
345
- suffix=${{matrix.arch.name}}
346
- if test true = ${{matrix.arch.arm64}}
323
+ if test "${{matrix.arch.name}}" = "aarch64" && test "$BUILD_ARM64" != "true"
347
324
then
348
- suffix=arm64
325
+ echo "SKIP=true" >>$GITHUB_ENV
326
+ exit 0
349
327
fi
350
328
case " $BUILD_ONLY " in
351
329
' ') ;; # not set; build all
352
- *" ${{matrix.artifact.name}} "*|*" ${{matrix.artifact.name}}-$suffix "*) ;; # build this artifact
330
+ *" ${{matrix.artifact.name}} "*|*" ${{matrix.artifact.name}}-${{matrix.arch.name}} "*) ;; # build this artifact
353
331
*) echo "SKIP=true" >>$GITHUB_ENV;;
354
332
esac
355
333
- name : Download pkg-${{matrix.arch.name}}
@@ -365,27 +343,43 @@ jobs:
365
343
name : bundle-artifacts
366
344
path : bundle-artifacts
367
345
- uses : git-for-windows/setup-git-for-windows-sdk@v1
368
- if : env.SKIP != 'true' && matrix.arch.bitness == '64'
369
- with :
370
- flavor : build-installers
371
- - uses : git-for-windows/setup-git-for-windows-sdk@v1
372
- if : env.SKIP != 'true' && matrix.arch.bitness == '32'
346
+ if : env.SKIP != 'true'
373
347
with :
374
348
flavor : build-installers
375
- architecture : i686
376
- - name : Download arm64 artifact
377
- if : env.SKIP != 'true' && matrix.arch.arm64 == true
378
- uses : actions/download-artifact@v1
379
- with :
380
- name : arm64-artifacts
381
- path : ${{github.workspace}}/arm64
382
- # Workaround for Git Credential Manager Core on ARM64: https://github.com/git-for-windows/git/issues/3015
383
- - name : Create git-credential-manager-core wrapper for ARM64
384
- if : env.SKIP != 'true' && matrix.arch.arm64 == true
349
+ architecture : ${{matrix.arch.name}}
350
+ # We only have to clean up on self-hosted runners
351
+ cleanup : ${{ (matrix.arch.runner != 'windows-latest' && true) || false }}
352
+ # Until there is a Git SDK for arm64, we'll need to install a few packages manually
353
+ # We install prebuilt binaries to save lots of CI time
354
+ - name : Install aarch64 deps
355
+ if : env.SKIP != 'true' && matrix.arch.name == 'aarch64'
385
356
shell : bash
386
357
run : |
387
- printf '%s\n' '#!/bin/sh' 'exec /mingw32/libexec/git-core/git-credential-manager-core.exe "$@"' > arm64/libexec/git-core/git-credential-manager-core
388
- chmod +x arm64/libexec/git-core/git-credential-manager-core
358
+ set -x
359
+
360
+ package_dir="tmp-aarch64-deps"
361
+ release_url="https://github.com/dennisameling/git/releases/download/v2.39.0.windows.99"
362
+ packages="mingw-w64-clang-aarch64-openssl-1.1.1.s-1-any.pkg.tar.zst
363
+ mingw-w64-clang-aarch64-curl-7.86.0-1-any.pkg.tar.zst
364
+ mingw-w64-clang-aarch64-wintoast-1.0.0.181.9b0663d-1-any.pkg.tar.zst
365
+ mingw-w64-clang-aarch64-xpdf-tools-4.00-1-any.pkg.tar.zst
366
+ mingw-w64-clang-aarch64-git-credential-manager-2.0.886-1-any.pkg.tar.zst
367
+ mingw-w64-clang-aarch64-git-lfs-3.3.0-1-any.pkg.tar.zst
368
+ git-extra-1.1.614.d551cf0cc-1-aarch64.pkg.tar.zst"
369
+
370
+ mkdir -p $package_dir && cd $package_dir
371
+
372
+ for package in $packages
373
+ do
374
+ curl -LOf $release_url/$package || exit 1
375
+ done
376
+
377
+ pacman -U --noconfirm $packages
378
+
379
+ # Some additional packages we need for most artifacts
380
+ pacman -S --noconfirm mingw-w64-clang-aarch64-connect mingw-w64-clang-aarch64-antiword mingw-w64-clang-aarch64-odt2txt
381
+
382
+ cd ../
389
383
- name : Clone and update build-extra
390
384
if : env.SKIP != 'true'
391
385
shell : bash
@@ -410,19 +404,16 @@ jobs:
410
404
echo -n "$CODESIGN_P12" | tr % '\n' | base64 -d >home/.sig/codesign.p12 &&
411
405
echo -n "$CODESIGN_PASS" >home/.sig/codesign.pass &&
412
406
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
413
- - name : Build ${{matrix.arch.bitness}}-bit ${{matrix.artifact.name}}
407
+ - name : Build ${{matrix.arch.name}} ${{matrix.artifact.name}}
414
408
if : env.SKIP != 'true'
415
409
shell : bash
416
410
run : |
417
411
set -x
418
- if test "${{matrix.arch.arm64}}" = true
419
- then
420
- ARM64="--include-arm64-artifacts=\"$PWD/arm64\""
421
- else
422
- ARM64=
423
- fi
424
412
425
- eval /usr/src/build-extra/please.sh make_installers_from_mingw_w64_git $ARM64 --version=$(cat pkg-${{matrix.arch.name}}/ver) -o artifacts --${{matrix.artifact.name}} --pkg=pkg-${{matrix.arch.name}}/mingw-w64-${{matrix.arch.name}}-git-[0-9]*.tar.xz --pkg=pkg-${{matrix.arch.name}}/mingw-w64-${{matrix.arch.name}}-git-doc-html-[0-9]*.tar.xz &&
413
+ # Temp until https://github.com/git-for-windows/build-extra/pull/452 is merged
414
+ /mingw${{matrix.arch.bitness}}/bin/curl.exe https://raw.githubusercontent.com/git-for-windows/build-extra/3d6fc6dfe74902644c042500ad80e17abd134bfc/please.sh -o /usr/src/build-extra/please.sh &&
415
+
416
+ eval /usr/src/build-extra/please.sh make_installers_from_mingw_w64_git --version=$(cat pkg-${{matrix.arch.name}}/ver) -o artifacts --${{matrix.artifact.name}} --pkg=pkg-${{matrix.arch.name}}/mingw-w64-${{matrix.arch.pacman_arch}}-git-[0-9]*.tar.xz --pkg=pkg-${{matrix.arch.name}}/mingw-w64-${{matrix.arch.pacman_arch}}-git-doc-html-[0-9]*.tar.xz &&
426
417
if test portable = '${{matrix.artifact.name}}' && test -n "$(git config alias.signtool)"
427
418
then
428
419
git signtool artifacts/PortableGit-*.exe
@@ -445,17 +436,11 @@ jobs:
445
436
shell : bash
446
437
run : rm -rf home
447
438
- name : Publish ${{matrix.artifact.name}}-${{matrix.arch.name}}
448
- if : env.SKIP != 'true' && matrix.arch.arm64 != true
439
+ if : env.SKIP != 'true'
449
440
uses : actions/upload-artifact@v1
450
441
with :
451
442
name : ${{matrix.artifact.name}}-${{matrix.arch.name}}
452
443
path : artifacts
453
- - name : Publish ${{matrix.artifact.name}}-arm64
454
- if : env.SKIP != 'true' && matrix.arch.arm64 == true
455
- uses : actions/upload-artifact@v1
456
- with :
457
- name : ${{matrix.artifact.name}}-arm64
458
- path : artifacts
459
444
nuget :
460
445
runs-on : windows-latest
461
446
needs : pkg
0 commit comments