Skip to content

Commit 58f679d

Browse files
mjcheethamdscho
authored andcommitted
Add support for Windows on ARM (#713)
Bring support for Windows on ARM64 to this fork of Git. We make use of a custom 1ES hosted pool (hosted in Azure) that runs Windows 11 ARM64 on a `B4pls v2` sized VM SKU. The image has the latest Git for Windows ARM64 installed, the GitHub Actions runner, along with PowerShell Core (required for the GitHub Actions runner). Requests with the `['self-hosted', '1ES.Pool=github-arm64-pool']` labels will be directed to the 1ES hosted pool. A few changes were made to the `build-git-installers.yml` workflow, mainly to parameterise the architecture to allow for x86_64 and aarch64 builds, via a matrix strategy. Find the end-to-end successful build of `build-git-installers.yml` [here](https://github.com/microsoft/git/actions/runs/12358457268).
2 parents 8ad18d5 + 4a56c17 commit 58f679d

File tree

2 files changed

+81
-45
lines changed

2 files changed

+81
-45
lines changed

.github/workflows/build-git-installers.yml

Lines changed: 80 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,25 @@ jobs:
5050
test "${{ steps.tag.outputs.version }}" == "$(sed -n 's/^GIT_VERSION = //p'< GIT-VERSION-FILE)" || die "GIT-VERSION-FILE tag does not match ${{ steps.tag.outputs.name }}"
5151
# End check prerequisites for the workflow
5252

53-
# Build Windows installers (x86_64 installer & portable)
53+
# Build Windows installers (x86_64 & aarch64; installer & portable)
5454
windows_pkg:
55-
runs-on: windows-2019
5655
environment: release
5756
needs: prereqs
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
arch:
61+
- name: x86_64
62+
artifact: pkg-x86_64
63+
toolchain: x86_64
64+
mingwprefix: mingw64
65+
runner: windows-2019
66+
- name: aarch64
67+
artifact: pkg-aarch64
68+
toolchain: clang-aarch64
69+
mingwprefix: clangarm64
70+
runner: ['self-hosted', '1ES.Pool=github-arm64-pool']
71+
runs-on: ${{ matrix.arch.runner }}
5872
env:
5973
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
6074
HOME: "${{github.workspace}}\\home"
@@ -72,6 +86,7 @@ jobs:
7286
- uses: git-for-windows/setup-git-for-windows-sdk@v1
7387
with:
7488
flavor: build-installers
89+
architecture: ${{ matrix.arch.name }}
7590
- name: Clone build-extra
7691
shell: bash
7792
run: |
@@ -112,22 +127,17 @@ jobs:
112127
git config --global user.email "<${info#*<}"
113128
env:
114129
GPGKEY: ${{secrets.GPGKEY}}
115-
- name: Build mingw-w64-x86_64-git
130+
- name: Build mingw-w64-${{matrix.arch.toolchain}}-git
116131
env:
117132
GPGKEY: "${{secrets.GPGKEY}}"
118133
shell: bash
119134
run: |
120135
set -x
121136
122137
# Make sure that there is a `/usr/bin/git` that can be used by `makepkg-mingw`
123-
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git &&
124-
125-
# Restrict `PATH` to MSYS2 and to Visual Studio (to let `cv2pdb` find the relevant DLLs)
126-
PATH="/mingw64/bin:/usr/bin:/C/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64:/C/Windows/system32"
138+
printf '#!/bin/sh\n\nexec /${{matrix.arch.mingwprefix}}/bin/git.exe "$@"\n' >/usr/bin/git &&
127139
128-
type -p mspdb140.dll || exit 1
129-
130-
sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-64-bit --build-src-pkg -o artifacts HEAD &&
140+
sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-${{matrix.arch.name}} --build-src-pkg -o artifacts HEAD &&
131141
if test -n "$GPGKEY"
132142
then
133143
for tar in artifacts/*.tar*
@@ -142,34 +152,46 @@ jobs:
142152
cp PKGBUILD.$version PKGBUILD &&
143153
git commit -s -m "mingw-w64-git: new version ($version)" PKGBUILD &&
144154
git bundle create "$b"/MINGW-packages.bundle origin/main..main)
145-
- name: Publish mingw-w64-x86_64-git
155+
- name: Publish mingw-w64-${{matrix.arch.toolchain}}-git
146156
uses: actions/upload-artifact@v4
147157
with:
148-
name: pkg-x86_64
158+
name: "${{ matrix.arch.artifact }}"
149159
path: artifacts
150160
windows_artifacts:
151-
runs-on: windows-2019
152161
environment: release
153162
needs: [prereqs, windows_pkg]
154163
env:
155164
HOME: "${{github.workspace}}\\home"
156165
strategy:
166+
fail-fast: false
157167
matrix:
158-
artifact:
168+
arch:
169+
- name: x86_64
170+
artifact: pkg-x86_64
171+
toolchain: x86_64
172+
mingwprefix: mingw64
173+
runner: windows-2019
174+
- name: aarch64
175+
artifact: pkg-aarch64
176+
toolchain: clang-aarch64
177+
mingwprefix: clangarm64
178+
runner: ['self-hosted', '1ES.Pool=github-arm64-pool']
179+
type:
159180
- name: installer
160181
fileprefix: Git
161182
- name: portable
162183
fileprefix: PortableGit
163-
fail-fast: false
184+
runs-on: ${{ matrix.arch.runner }}
164185
steps:
165-
- name: Download pkg-x86_64
186+
- name: Download ${{ matrix.arch.artifact }}
166187
uses: actions/download-artifact@v4
167188
with:
168-
name: pkg-x86_64
169-
path: pkg-x86_64
189+
name: ${{ matrix.arch.artifact }}
190+
path: ${{ matrix.arch.artifact }}
170191
- uses: git-for-windows/setup-git-for-windows-sdk@v1
171192
with:
172193
flavor: build-installers
194+
architecture: ${{ matrix.arch.name }}
173195
- name: Clone build-extra
174196
shell: bash
175197
run: |
@@ -199,7 +221,7 @@ jobs:
199221
EOF
200222
201223
sed -i -e '/^#include "file-list.iss"/a\
202-
Source: {#SourcePath}\\..\\git-update-git-for-windows.config; DestDir: {app}\\mingw64\\bin; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore' \
224+
Source: {#SourcePath}\\..\\git-update-git-for-windows.config; DestDir: {app}\\${{matrix.arch.mingwprefix}}\\bin; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore' \
203225
-e '/^Type: dirifempty; Name: {app}\\{#MINGW_BITNESS}$/i\
204226
Type: files; Name: {app}\\{#MINGW_BITNESS}\\bin\\git-update-git-for-windows.config\
205227
Type: dirifempty; Name: {app}\\{#MINGW_BITNESS}\\bin' \
@@ -209,15 +231,15 @@ jobs:
209231
run: |
210232
set -x
211233
212-
b=/mingw64/bin &&
234+
b=/${{matrix.arch.mingwprefix}}/bin &&
213235
214236
sed -i -e '6 a use_recently_seen=no' \
215237
$b/git-update-git-for-windows
216-
- name: Set the installer Publisher to the GitClient team
238+
- name: Set the installer Publisher to the Git Client team
217239
shell: bash
218240
run: |
219241
b=/usr/src/build-extra &&
220-
sed -i -e 's/^\(AppPublisher=\).*/\1The GitClient Team at Microsoft/' $b/installer/install.iss
242+
sed -i -e 's/^\(AppPublisher=\).*/\1The Git Client Team at Microsoft/' $b/installer/install.iss
221243
- name: Let the installer configure Visual Studio to use the installed Git
222244
shell: bash
223245
run: |
@@ -269,49 +291,44 @@ jobs:
269291
WizardSelectComponents('scalar');\n\
270292
#endif\n\
271293
end;" $b/installer/install.iss
272-
- name: Build 64-bit ${{matrix.artifact.name}}
294+
- name: Build ${{matrix.type.name}} (${{matrix.arch.name}})
273295
shell: bash
274296
run: |
275297
set -x
276298
277299
# Copy the PDB archive to the directory where `--include-pdbs` expects it
278300
b=/usr/src/build-extra &&
279301
mkdir -p $b/cached-source-packages &&
280-
cp pkg-x86_64/*-pdb* $b/cached-source-packages/ &&
302+
cp ${{matrix.arch.artifact}}/*-pdb* $b/cached-source-packages/ &&
281303
282304
# Build the installer, embedding PDBs
283305
eval $b/please.sh make_installers_from_mingw_w64_git --include-pdbs \
284306
--version=${{ needs.prereqs.outputs.tag_version }} \
285-
-o artifacts --${{matrix.artifact.name}} \
286-
--pkg=pkg-x86_64/mingw-w64-x86_64-git-[0-9]*.tar.xz \
287-
--pkg=pkg-x86_64/mingw-w64-x86_64-git-doc-html-[0-9]*.tar.xz &&
307+
-o artifacts --${{matrix.type.name}} \
308+
--pkg=${{matrix.arch.artifact}}/mingw-w64-${{matrix.arch.toolchain}}-git-[0-9]*.tar.xz \
309+
--pkg=${{matrix.arch.artifact}}/mingw-w64-${{matrix.arch.toolchain}}-git-doc-html-[0-9]*.tar.xz &&
288310
289-
if test portable = '${{matrix.artifact.name}}' && test -n "$(git config alias.signtool)"
311+
if test portable = '${{matrix.type.name}}' && test -n "$(git config alias.signtool)"
290312
then
291313
git signtool artifacts/PortableGit-*.exe
292314
fi &&
293-
openssl dgst -sha256 artifacts/${{matrix.artifact.fileprefix}}-*.exe | sed "s/.* //" >artifacts/sha-256.txt
315+
openssl dgst -sha256 artifacts/${{matrix.type.fileprefix}}-*.exe | sed "s/.* //" >artifacts/sha-256.txt
294316
- name: Verify that .exe files are code-signed
295317
if: env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
296318
shell: bash
297319
run: |
298320
PATH=$PATH:"/c/Program Files (x86)/Windows Kits/10/App Certification Kit/" \
299-
signtool verify //pa artifacts/${{matrix.artifact.fileprefix}}-*.exe
300-
- name: Publish ${{matrix.artifact.name}}-x86_64
321+
signtool verify //pa artifacts/${{matrix.type.fileprefix}}-*.exe
322+
- name: Publish ${{matrix.type.name}}-${{matrix.arch.name}}
301323
uses: actions/upload-artifact@v4
302324
with:
303-
name: win-${{matrix.artifact.name}}-x86_64
325+
name: win-${{matrix.type.name}}-${{matrix.arch.name}}
304326
path: artifacts
305327
# End build Windows installers
306328

307329
# Build and sign Mac OSX installers & upload artifacts
308330
create-macos-artifacts:
309-
strategy:
310-
matrix:
311-
arch:
312-
- name: arm64
313-
runner: macos-latest-xl-arm64
314-
runs-on: ${{ matrix.arch.runner }}
331+
runs-on: macos-latest-xl-arm64
315332
needs: prereqs
316333
env:
317334
VERSION: "${{ needs.prereqs.outputs.tag_version }}"
@@ -613,6 +630,9 @@ jobs:
613630
- os: windows-latest
614631
artifact: win-installer-x86_64
615632
command: $PROGRAMFILES\Git\cmd\git.exe
633+
- os: ['self-hosted', '1ES.Pool=github-arm64-pool']
634+
artifact: win-installer-aarch64
635+
command: $PROGRAMFILES\Git\cmd\git.exe
616636
runs-on: ${{ matrix.component.os }}
617637
needs: [prereqs, windows_artifacts, create-macos-artifacts, create-linux-artifacts]
618638
steps:
@@ -622,20 +642,20 @@ jobs:
622642
name: ${{ matrix.component.artifact }}
623643

624644
- name: Install Windows
625-
if: contains(matrix.component.os, 'windows')
645+
if: contains(matrix.component.artifact, 'win-installer')
626646
shell: pwsh
627647
run: |
628648
$exePath = Get-ChildItem -Path ./*.exe | %{$_.FullName}
629649
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1"
630650
631651
- name: Install Linux
632-
if: contains(matrix.component.os, 'ubuntu')
652+
if: contains(matrix.component.artifact, 'linux')
633653
run: |
634654
debpath=$(find ./*.deb)
635655
sudo apt install $debpath
636656
637657
- name: Install macOS
638-
if: contains(matrix.component.os, 'macos')
658+
if: contains(matrix.component.artifact, 'macos')
639659
run: |
640660
# avoid letting Homebrew's `git` in `/opt/homebrew/bin` override `/usr/local/bin/git`
641661
arch="$(uname -m)"
@@ -683,18 +703,30 @@ jobs:
683703
needs.create-macos-artifacts.result == 'success' &&
684704
needs.windows_artifacts.result == 'success')
685705
steps:
686-
- name: Download Windows portable installer
706+
- name: Download Windows portable (x86_64)
687707
uses: actions/download-artifact@v4
688708
with:
689709
name: win-portable-x86_64
690710
path: win-portable-x86_64
691711

692-
- name: Download Windows x86_64 installer
712+
- name: Download Windows portable (aarch64)
713+
uses: actions/download-artifact@v4
714+
with:
715+
name: win-portable-aarch64
716+
path: win-portable-aarch64
717+
718+
- name: Download Windows installer (x86_64)
693719
uses: actions/download-artifact@v4
694720
with:
695721
name: win-installer-x86_64
696722
path: win-installer-x86_64
697723

724+
- name: Download Windows installer (aarch64)
725+
uses: actions/download-artifact@v4
726+
with:
727+
name: win-installer-aarch64
728+
path: win-installer-aarch64
729+
698730
- name: Download macOS artifacts
699731
uses: actions/download-artifact@v4
700732
with:
@@ -764,10 +796,14 @@ jobs:
764796
}
765797
766798
await Promise.all([
767-
// Upload Windows artifacts
799+
// Upload Windows x86_64 artifacts
768800
uploadDirectoryToRelease('win-installer-x86_64', ['.exe']),
769801
uploadDirectoryToRelease('win-portable-x86_64', ['.exe']),
770802
803+
// Upload Windows aarch64 artifacts
804+
uploadDirectoryToRelease('win-installer-aarch64', ['.exe']),
805+
uploadDirectoryToRelease('win-portable-aarch64', ['.exe']),
806+
771807
// Upload Mac artifacts
772808
uploadDirectoryToRelease('macos-artifacts'),
773809

.github/workflows/clangarm64-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defaults:
99

1010
jobs:
1111
clang-build:
12-
runs-on: [Windows, ARM64]
12+
runs-on: ['self-hosted', '1ES.Pool=github-arm64-pool']
1313
env:
1414
NO_PERL: 1
1515
steps:

0 commit comments

Comments
 (0)