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,34 @@ 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
107
112
- name : i686
108
- bitness : 32
113
+ pacman_arch : i686
114
+ bin : ' '
115
+ - name : aarch64
116
+ pacman_arch : clang-aarch64
109
117
bin : ' '
110
118
steps :
111
119
- name : Determine whether this job should be skipped
112
120
shell : bash
113
121
run : |
122
+ if test "${{matrix.arch.name}}" = "aarch64" && test "$BUILD_ARM64" != "true"
123
+ then
124
+ echo "SKIP=true" >>$GITHUB_ENV
125
+ exit 0
126
+ fi
114
127
for e in ${BUILD_ONLY:-pkg}
115
128
do
116
129
case $e in
117
130
*-${{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
131
*-*) ;; # not this build artifact, keep looking
120
132
*) exit 0;; # build this artifact
121
133
esac
@@ -135,6 +147,9 @@ jobs:
135
147
if : env.SKIP != 'true'
136
148
with :
137
149
flavor : build-installers
150
+ architecture : ${{ (matrix.arch.name == 'aarch64' && 'aarch64') || 'x86_64' }}
151
+ # We only have to clean up on self-hosted runners
152
+ cleanup : ${{ (runner.arch == 'ARM64' && true) || false }}
138
153
- name : Download bundle-artifacts
139
154
if : env.SKIP != 'true'
140
155
uses : actions/download-artifact@v1
@@ -184,7 +199,29 @@ jobs:
184
199
git config --global user.email "<${info#*<}"
185
200
env :
186
201
GPGKEY : ${{secrets.GPGKEY}}
187
- - name : Build mingw-w64-${{matrix.arch.name}}-git
202
+ # Until there is a Git SDK for arm64, we'll need to install a few packages manually
203
+ # We install prebuilt binaries to save lots of CI time
204
+ - name : Install aarch64 deps
205
+ if : env.SKIP != 'true' && matrix.arch.name == 'aarch64'
206
+ shell : bash
207
+ run : |
208
+ set -x
209
+
210
+ package_dir="tmp-aarch64-deps"
211
+ release_url="https://github.com/dennisameling/git/releases/download/v2.39.0.windows.99"
212
+ 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"
213
+
214
+ mkdir -p $package_dir && cd $package_dir
215
+
216
+ for package in $packages
217
+ do
218
+ curl -LOf $release_url/$package || exit 1
219
+ done
220
+
221
+ pacman -U --noconfirm $packages
222
+
223
+ cd ../
224
+ - name : Build mingw-w64-${{matrix.arch.pacman_arch}}-git
188
225
if : env.SKIP != 'true'
189
226
env :
190
227
GPGKEY : " ${{secrets.GPGKEY}}"
@@ -195,11 +232,21 @@ jobs:
195
232
# Make sure that there is a `/usr/bin/git` that can be used by `makepkg-mingw`
196
233
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git &&
197
234
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"
235
+ # We don't use `cv2pdb` on aarch64, which we build using Clang instead of GCC
236
+ if test "${{matrix.arch.name}}" != "aarch64"
237
+ then
238
+ # Restrict `PATH` to MSYS2 and to Visual Studio (to let `cv2pdb` find the relevant DLLs)
239
+ 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"
240
+ type -p mspdb140.dll || exit 1
241
+ else
242
+ # We don't want to build dashed built-ins anymore. Let's do this on aarch64 only to begin with
243
+ export SKIP_DASHED_BUILT_INS=YesPlease
244
+ fi &&
245
+
246
+ # Temp until https://github.com/git-for-windows/build-extra/pull/452 is merged
247
+ /mingw64/bin/curl.exe https://raw.githubusercontent.com/git-for-windows/build-extra/3d6fc6dfe74902644c042500ad80e17abd134bfc/please.sh -o /usr/src/build-extra/please.sh &&
200
248
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 &&
249
+ sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-${{matrix.arch.name}} --build-src-pkg -o artifacts HEAD &&
203
250
cp bundle-artifacts/ver artifacts/ &&
204
251
if test -n "$GPGKEY"
205
252
then
@@ -219,94 +266,16 @@ jobs:
219
266
if : always() && env.SKIP != 'true'
220
267
shell : bash
221
268
run : rm -rf home
222
- - name : Publish mingw-w64-${{matrix.arch.name }}-git
269
+ - name : Publish mingw-w64-${{matrix.arch.pacman_arch }}-git
223
270
if : env.SKIP != 'true'
224
271
uses : actions/upload-artifact@v1
225
272
with :
226
273
name : pkg-${{matrix.arch.name}}
227
274
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
275
artifacts :
308
- runs-on : windows-latest
309
- needs : [pkg, build-arm64]
276
+ # Hack to ensure that the "determine skip" step works if no self-hosted ARM64 runner is available
277
+ runs-on : ${{ ((matrix.arch.name == 'aarch64' && github.event.inputs.build_arm64 == 'true') && fromJSON('["Windows", "ARM64"]')) || 'windows-latest' }}
278
+ needs : pkg
310
279
strategy :
311
280
matrix :
312
281
artifact :
@@ -327,29 +296,32 @@ jobs:
327
296
fileextension : zip
328
297
arch :
329
298
- name : x86_64
299
+ pacman_arch : x86_64
330
300
bitness : 64
331
- arm64 : false
332
- - name : i686
333
- bitness : 32
334
- arm64 : false
301
+ msystem : MINGW64
335
302
- name : i686
303
+ pacman_arch : i686
336
304
bitness : 32
337
- arm64 : true
305
+ msystem : MINGW32
306
+ - name : aarch64
307
+ pacman_arch : clang-aarch64
308
+ bitness : 64
309
+ msystem : CLANGARM64
338
310
fail-fast : false
339
311
env :
340
- MSYSTEM : MINGW ${{matrix.arch.bitness }}
312
+ MSYSTEM : ${{matrix.arch.msystem }}
341
313
steps :
342
314
- name : Determine whether this job should be skipped
343
315
shell : bash
344
316
run : |
345
- suffix=${{matrix.arch.name}}
346
- if test true = ${{matrix.arch.arm64}}
317
+ if test "${{matrix.arch.name}}" = "aarch64" && test "$BUILD_ARM64" != "true"
347
318
then
348
- suffix=arm64
319
+ echo "SKIP=true" >>$GITHUB_ENV
320
+ exit 0
349
321
fi
350
322
case " $BUILD_ONLY " in
351
323
' ') ;; # not set; build all
352
- *" ${{matrix.artifact.name}} "*|*" ${{matrix.artifact.name}}-$suffix "*) ;; # build this artifact
324
+ *" ${{matrix.artifact.name}} "*|*" ${{matrix.artifact.name}}-${{matrix.arch.name}} "*) ;; # build this artifact
353
325
*) echo "SKIP=true" >>$GITHUB_ENV;;
354
326
esac
355
327
- name : Download pkg-${{matrix.arch.name}}
@@ -365,27 +337,43 @@ jobs:
365
337
name : bundle-artifacts
366
338
path : bundle-artifacts
367
339
- 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'
340
+ if : env.SKIP != 'true'
373
341
with :
374
342
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
343
+ architecture : ${{matrix.arch.name}}
344
+ # We only have to clean up on self-hosted runners
345
+ cleanup : ${{ (runner.arch == 'ARM64' && true) || false }}
346
+ # Until there is a Git SDK for arm64, we'll need to install a few packages manually
347
+ # We install prebuilt binaries to save lots of CI time
348
+ - name : Install aarch64 deps
349
+ if : env.SKIP != 'true' && matrix.arch.name == 'aarch64'
385
350
shell : bash
386
351
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
352
+ set -x
353
+
354
+ package_dir="tmp-aarch64-deps"
355
+ release_url="https://github.com/dennisameling/git/releases/download/v2.39.0.windows.99"
356
+ packages="mingw-w64-clang-aarch64-openssl-1.1.1.s-1-any.pkg.tar.zst
357
+ mingw-w64-clang-aarch64-curl-7.86.0-1-any.pkg.tar.zst
358
+ mingw-w64-clang-aarch64-wintoast-1.0.0.181.9b0663d-1-any.pkg.tar.zst
359
+ mingw-w64-clang-aarch64-xpdf-tools-4.00-1-any.pkg.tar.zst
360
+ mingw-w64-clang-aarch64-git-credential-manager-2.0.886-1-any.pkg.tar.zst
361
+ mingw-w64-clang-aarch64-git-lfs-3.3.0-1-any.pkg.tar.zst
362
+ git-extra-1.1.616.ced335bb5-1-any.pkg.tar.zst"
363
+
364
+ mkdir -p $package_dir && cd $package_dir
365
+
366
+ for package in $packages
367
+ do
368
+ curl -LOf $release_url/$package || exit 1
369
+ done
370
+
371
+ pacman -U --noconfirm $packages
372
+
373
+ # Some additional packages we need for most artifacts
374
+ pacman -S --noconfirm mingw-w64-clang-aarch64-connect mingw-w64-clang-aarch64-antiword mingw-w64-clang-aarch64-odt2txt
375
+
376
+ cd ../
389
377
- name : Clone and update build-extra
390
378
if : env.SKIP != 'true'
391
379
shell : bash
@@ -410,26 +398,23 @@ jobs:
410
398
echo -n "$CODESIGN_P12" | tr % '\n' | base64 -d >home/.sig/codesign.p12 &&
411
399
echo -n "$CODESIGN_PASS" >home/.sig/codesign.pass &&
412
400
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
413
- - name : Build ${{matrix.arch.bitness}}-bit ${{matrix.artifact.name}}
401
+ - name : Build ${{matrix.arch.name}} ${{matrix.artifact.name}}
414
402
if : env.SKIP != 'true'
415
403
shell : bash
416
404
run : |
417
405
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
406
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 &&
407
+ # Temp until https://github.com/git-for-windows/build-extra/pull/452 is merged
408
+ /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 &&
409
+
410
+ 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
411
if test portable = '${{matrix.artifact.name}}' && test -n "$(git config alias.signtool)"
427
412
then
428
413
git signtool artifacts/PortableGit-*.exe
429
414
fi &&
430
415
openssl dgst -sha256 artifacts/${{matrix.artifact.fileprefix}}-*.${{matrix.artifact.fileextension}} | sed "s/.* //" >artifacts/sha-256.txt
431
416
- name : Copy package-versions and pdbs
432
- if : env.SKIP != 'true' && matrix.artifact.name == 'installer'
417
+ if : env.SKIP != 'true' && matrix.artifact.name == 'installer' && matrix.arch.name != 'aarch64'
433
418
shell : bash
434
419
run : |
435
420
cp /usr/src/build-extra/installer/package-versions.txt artifacts/ &&
@@ -445,17 +430,11 @@ jobs:
445
430
shell : bash
446
431
run : rm -rf home
447
432
- name : Publish ${{matrix.artifact.name}}-${{matrix.arch.name}}
448
- if : env.SKIP != 'true' && matrix.arch.arm64 != true
433
+ if : env.SKIP != 'true'
449
434
uses : actions/upload-artifact@v1
450
435
with :
451
436
name : ${{matrix.artifact.name}}-${{matrix.arch.name}}
452
437
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
438
nuget :
460
439
runs-on : windows-latest
461
440
needs : pkg
0 commit comments